Re: ESMF Regridding

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Feb 21 2013 - 08:34:40 MST

Hi Katie,

You have a few issues with the code.

First, there's an error with:

    Opt@DstLLCorner = (/round(minlat,0),round(minlat,0)/)

it should be:

   Opt@DstLLCorner = (/round(minlat,0),round(minlon,0)/)

The SrcGridCornerLat/DstGridCornerLat options are not being used correctly. You need to provide the corners of *each* lat/lon center point, and not just the corners of your domain. You don't appear to have an n x 4 array on your file that defines lat/lon grid corners, so comment those two lines and let ESMF_regrid try to guess at the corners.

Lastly, for ESMF_regrid to guess at the corners, it seems to prefer the longitudes to go from 0 to 360, so you need to do this:

   lon2d = where(lon2d.lt.0,lon2d+360,lon2d)
   datAir@lon2d=lon2d

See attached.

--Mary

On Feb 20, 2013, at 8:51 AM, Travis, Katherine wrote:

> Dennis,
> Thank you.
> The script is loaded: ESMF_regrid_15.ncl.
> For some reason air.2m.mon.mean.nc forced me to rename it to send, so it
> is called test.nc.
> Thanks
> Katie
>
> On 2/20/13 9:37 AM, "Dennis Shea" <shea@ucar.edu> wrote:
>
>> Hello
>>
>> offline here .......
>>
>> Can you please send your file and script to
>>
>> ftp ftp.cgd.ucar.edu
>> anonymous
>> <use your email address for the password>
>> cd incoming
>> put ...
>> put ...
>> quit
>>
>> Send email to me (shea@ucar.edu) and/or Mary (haley@ucar.edu)
>> after you have successfully completed the transfer.
>>
>> Note that for security reasons, you cannot list the contents of this
>> directory, and neither can we. We need to know the *exact* names of the
>> files in order to retrieve them.
>>
>> Thx
>> D
>>
>> On 2/20/13 7:16 AM, Travis, Katherine wrote:
>>> Dennis,
>>> Thanks. This variable was short, so I unpacked to float. However
>>> conserve regridding still crashes on the destination corners of the
>>> grid.
>>> You can see below I have the source corners, but not the destination.
>>> When
>>> I try to provide corners, the program gives me this:
>>>
>>> 20130220 091610.975 ERROR PET0 ESMF_Grid.F90:5238
>>> ESMF_GridCreateFrmScripDistGrd Wrong argument specified - - Bad corner
>>> array in SCRIP file
>>>
>>> netcdf air.2m.mon.mean {
>>> dimensions:
>>> time = UNLIMITED ; // (402 currently)
>>> y = 277 ;
>>> x = 349 ;
>>> nbnds = 2 ;
>>> variables:
>>> int Lambert_Conformal ;
>>> Lambert_Conformal:grid_mapping_name =
>>> "lambert_conformal_conic" ;
>>> Lambert_Conformal:standard_parallel = 50., 50. ;
>>> Lambert_Conformal:longitude_of_central_meridian =
>>> -107. ;
>>> Lambert_Conformal:latitude_of_projection_origin = 50. ;
>>> Lambert_Conformal:false_easting = 5632642.22547 ;
>>> Lambert_Conformal:false_northing = 4612545.65137 ;
>>> short air(time, y, x) ;
>>> air:units = "K" ;
>>> air:long_name = "Monthly Air Temperature at 2 m" ;
>>> air:scale_factor = 0.003799786f ;
>>> air:add_offset = 275.5f ;
>>> air:unpacked_valid_range = 151.f, 400.f ;
>>> air:precision = 0.003799786f ;
>>> air:actual_range = 229.7579f, 310.9593f ;
>>> Š
>>> // global attributes:
>>> :standardpar1 = 50. ;
>>> :standardpar2 = 50.000001 ;
>>> :centerlon = -107. ;
>>> :centerlat = 50. ;
>>> :latcorners = 1.000001f, 0.897945f, 46.3544f,
>>> 46.63433f ;
>>> :loncorners = -145.5f, -68.32005f, -2.569891f,
>>> 148.6418f ;
>>> :stream = "s1" ;
>>> :title = "Monthly NARR" ;
>>> :Conventions = "CF-1.0" ;
>>> :history = "created 2005 by Jeff Whitaker" ;
>>> :institution = "National Centers for Environmental
>>> Prediction" ;
>>> :platform = "Model" ;
>>> :references =
>>> "http://wwwt.emc.ncep.noaa.gov/mmb/rreanl/index.html\n",
>>>
>>> "http://www.esrl.noaa.gov/psd/data/gridded/data.narr.html" ;
>>> :NCO = "4.0.0" ;
>>>
>>>
>>>
>>>
>>>
>>>
>>> On 2/20/13 12:57 AM, "Dennis Shea" <shea@ucar.edu> wrote:
>>>
>>>> Before proceeding, could you please do a
>>>>
>>>> %> ncdump -h air.2m.mon.mean.nc | less
>>>>
>>>> What numeric type is the variable "air" ?
>>>>
>>>> If it is type 'short', then you *must* unpack prior to use.
>>>> Use 'short2flt' located in 'contributed.ncl'
>>>> http://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml
>>>>
>>>> datAir = short2flt( sfile->air )
>>>> printVarSummary(datAir)
>>>> print("datAir: min="+min(datAir)+" max="+max(datAir))
>>>>
>>>> Perhaps you were getting the "large errors" cuz you did not unpack.
>>>>
>>>>
>>>>
>>>> On 2/19/13 5:20 PM, Travis, Katherine wrote:
>>>>> Hi,
>>>>> Could anyone who uses the ESMF_regridding.ncl routine tell me how to
>>>>> properly set the following options?
>>>>> I am trying to regrid sparse emissions data on a regional (US) 12km by
>>>>> 12km curvilinear grid to a 1x1degree grid, and the bilinear and path
>>>>> methods give me large errors.
>>>>> I am trying to use the conserve method, but I get the error that my
>>>>> grid corners are bad. Here is how I am currently trying to set them
>>>>> up:
>>>>>
>>>>> srcFile = "air.2m.mon.mean.nc"
>>>>> sfile = addfile(srcFile,"r")
>>>>> datAir = sfile->air
>>>>> lat = sfile->lat
>>>>> lon = sfile->lon
>>>>>
>>>>> Opt@SrcGridCornerLat = (/min(lat(0,:)),min(lat(:,0)),
>>>>> max(lat(0,:)),max(lat(:,0))/)
>>>>> Opt@SrcGridCornerLon = (/min(lon(0,:)),min(lon(:,0)),
>>>>> max(lon(0,:)),max(lon(:,0))/)
>>>>> Opt@DstGridCornerLat = (/1,1,11,47/)
>>>>> Opt@DstGridCornerLon = (/-144,-179,-68, 179/)
>>>>>
>>>>> Thank you,
>>>>> --
>>>>> Katherine R. Travis
>>>>> PhD Student
>>>>> Harvard University
>>>>> SEAS
>>>>> ktravis@fas.harvard.edu
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> 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 Thu Feb 21 08:34:56 2013

This archive was generated by hypermail 2.1.8 : Thu Feb 21 2013 - 11:26:43 MST