[ncl-talk] Can ESMF_regrid be used for output Gaussian grid?

Rashed Mahmood rashidcomsis at gmail.com
Wed Mar 1 11:46:39 MST 2017


Thank you Dennis! My problem is solved.

Just for information, I want to add that although ESMF conservative method
does a better job here, however, it also expands values over islands
(probably because my output grid is very coarse). This can be seen in
attached file (without_land_mask_exp.pdf). Of course we can easily mask
those values using landsea_mask function (as shown in attached file
"land_mask_exp.pdf").
The script is also attached where these can be reproduced by specifying
"landmask    = True/False"

Rashed





On Tue, Feb 28, 2017 at 9:37 PM, Dennis Shea <shea at ucar.edu> wrote:

> No.
>
> [1]
> Look at your source variable. The 'cod' variable contains the cyclic points
>
> Variable: cod
> Dimensions and sizes:    [lat | 45] x [lon | 361]
> Coordinates:
>             lat: [  45..  89]
>             lon: [-180.. 180]         <==== Cyclic point
>
> ====
> The cyclic point should be avoided.
>
>    cod    = ifil->cod(:,{-180:179})
>    printVarSummary(cod)
>    printMinMax(cod,0)
>
> Variable: cod
> Dimensions and sizes:    [lat | 45] x [lon | 360]
> Coordinates:
>             lat: [  45..  89]
>             lon: [-180.. 179]       <==== No Cyclic point
>
> ++++++++++++++++++++++++++++++++++++++++
>
> [2]
> Again, look at your data ... the 'cod' variable contains missing values.
> These must be flagged.
>
>    nmsg   = num(ismissing(cod))
>    print("nmsg="+nmsg)
>    print("---------------")
> ...
>    if (nmsg.gt.0) then
>        opt at SrcMask2D     = where(.not.ismissing(cod),1,0)
>    end if
>
> ++++++++++++++++++++++++++++++++++++++
>
> See attached
>
> Variable: cod_conserve
> Type: float
> Total Size: 8192 bytes
>             2048 values
> Number of Dimensions: 2
> Dimensions and sizes:    [lat | 16] x [lon | 128]
> Coordinates:
>             lat: [46.04472732543945..87.86380004882812]
>             lon: [-180..177.1875]
> Number Of Attributes: 3
>   _FillValue :    -999
>   remap :    remapped via ESMF_regrid_with_weights: Bilinear
>   missing_value :    -999
> (0)    min=0.274607   max=1.91372
>
>
>
>
>
>
> On Tue, Feb 28, 2017 at 6:45 PM, Rashed Mahmood <rashidcomsis at gmail.com>
> wrote:
>
>> Sorry please ignore previous message; I think It can be done using ESMF
>> regrid by using:
>>     Opt at DstGridLon        = LONT
>>     Opt at DstGridLat        = TLAT      ;(Gaussian lats)
>>     Opt at DstRegional       = True
>>
>> On Tue, Feb 28, 2017 at 5:26 PM, Rashed Mahmood <rashidcomsis at gmail.com>
>> wrote:
>>
>>> Hi everyone,
>>>
>>> My data is 1*1 degree resolution which is Not global (latitute span:
>>> 45N-89N) and I want to convert it into a Gaussian grid as below. I thought
>>> ESMF_regrid would be easy But I am not sure what to specify for attribute
>>> "Opt at DstGridType       = "??????" for a Gaussian destination grid?
>>>
>>> So I tried using area_conserve_remap as in following simple code:
>>>
>>> begin
>>>    ifil   = addfile("test_file.nc","r")
>>>    cod    = ifil->cod
>>>    printVarSummary(cod)
>>>
>>>    NLATT  = 64
>>>    MLONT  =  2*NLATT
>>>    LATT   = latGau(NLATT, "lat", "latitude" , "degrees_north")
>>>    LONT   =  fspan(-180,180,128)
>>>    TLAT   = LATT({45:90})
>>>
>>>    opt       = True
>>>    opt at NLATi = 178
>>>    opt at NALTo = NLATT
>>>    gcod      = area_conserve_remap_Wrap (cod&lon, cod&lat, cod ,LONT,
>>> TLAT, opt)
>>>
>>> end
>>>
>>>
>>> However, I am getting error as below, which I understand is due not
>>> global lats but not sure how to fix it? The sample data file attached.
>>>
>>> Copyright (C) 1995-2015 - All Rights Reserved
>>>  University Corporation for Atmospheric Research
>>>  NCAR Command Language Version 6.3.0
>>>  The use of this software is governed by a License Agreement.
>>>  See http://www.ncl.ucar.edu/ for more details.
>>>
>>> Variable: cod
>>> Type: float
>>> Total Size: 64980 bytes
>>>             16245 values
>>> Number of Dimensions: 2
>>> Dimensions and sizes:   [lat | 45] x [lon | 361]
>>> Coordinates:
>>>             lat: [  45..  89]
>>>             lon: [-180.. 180]
>>> Number Of Attributes: 3
>>>   _FillValue :  -999
>>>   remap :       remapped via ESMF_regrid_with_weights: Bilinear
>>>   missing_value :       -999
>>>  Error in "cremapbin":
>>>  Could not map global lat array into grid array
>>> Abort (core dumped)
>>>
>>> any thoughts?
>>>
>>>
>>>
>>> Thank you,
>>> Rashed
>>>
>>>
>>>
>>>
>>>
>>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170301/e36c3e42/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: without_land_mask_exp.pdf
Type: application/pdf
Size: 272243 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170301/e36c3e42/attachment-0002.pdf 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: land_mask_exp.pdf
Type: application/pdf
Size: 268019 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170301/e36c3e42/attachment-0003.pdf 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ESMF_regrid_test.ncl
Type: application/octet-stream
Size: 2952 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170301/e36c3e42/attachment-0001.obj 


More information about the ncl-talk mailing list