Re: ESMF regrid fuction

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri Dec 07 2012 - 11:57:17 MST

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]

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Dec 7 11:57:29 2012

This archive was generated by hypermail 2.1.8 : Fri Dec 07 2012 - 13:30:06 MST