[Thread Prev][Thread Next][Index]

Re: [ferret_users] looking for an elegant way to regrid gridded netcdf with broken grid specs but with gridded lat/lon cell values



Hi Lev,

Have you looked at the Ferret functions "curv_to_rect_map" and "curv_to_rect"?  I don't know in what way your files have broken specifications, but see whether they have the information needed for these calls.

The map function creates a set of weights from a source curvilienar grid to a destination rectilinear grid that then can be saved and reused to map different data fields on the same source grid to the destination grid. The map function is slow to run, but then applying it is fast. 

For finding a subset of a curvilinear grid see the ideas in this FAQ: http://ferret.pmel.noaa.gov/Ferret/faq/plotting-subsets-of-data-on-a-curvilinear-grid

The "curv_to_rect_map" and "curv_to_rect" functions use a good conservative mapping method.  There are newer and faster methods, and we have one implemented in PyFerret which requires a Python regridding module.  Please see this page if you're interested: http://ferret.pmel.noaa.gov/Ferret/documentation/pyferret/ferret-functionality#PYFERRET_REGRID_FUNCTIONS

It is on our long list of future improvements to implement the ESMF regridding functionality as a faster method for regridding, and implementing it in the "auxiliary regridding" syntax already available for regridding along single 1-D axes, so that it would appear as a regular regridding operation within the core of Ferret and PyFerret instead of function calls.

Ansley


On 4/24/2018 9:33 AM, Lev Tarasov wrote:
This is unfortunately a too frequent problem at least for data sources I'm using. The source files tend to be on curvilinear grids (eg DEM, or obscure GCM/RCM grid or some other curvilinear projection) and the internal net-cdf grid specs are broken so that simple regridding doesn't work. However, the dat set includes grid-center lat and lon for
each grid cell (so on the same grid). Now I could do a bunch of repeat
loops, list to file in 1D format and then use scat2grid* and repeat for all the 20 fields * 12 months  I want to extract, but I'm hoping
there's a much more elegant way to work directly with the netcdf file
(if not in ferret, then some other tool? (cdo remapbil doesn't work).


Eg, my current case:

yes? show dat
     currently SET data sets:
    1> ./MARv3.5.2-10km-monthly-ERA-Interim.yMonMeanClim19C.nc  (default)
 LAT      Latitude                         1:301     1:561     ...       ...       ...       ...
 LON      Longitude                        1:301     1:561     ...       ...       ...       ...
 TT       3m-Temperature                   1:301     1:561     ...       1:12      ...       ...
and 20 other fields


yes? show grid tt
    GRID GQA1
 name       axis              # pts   start                end
 X         LONGITUDE          301 r   5E                   65E(1505)
 Y         LATITUDE           561 r   5N                   2805N
 normal    Z
 TIME      TIME                12 i   15-JAN-2000 00:08    14-DEC-2000 19:32

Even though this is actually a curvilinear projection (from readme)
grid_mapping_name,stereographic "Stereographic Oblique Projection"
standard_name,stereographic "Stereographic Oblique Projection"
long_name,stereographic "Stereographic Oblique Projection"
longitude_of_projection_origin 40°W
latitude_of_projection_origin 70.5°N
false_easting -775 km
false_northing -1200 km
resolution 25km

so standard regridding:
shade TT[g=GRf525, l=6]
gives a messed up plot


yes? show grid GRf525
    GRID GRF525
 name       axis              # pts   start                end
 XLONGRF5  LONGITUDE          155mr   80.75W               3.75W
 YLATGRF25 LATITUDE           105 r   58.875N              84.875N


Cheers,

Lev


Lev Tarasov -   Dept of Physics and Physical Oceanography,
        Memorial University of Newfoundland.
                email: lev@xxxxxx
                http://www.physics.mun.ca/~lev/
        Tel (709)-864-2675
        Fax (709)-864-8739


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement