[ncl-talk] sub: Regridding NARR data

Dennis Shea shea at ucar.edu
Tue Mar 3 09:28:06 MST 2020


There is no "gaussian" grid type.

Opt at DstGridType    = "gaussian"   ; <=== No


Since you are generating the destination lat and lon, you can use

Opt at DstGridType    = "rectilinear"


===





On Mon, Mar 2, 2020 at 10:20 PM dale zuri <dalezuri at gmail.com> wrote:

> Hi NCL user,
> I would like to regrid the curvilinear grid to lat/lon gaussion grid.  I
> would appreciate any help to fix this.
>
> Thanks
>
> My modifications in the above program to reflect that:
>  lat  = latGau(nlat, "lat", "latitude", "degrees_north")
>
> Opt at DstGridType    = "gaussian"
>
> Destination grid file information:
>
> wget
> ftp://nomads.ncdc.noaa.gov/modeldata/cfsv2_forecast_6-hourly_9mon_flxf/2012/201201/20120102/2012010200/flxf2012010206.01.2012010200.grb2
> Warning message:
>
> fatal:Variable (latlon_dims) is undefined
>
> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 3754 in
> file /Users/akila/ncl-6.6.2/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl
>
>
> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 3866 in
> file /Users/akila/ncl-6.6.2/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl
>
>
> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 4019 in
> file /Users/akila/ncl-6.6.2/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl
>
>
> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 132 in
> file dale_SourceRegrid.ncl
>
>
> fatal:Variable (prcJJA_regrid) is undefined
>
> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 133 in
> file dale_SourceRegrid.ncl
>
>
> fatal:Variable (prcJJA_regrid) is undefined
>
> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 134 in
> file dale_SourceRegrid.ncl
>
>
> (0) -------------------
>
> fatal:Undefined identifier: (prcJJA_regrid) is undefined, can't continue
>
> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 181 in
> file dale_SourceRegrid.ncl
>
> On Mon, Mar 2, 2020 at 6:47 AM Dennis Shea <shea at ucar.edu> wrote:
>
>> I did not look closely at what I had done. I made a graphical mistake.
>> The attached is correct.
>>
>> On Sun, Mar 1, 2020 at 8:25 PM Dennis Shea <shea at ucar.edu> wrote:
>>
>>> 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/20200303/19c7f28f/attachment.html>


More information about the ncl-talk mailing list