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 or higher. The -4d and -5d options are available in GrADS v2.0.a5 or higher. The -flt, -dbl, -nc3,-nc4, -chunk, and -zip options are available in GrADS 2.0.a8 or higher.

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 -nc4 -chunk -zip var.nc
set chunksize 512 256
sdfwrite var