set chunksize Xsize Ysize <Zsize> <Tsize> <Esize>
XsizeSize of the chunk in the X dimension. Default value is the grid size in X.
YsizeSize of the chunk in the Y dimension. Default value is the grid size in Y.
ZsizeSize of the chunk in the Z dimension. Default value is 1.
TsizeSize of the chunk in the T dimension. Default value is 1.
EsizeSize of the chunk in the E dimension. Default value is 1.
It is not necessary to specify the chunk size for the Z, T, or E dimensions if you wish to use the default values.
Chunking refers to the partitioning of a dataset into fixed-size multi-dimensional chunks. Chunks are treated as atomic objects; disk I/O, cacheing, and compression are always done on a per-chunk basis. Chunking can significantly improve I/O performance, provided the chunk size is set appropriately for the data set in question.
A chunk has the same number of dimensions as the original data set. The size of a chunk in any dimension should be equal to or less than the size of the data set's grid dimensions. For data sets with more than 2 dimensions, DO NOT set the chunk sizes equal to the grid dimension sizes, in which case the entire data set would be one chunk, and DO NOT set all the chunk sizes equal to 1 (one), in which case a chunk would be a single value.
The default values in grads set the chunk size equal to the grid dimension in X and Y, and 1 (one) for the Z, T, and E dimensions -- a chunk is a single 2D lat/lon grid. However, if your data set is of sufficiently high resolution (e.g., if the grid size is less than 1.0 degree latitude/longitude), then you should set the chunk size smaller than the grid size in X and Y -- divide by 2, or 5, or 10 as necessary to keep the chunk in the ballpark of 512 kbytes. It is recommended that you keep the chunk size equal to 1 for the Z, T, and E dimensions.
Please see the documentation on compression for more details.
Suppose you have a high resolution data set (5120x2560) and you wish to save the variable as compressed netcdf.
set y 1 2560set z 1set t 1define var = varset sdfwrite -flt -nc4 -chunk -zip var.ncset chunksize 512 256sdfwrite var