The NCDF_VARGET1 procedure retrieves one element from a netCDF variable. The netCDF file must be in data mode to use this procedure.
Suppose that the file
dave.nc
contains an image saved with the netCDF variable name "dave". The following commands extract the value of a single pixel from the image:
offset = [180,190] ; The location of the single element (pixel) whose value we will retrieve.
id = NCDF_OPEN('dave.nc') ; Open the netCDF file.
varid = NCDF_VARID(id, 'dave') ; Get the variable ID for variable "dave".
NCDF_VARGET1, id, varid, single_pixel, OFFSET=offset
;
Extract the element and return the value in the variable
single_pixel
;
.