[ncl-talk] sub: Regridding NARR data
Dennis Shea
shea at ucar.edu
Sun Mar 1 20:25:25 MST 2020
The following ESMF example illustrates how to interpolate from a NARR grid
to a rectilinear grid:
*http://www.ncl.ucar.edu/Applications/ESMF.shtml*
<http://www.ncl.ucar.edu/Applications/ESMF.shtml>
ESMF_wgts_30.ncl
------------------------
The ESMF software does NOT work with cartesian [projection] coordinates ['
*x'* , '*y*'] which have units of meters.
; the following are not correct
lon2d = f1[:]->x
lat2d = f1[:]->y
The ESMF software works with latitudes and longitudes.
You should extract the latitudes and longitudes from the first file only:
lon2d = f1*[0]*->lon ; read NARR longitude from 1st file
lat2d = f1*[0]*->lat ; read NARR latitude
-----------------
See attached. It is a combination of your script and ESMF_wgts_30.ncl
On Sat, Feb 29, 2020 at 2:56 PM dale zuri via ncl-talk <ncl-talk at ucar.edu>
wrote:
> Hi NCL user,
> I have been trying to regrid NARR 0.3 resolution to 190x384 using the ESMF
> regrid function. The regrid was successful, however the output values seem
> unrealistic and not correct.
> I would appreciate any suggestion to fix the problem.
> Thanks
>
> Here the code:
> diri1 = "/NARR/daily/prate/"
>
> fill1 = systemfunc("for((i="+yrstrt+";i<="+yrend+";i+=1)); do ls "+ diri1
> +"*$i*; done")
>
> print(fill1)
>
> f1 = addfiles (fill1, "r") ; note the "s" of addfile
>
> ListSetType (f1, "cat")
>
> uT1 = f1[:]->prate ; read T from all files
>
> lon2d = f1[:]->x ; read T from all files
>
> lat2d = f1[:]->y ; read T from all files
>
> printVarSummary (uT1)
>
> uT1 at _FillValue = uT1 at missing_value ; fix missing value
>
> printMinMax(uT1,0)
>
> uT = short2flt( uT1 ) ; apply scale and offset attributes
>
> xMon = calculate_monthly_values (uT, "avg", 0,True)
>
> printVarSummary(xMon)
>
> printMinMax(xMon,0)
>
> T1 = month_to_season (xMon, "JJA")
>
> printVarSummary(T1)
>
> T1=T1*86400*92
>
> printMinMax(T1,0)
>
> ;-- define the T255 grid (lat x lon - 256x512)
>
> nlat = 190 ;-- number of latitudes
>
> nlon = 384 ;-- number of longitudes
>
> grint = 0.9375 ;-- grid spacing
>
> dst_lat = fspan((-90.0+grint),(90.-grint),nlat)*1d ;-- type double
>
> dst_lat!0 = "lat" ;-- dimension name
>
> dst_lat at units = "degrees_north" ;-- dimension units
>
> dst_lon = fspan(0.0,(360.-grint),nlon)*1d ;-- type double
>
> dst_lon!0 = "lon" ;-- dimension name
>
> dst_lon at units = "degrees_east" ;-- dimension units
>
> ;-- set ESMF resources
>
> Opt = True
>
> Opt at InterpMethod = "patch" ;-- interpolation method
>
> Opt at SrcFileName = "ECHAM5_SCRIP_bilinear.nc" ;-- new source file name
>
> Opt at WgtFileName = "ECHAM5toWorldCurvilinear_bilinear.nc";-- weights file
>
> Opt at ForceOverwrite = True ;-- force overwrite
>
> Opt at DstFileName = "WorldRectilinear_SCRIP_bilinear.nc";-- destination
> file
>
> Opt at DstGridType = "rectilinear" ;-- Destination grid
>
> Opt at DstGridLon = dst_lon
>
> Opt at DstGridLat = dst_lat
>
> newgrid = ESMF_regrid(T1,Opt)
>
> ;newgrid = f2fsh_Wrap(T1,(/190,384/))
>
> printVarSummary (newgrid)
>
> printMinMax(newgrid,0)
>
>
> _______________________________________________
> 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/20200301/94f02e86/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: NARR_JJA.png
Type: image/png
Size: 214686 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200301/94f02e86/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dale.ncl
Type: application/octet-stream
Size: 6421 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200301/94f02e86/attachment.obj>
More information about the ncl-talk
mailing list