Hi Ryo, You're right. What perhaps is not clear in the Users Guide is
what's doing on under the hood. In writing netCDF files, the idea
is that you can write the file first with any values - generally
the _FillValue, (which is where the name "fill value" comes from,
though Ferret really just uses one missing-data flag) on the
entire grid that you want to use. This is what the
SAVE/KLIMITS=1:5 is doing. At the same time on that first write,
Ferret is writing the /K=1 data. Then any SAVE/APPEND of a subset
of the grid will overwrite the file with the data that you
specify. So, if you can define a grid with the axis you're going
to use, and write some dummy data to your file, then you're good
to go. Here's another take on that example 4. After the first write, do
a ncdump on the file to see what's in it. DEFINE AXIS/Z/UNITS=meters/DEPTH zaxis = {0,10,20,50,100} DEF GRID/Z=zaxis uv_grid let zz = z[gz=zaxis] let zval = zz[k=1] DEF AXIS/Z=`zval`:`zval`:1 zaxis1 DEF GRID/LIKE=uv_grid/Z=zaxis1 uv_grid1 FILE/GRID=uv_grid1/VAR="u,v" uv.data1 LET/TITLE="My U data" u1 = u[G=uv_grid] LET/TITLE="My V data" v1 = v[G=uv_grid] SAVE/FILE=uv1_5z.cdf/KLIMITS=1:5/K=1 u1, v1 CANCEL DATA uv.data1 let zval = zz[k=2] DEF AXIS/Z=`zval`:`zval`:1 zaxis1 FILE/GRID=uv_grid1/VAR="u,v" uv.data2 SAVE/FILE=uv1_5z.cdf/K=2/APPEND u1,v1 ...The other thing here is that the definitions of the 1-point Z axis in the examples use a nominal grid size of 1. If you did want to interpolate from the zaxis1 axis to the output zaxis, you should be able to do it by defining a bigger grid size, with the detla on /Z=lo:hi:delta: yes? define axis/z=0:0:1 zaxis1 yes? sh axis/z zaxis1 name axis # pts start end ZAXIS1 Z 1 r 0 0 Axis span (to cell edges) = 1 K Z ZBOX ZBOXLO 1> 0 1 -0.5 yes? define axis/z=0:0:50 zaxis1 Replacing definition of axis ZAXIS1 yes? sh axis/z zaxis1 name axis # pts start end ZAXIS1 Z 1 r 0 0 Axis span (to cell edges) = 50 K Z ZBOX ZBOXLO 1> 0 50 -25 On 11/21/2017 12:55 AM, Ryo Furue
wrote:
|