[Thread Prev][Thread Next][Index]

[ferret_users] multiple slabs, definition of the one-point axis, and precision.



Dear Ferret users,

This is not a question. I thought it may be useful to somebody.

I needed to construct a 3D (xyz) netCDF data from a set of 2D "slabs" (xy), and found this entry

"Example 4‚ multiple slabs"
http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/converting-to-netcdf/SIMPLE-CONVERSIONS-USING-FERRET#_VPINDEXENTRY_1071

in the Ferret user's guide very useful.

There was one problem, though.  If I understand the problem correctly, the z position of the temporary grid has to be exactly the same as one of the points of the actual z grid in the example shown:

    DEF GRID/X=xaxis/Y=yaxis/Z=zaxis uv_grid
    DEF AXIS/Z=0:0:1 zaxis1  !### The z value must be exact ###
    DEF GRID/LIKE=uv_grid/Z=zaxis1 uv_grid1

     FILE/GRID=uv_grid1/BAD=-999/VAR="u,v" uv.data1
     LET/TITLE="My U data" u1 = u[G=uv_grid]

That is because the regridding operation "G=uv_grid" cannot interpolate vertically because the temporary axis "zaxis1" has only one point in the vertical.

This caused a problem to me because my original z axis is irregular and from data.  So, I do something like this in myscript:

    let zvals = z[gz=zaxis]
    define axis/z=`zvals[k=3],p=???`:`zvals[k=3],p=???`:1 uv_grid1

but I don't know a priori how many digits the _expression_ "zvals[k=3]" should yield so that the z value exactly matches k=3 of the original axis.  I tried "p=16" but didn't always get a match. The result is an undefined slab.  So, after going through all the slabs from k=1 to k=kmax, I got some slabs undefined.

A workaround I found was to use "g=uv_grid@NRST", which should work as long as you use sufficient or more than sufficient digits for the "AXIS/Z=" definition.

I suppose some discussion like this would be helpful in the user's guide.

For future, it would be nice if we were able to directly get the values of variables without going through their text representations using the backtick `_expression_`.

Best regards,
Ryo

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

Privacy Policy | Disclaimer | Accessibility Statement