Next: , Previous: NF90_DEF_VAR, Up: Variables



6.4 Define Chunking Parameters for a Variable: NF90_DEF_VAR_CHUNKING

The function NF90_DEF_VAR_CHUNKING sets the chunking parameters for a variable in a netCDF-4 file.

The total size the chunk must be less than 4 GiB. That is, the product of all chunksizes and the size of the data (or the size of nc_vlen_t for VLEN types) must be less than 4 GiB.

This function must be called after the variable is defined, but before nf_enddef is called.

Usage

       function nf90_def_var_chunking(ncid, varid, contiguous, chunksizes)
         integer, intent(in) :: ncid
         integer, intent(in) :: varid
         integer, intent(in) :: contiguous
         integer, dimension(:), intent(in) :: chunksizes
         integer :: nf90_def_var_chunking
ncid
NetCDF ID, from a previous call to NF90_OPEN or NF90_CREATE.
varid
Variable ID.
contiguous
If non-zero, then contiguous storage is used for this variable. Variables with one or more unlimited dimensions cannot use contiguous storage. If contiguous storage is turned on, the chunksizes parameter is ignored.
chunksizes
An array of chunk sizes. The array must have the one chunksize for each dimension in the variable. If the contiguous parameter is set, then the chunksizes parameter is ignored.

Errors

NF90_DEF_VAR_CHUNKING returns the value NF90_NOERR if no errors occurred. Otherwise, the returned status indicates an error.

Possible return codes include:

NF90_NOERR
No error.
NF90_BADID
Bad ncid.
NF90_ENOTNC4
Not a netCDF-4 file.
NF90_ENOTVAR
Can't find this variable.
NF90_ELATEDEF
This variable has already been the subject of a NC_ENDDEF call. In netCDF-4 files NC_ENDDEF will be called automatically for any data read or write. Once enddef has been called, it is impossible to set the chunking for a variable.
NF90_ENOTINDEFINE
Not in define mode. This is returned for netCDF classic or 64-bit offset files, or for netCDF-4 files, when they were been created with NF90_STRICT_NC3 flag. (see NF90_CREATE).
NF90_ESTRICTNC3
Trying to create a var some place other than the root group in a netCDF file with NF90_STRICT_NC3 turned on.

Example