The NCDF_VARGET procedure retrieves a hyperslab of values from a NetCDF variable. The NetCDF file must be in data mode to use this procedure.
Examples
Suppose that a 230 by 230 image is saved in the NetCDF file dave.nc. The following commands extract both the full image and a 70x70 sub-image starting at [80,20] sampling every other X pixel and every third Y pixel:
offset = [80, 20]
count = [70, 70]
stride = [2, 3]
id = NCDF_OPEN('dave.nc')
image = NCDF_VARID(id, 'image')
NCDF_VARGET, id, image, fullimage
NCDF_VARGET, id, image, subimage, $
COUNT=count, STRIDE=stride, OFFSET=offset
NCDF_CLOSE, id
Syntax
NCDF_VARGET, Cdfid, Varid, Value [, COUNT=vector] [, OFFSET=vector] [, STRIDE=vector]
Arguments
Cdfid
The NetCDF ID, returned from a previous call to NCDF_OPEN, NCDF_CREATE, or NCDF_GROUPDEF.
Varid
The NetCDF variable ID, returned from a previous call to NCDF_VARDEF or NCDF_VARID, or the name of the variable.
Value
A named variable in which the values are returned. NCDF_VARGET sets Value’s size and data type as appropriate.
Keywords
COUNT
An optional vector containing the counts to be used in reading Value. COUNT is a 1-based vector with an element for each dimension of the data to be read. The default matches the size of the variable so that all data is read.
OFFSET
An optional vector containing the starting position for the read. The default start position is [0, 0, ...].
STRIDE
An optional vector containing the strides, or sampling intervals, between accessed values of the NetCDF variable. The default stride vector is that for a contiguous read, [1, 1, ...].
Version History
See Also
NCDF_VARGET1, NCDF_VARID, NCDF_VARINQ, NCDF_VARPUT