The NCDF_GET routine retrieves variables and attributes from a NetCDF file.

This routine is written in the IDL language. Its source code can be found in the file NCDF_GET.pro in the lib subdirectory of the IDL distribution.

Examples


In this example, we retrieve the variables and attributes within a NetCDF file:

file = FILEPATH('sample.nc', $
   SUBDIRECTORY=['examples','data'])
NCDF_GET, file, 'image', result
HELP, result
PRINT, result['image']
PRINT, result['image', 'attributes']

IDL prints:

Reading image: BYTE(768,512) . . .
RESULT          HASH  <ID=86901  NELEMENTS=2>
dim_names: y ...
value:  135 135 132 145 165 170 140 122 130 132 132...
dim_sizes:          768         512
attributes: HASH  <ID=86872  NELEMENTS=2>
TITLE: New York City
var_name: image

Syntax


NCDF_GET, filename, variables, output, ERROR=variable, FOUND=variable, GATT=variable, MISSING=variable, /QUIET, /STRUCT

Arguments


FILENAME

An input string giving the name of the NetCDF file.

VARIABLES

An input string array of variable names. A particular variable name may contain a regular expression.

A variable name may also contain aliases for the variable, where the different names are separated by spaces. The first name in the string will be the output name. For example, if the array contains a string 'U_10m UGRD_10maboveground U_GRD_3_MWSL_10', then the file will be searched for variables with the name 'U_10m', 'UGRD_10maboveground', or 'U_GRD_3_MWSL_10', with the variable being returned in the output as 'U_10m'.

OUTPUT

An output variable consisting of an IDL hash containing the requested items.

Keywords


ERROR

Set this keyword to a named variable in which the NetCDF error code will be returned if an error occurs. ERROR=0 indicates no errors.

FOUND

Set this keyword to a named variable in which to return a string array of found variables.

GATT

Set this keyword to a named variable in which to return the global attributes as a hash. If there are no global attributes then !NULL is returned.

MISSING

Set this keyword to a named variable in which to return a string array of missing variables (variables that were requested but not found).

QUIET

Set this keyword to suppress informational and error messages.

STRUCT

Set this keyword to return the output as a structure instead of a hash.

Version History


8.4.1

Introduced

See Also


NCDF_LIST, NCDF_PUT