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.
An optional vector containing the counts to be used in reading Value . The default count vector is that for a single read, [1, 1, ...], as in NCDF_VARGET1.
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] ; A variable that contains the offset for the sub-image.
count = [70, 70] ; The dimensions of the sub-image.
stride = [2, 3] ; Create a variable to be used as a value for the STRIDE keyword. Every other X element and every third Y element will be sampled.
id = NCDF_OPEN('dave.nc') ; Open the NetCDF file.
image = NCDF_VARID(id, 'image') ; Get the variable ID for the image.
NCDF_VARGET, id, image, fullimage G; et the full image.
NCDF_VARGET, id, image, subimage, $
COUNT=count, STRIDE=stride, OFFSET=offset
;
Extract the sub-sampled image.