set sdfwrite

set sdfwrite <-4d or -5d> <-flt or -dbl> <-nc3 or -nc4> <-chunk> <-zip> fname

Sets the filename and other characteristics for self-describing data output. Arguments in < > are optional.

Usage Notes

This command is available in GrADS v2.0.a3+.

The -4d and -5d options were introduced in GrADS v2.0.a5+.

The -flt, -dbl, -nc3,-nc4, -chunk, and -zip options were introduced in GrADS 2.0.a8+.

If the -4d and -5d options are not used, the output will have the same number of dimensions as the defined variable being written out to file (GrADS 2.0.a9+). In earlier versions, the -4d and -5d options "stuck" until the reset, reinit, or clear sdfwrite commands were invoked.

The output data will be in NetCDF format. The file fname will be replaced if it exists. Use the sdfwrite command to create the output file. The query sdfwrite command returns the status of the sdfwrite options. The clear sdfwrite command resets the sdfwrite parameters back to their default values.

If you use the -zip option, then it is not necessary to also specify -nc4 or -chunk; GrADS will automatically set these options. A compressed file is always in netCDF-4 format and is always chunked. Use the set chunksize command to set the chunk size before writing out the file. Please see the documentation on compression for more details.

Examples

Suppose you have a high resolution data set (5120x2560) and you wish to save the variable as compressed netcdf with floating point precsion.

set x 1 5120
set y 1 2560
set z 1
set t 1
define var = var
set sdfwrite -flt -zip var.nc
set chunksize 512 256
sdfwrite var