Re: ESMF regrid fuction

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Dec 10 2012 - 10:58:31 MST

Hi Amjad,

Just an FYI: the default behavior for ESMF_regrid, if you specify the output grid as something like "0.5deg", is that the latitudes will go from -90 to 90, and the longitudes from -180 to 180.

If this is not desired, then you can set the special options DstLLCorner to the southwest desired corner (default is (/-90,180/)) and DstURCorner to the northeast desired corner (default is (/90,180/)).

In your case, you could use:

   opt@DstLLCorner = (/-90,-180/)
   opt@DstURCorner = (/0,357.5/)

These two options should be set *especially* if you have a source grid that is not global, and hence you don't need a global destination grid. The larger you make the destination grid, than the slower it can take to generate the weights for the interpolation.

--Mary

On Dec 8, 2012, at 12:56 AM, Muhammad Amjad wrote:

> Hi Dennis,
>
> Thanks for you kind answer. By using your suggested script I am
> getting lon values in created file from -180 to 180 and 145 grids for
> lon. As I mentioned in my script I need it like 0 - 357.5 or 144
> grids. Latitudes were regenerated as per desired.
>
> Best regards,
>
> Amjad.
>
>
>
> On 12/7/12, Dennis Shea <shea@ucar.edu> wrote:
>> It seems youtook Example 4 from
>>
>> http://www.ncl.ucar.edu/Applications/ESMF.shtml
>>
>> and plugged in some numbers. Also, statements like
>> "The output variable has values but can't be displayed
>> and size on disk."
>>
>> This is not clear.
>>
>> If your are new to NCL please read the Mini-Language Manual at:
>>
>> http://www.ncl.ucar.edu/Document/Manuals/
>>
>> There is also a graphics manual.
>>
>> Below is a (hopefully) working version of your script.
>>
>> Note: the built-in NCL function "linint2_Wrap" does
>> the exact same thing.
>>
>> ;===============================================================
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"
>>
>> diri = "./"
>> fili = "air.2m.gauss.2010.nc"
>> sfile = addfile(diri+fili,"r")
>> data = short2flt(sfile->air(:,0,:,:))
>> printVarSummary(data)
>>
>> method = "bilinear"
>>
>> Opt = True
>> Opt@SrcTitle = "fili"
>> Opt@DstGridType = "2.5deg" ; Destination grid description
>> Opt@DstTitle = "Global 2.5 degree resolution"
>> Opt@ForceOverwrite = True
>> Opt@RemoveSrcFile = True ; rm source grid description file
>> Opt@RemoveDstFile = True ; rm destination grid description file
>> Opt@RemoveWgtFile = False ; Keep for future use
>> Opt@InterpMethod = method
>> Opt@WgtFileName = "wgt.gauss."+method+".nc"
>>
>> data_regrid = ESMF_regrid(data,Opt) ; Do the regridding
>> printVarSummary(data_regrid)
>> print("data_regrid: min="+min(data_regrid)+" max="+max(data_regrid))
>>
>> sfx = get_file_suffix(fili, 0)
>> regridFile = "esmf_regrid."+sfx@fBase+".nc"
>> system("/bin/rm -f "+regridFile)
>> b = addfile(regridFile,"c")
>> b->DATA_REGRID = data_regrid
>>
>> ;++++++++++++++++++++++++++++++++++++++++++++++++
>> ; Comparison with linint2: the same
>> ;++++++++++++++++++++++++++++++++++++++++++++++++
>> latG = latGlobeF( 73, "lat", "latitude", "degrees_north")
>> lonG = lonGlobeF(144, "lon", "longitude", "degrees_east")
>> data = data(:,::-1,:) ; linint2 requires S->N
>> data_bil2 = linint2_Wrap(data&lon,data&lat,data,True,lonG,latG,0)
>> printVarSummary(data_bil2)
>> print("data_bil2: min="+min(data_bil2)+" max="+max(data_bil2))
>>
>>
>>
>> On 12/07/2012 02:59 AM, Muhammad Amjad wrote:
>>> Dear All,
>>>
>>> I am using latest ncl. I am using this script but the regrided file
>>> generated through this can't be displayed. The output variable has
>>> values but can't be displayed and size on disk.
>>> ---------------------------------
>> [SNIP]
>>
>>
>
>
> --
> Muhammad Amjad
> Scientific Officer (Climate Section)
> Global Change Impact Studies Centre
> National Centre for Physics Complex
> Near Quaid-i-Azam University Campus
> Shahdra Road P.O. Box 3022 , Islamabad
> Phone: 051 - 2077300/ Ext. 514
> Fax: 051 - 2077385
> Mobile: +92 321 5309339
> E-mail: m.amjad@gcisc.org.pk, callamjad@gmail.com
> -----
> Young Scientists Summer Program - 2010, Participant
> International Institute for Applied Systems Analysis, Austria.
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Dec 11 02:58:43 2012

This archive was generated by hypermail 2.1.8 : Wed Dec 12 2012 - 19:07:01 MST