[Thread Prev][Thread Next][Index]

Re: Appending Slabs to netCDF files



Hi Steve,
You don't say what commands you tried to use to create and append to the netcdf file, but I expect the trouble is that you are doing the @WEQ and @SUM on the existing Z axis, and you need to write the data on another Z axis. The @SUM creates a variable with no z variation, so you need to put the variable onto the output axis, z level. You also need to name the variable with the same name when writing to the file at each level. Try this example using the levitus_climatology dataset that's part of the Ferret distribution, and see if it gives yo the ideas you need. (I don't give any physical meaning to the calculations, they're just handy variables in the dataset.)

use levitus_climatology
! define a variable using @WEQ, list it at one location as a check
let w = temp[z=@weq:20]
list/x=180/y=0 w
! Define a variable and integrate in Z
let sw = salt*w
let swsum = sw[z=@sum]
shade sw[z=@sum] ! a var in x and y; look at it with SHADE command
! define an output axis; here we are using temperature at 20, 18, 16, ... so
! I use /DEPTH for the layer axis.
! Put the output variable onto that axis by adding 0*z[gz=zlayers]

def axis/z=1:5:1/depth zlayers
let sw_out = sw[z=0:5000@sum] + 0*z[gz=zlayers]
save/clobber/file=layers.nc/klimits=1:5/k=1 sw_out
! Append the variable for more layers (other values of the integrating kernal).
! Changing the definition of variable w changes the contents of sw_out
let w = temp[z=@weq:18]
save/append/file=layers.nc/k=2 sw_out
let w = temp[z=@weq:16]
save/append/file=layers.nc/k=3 sw_out
let w = temp[z=@weq:14]
save/append/file=layers.nc/k=4 sw_out
let w = temp[z=@weq:12]
save/append/file=layers.nc/k=5 sw_out
! check out the result.
can data/all
can var/all
use layers.nc
shade/y=0 sw_out
shade/x=180 sw_out
shade/l=3 sw_out

Steve Guimond wrote:

Hello Ferreters:
The section in the documentation for appending slabs to netCDF files is
a bit unclear to me. I have created a variable using the "let" command
at a certain level and want to save each new level that I calculate as the
appropriate level in a new netCDF file. The documentation says to define
two grids, one grid to read the data in one level at a time and the other
grid that will contain all levels in the new file. Since I am not reading
in data, I tried to regrid my new variable on the grid used to read data
in, but this did not work ( **ERROR: invalid command: attempt to regrid on
a compressed axis). My variable is created using the @weq transformation:

let pvwght320 = pv*theta[z=@weq:320]
let pv320 = pvwght320[z=@sum]

Can anyone clear up the documentation for me? As you can see I want to
save "pv320" as level 1, "pv325" as level 2, etc. where z axis
goes from 320:345:5.

Thanks.

Steve Guimond
Research Assistant
The Center for Ocean-Atmospheric Prediction Studies







[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement