[Thread Prev][Thread Next][Index]

Re: [ferret_users] plotting and interpolating data given on curvilinear grids



Hi Martin,
There is a newer interpolation method in the pipeline, but not yet available. The libcf library being developed by Unidata and a group of collaborators will give us faster tools for interpolating between grids.  We are paying close attention to this development and will implement it in Ferret as soon as it's ready. When there's a beta version of the interpolation code, and other capabilities available, we will add it as an option for people to experiment with. Here's the link to the information about libcf:
 http://www.unidata.ucar.edu/software/libcf/

With the existing tools in Ferret, if all your data has the same curvilienar grid and are interpolating to the same rectilinear grid, you can re-use the map function. This speeds up the entire process quite a lot, and it's the reason we have two functions; one to compute the map and the other to apply it.

The SHADE command only fills each grid box with the corresponding color. It's not doing any interpolation. The curvilinear version of the shade command can use curvlinear coordinate variables that define either the edges of the grid cells or their centers.  Here it looks like the grid defines the centers - else their size would be one larger than the grid size of the data fields. 

yes? use "ascat_20100111_005400_metopa_16755_eps_o_125_1018_ovw.l2.nc"
yes? sh dat
     currently SET data sets:
    1> ./ascat_20100111_005400_metopa_16755_eps_o_125_1018_ovw.l2.nc  (default)
 name     title                             I         J         K         L
 TIME     time                             1:82      1:3259    ...       ...
 LAT      latitude                         1:82      1:3259    ...       ...
 LON      longitude                        1:82      1:3259    ...       ...
 WVC_INDEX
          cross track wind vector cell nu  1:82      1:3259    ...       ...
 MODEL_SPEED
          model wind speed at 10 m         1:82      1:3259    ...       ...
 MODEL_DIR
          model wind direction at 10 m     1:82      1:3259    ...       ...
 ICE_PROB ice probability                  1:82      1:3259    ...       ...
 ICE_AGE  ice age (a-parameter)            1:82      1:3259    ...       ...
 WVC_QUALITY_FLAG
          wind vector cell quality         1:82      1:3259    ...       ...
 WIND_SPEED
          wind speed at 10 m               1:82      1:3259    ...       ...
 WIND_DIR wind direction at 10 m           1:82      1:3259    ...       ...
 BS_DISTANCE
          backscatter distance             1:82      1:3259    ...       ...

A nice way to visualize a grid is to define a "checkerboard" variable, which alternates 1 and zero over the grid, based on the variable we're looking at.

yes? let checkerboard = 0*wind_speed+mod(i+j,2)
yes? shade/hlim=50e:150e/vlim=-80:0/pal=greyscale/lev=(0,2,1) checkerboard, lon, lat



So I think what looks in your shade.gif image like data smeared across the middle of this swath is really just the way the shape of the cells changes. The question is why the regridded data has a gap in that area. There should be many points within the 1-degree radius that you've chosen, to use in the interpolation. I don't understand that, but will try to look into it.

Ansley


On 2/18/2011 8:42 AM, Martin Schmidt wrote:
Hi Ferreters,

I am trying to use ASCAT data downloaded from

ftp://podaac.jpl.nasa.gov/pub/ocean_wind/ascat/preview/L2/12km/

The files are netcdf files in curvilinear form, lat, lon and data are defined on a common abstract (x,y) grid.
It does not have a geophysical meaning.

Ferret should be able to deal with such data. Indeed

use ascat_20100111_005400_metopa_16755_eps_o_125_1018_ovw.l2.nc
shade/d=1 WIND_SPEED, lon,lat; frame /file=shade.gif

works and gives figure shade.gif.It does not look really bad.

Now I want to put the data on a regular grid in geographic coordinates. The GFDL routine curv_to_rect_map
should be fine.
yes? define axis/x=0:360:1/modulo/units=degrees xax
yes? def axis/y=-85:85:1/units=degrees yax
yes? let lonlatout = y[gy=yax] + x[gx=xax]
yes? let lonin = lon[d=1]
yes? let latin = lat[d=1]
yes? let map = curv_to_rect_map ( lonin,latin,lonlatout,1)
yes? save/clobber/file=curv_map.nc  map
(1 degree resolution)

After some coffee:

yes? cancel var/all
yes? use curv_map.nc
yes? let wo=curv_to_rect(wind_SPEED[d=1], map[d=2])
yes? shade wo; frame /file=curv_to_rect.gif

Both figures are in the attachment. The results have something to do with each other but they are also pretty different.

So my question:
I do not really believe in the figure shade.gif. The reason is, that I may plot (lon,lat) pairs into
the figure (plot/vs/ov lon,lat. In shade.gif there remain broad bands of coloured areas, in curv_to_rect.gif most data are covered by the symbols.
So I guess, that the shade command implies some inappropriate interpolation.
Does anyone have experience with plotting and processing such curviliear data?

It is great to have the interpolation tool curv_to_rect. But is there a chance to optimize the code
for a speed up of the curv_to_rect_map routine? I would like to process years of data on a finer grid and it is very slow with 1 degree resolution.
Unfortunately the weights are changing for every file.

Is there another and faster way to do this with ferret?

Greetings,
Martin Schmidt



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

Privacy Policy | Disclaimer | Accessibility Statement