NCDF_VARGET1
Syntax | Arguments | Keywords | Examples | Version History | See Also
The NCDF_VARGET1 procedure retrieves one element from a netCDF variable. The netCDF file must be in data mode to use this procedure.
Syntax
NCDF_VARGET1, Cdfid, Varid, Value [, OFFSET=vector]
Arguments
Cdfid
The netCDF ID, returned from a previous call to NCDF_OPEN or NCDF_CREATE.
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 value of the variable is returned. NCDF_VARGET1 sets Value's size and data type as appropriate.
Keywords
OFFSET
A vector containing the starting position of the read. The default starting position is [0, 0, ...].
Examples
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:
; The location of the single element (pixel) whose value we will ; retrieve: offset = [180,190] ; Open the netCDF file: id = NCDF_OPEN('dave.nc') ; Get the variable ID for variable "dave": varid = NCDF_VARID(id, 'dave') ; Extract the element and return the value in the variable ; single_pixel: NCDF_VARGET1, id, varid, single_pixel, OFFSET=offset ; Close the netCDF file: NCDF_CLOSE, id
Version History
See Also
NCDF_VARGET, NCDF_VARID, NCDF_VARINQ, NCDF_VARPUT