NCDF_FILEINQ Name
NCDF_FILEINQ Purpose
Print a table of the contents of an ncdf file to the terminal
and/or save the structure of the file in a structure!
Category
Input/output
Calling Sequence
ncdf_fileinq, file, result Inputs
file: the name of the file to be examined.
result: a variable to take the structure containing the
result of the file inquiry. The form of the
structure is given below.
Keyword Parameters
QUIET: Setting this keyword prevents printing any information
from the file. Error messsages still appear on the terminal
MAXNDIMS: the maximum number of dimensions to expect
MAXNATTS: the maximum number of attributes to expect, either
global or for any one particular variable
TEE: The name of a file to wite information about the NCDF
file. If quiet is set then nothing will be written.
If no filename is given then "tee.txt" is used.
Outputs
Information about the netcdf file is printed on the terminal
depending upon the settings of the keyword arguments.
If the result argument is present a structure containing
information about the NCDF file is returned in that
argument. The previous contents of that argument, if any, are
lost. The structure is not the same for each file but it does
follow a strict format and is self documenting.
Restrictions
None are known. Example
Here is an example of output from reading a typical ncdf file.
IDL> help,r,/struct
** Structure <3004701c>, 6 tags, length=2124, refs=1:
NGATTS LONG 2
NDIMS LONG 7
NVARS LONG 35
GATTS STRUCT -> <Anonymous> Array[2]
DIMS STRUCT -> <Anonymous> Array[7]
VARS STRUCT -> <Anonymous> Array[35]
NGATTS, NDIMS, NVARS indicate how many of the corresponding
dtructures are present (nested) within the main structure.
The GATT struture array contains these tags, {NUMBER, NAME, VALUE}
and looks like:
IDL> help,r.gatts[0],/STRU
** Structure <3007864c>, 3 tags, length=20, refs=3:
NUMBER LONG 0
NAME STRING 'stamp'
VALUE STRING 'd/m/y=30/12/2850, h:m:s=18: 0: 0'
The DIMS structure contains tags {NUMBER,NAME,SIZE} and looks like:
IDL> help,r.dims,/struc
** Structure <30078b1c>, 3 tags, length=16, refs=3:
NUMBER LONG 0
NAME STRING 'jmt'
SIZE LONG 102
The VARS structure has {NDIMS,NATTS,NUMBER,NAME,ATTS,DIMS} and
looks like:
IDL> help,r.vars,/struc
** Structure <30078e1c>, 6 tags, length=56, refs=2:
NDIMS LONG 1
NATTS LONG 0
NUMBER LONG 0
NAME STRING 'yt'
ATTS STRUCT -> <Anonymous> Array[1]
DIMS STRUCT -> <Anonymous> Array[1]
Each var structure may contain ATTS and DIMS array as well. There
will be NDIMS and NATTS of these subelements.
REPURCUSSIONS
This routine is not using any special memory tricks such as
pointers to heap variables. As such it will waste memory,
especially if one variable has significantly more attributes
and/or dimensions than the others. Even so it won't waste
much.
Modification History
Written by: Edward C. Wiebe (ecwiebe@uvic.ca), 2000-05-10
(based on code by M Eby.)
Modified: ECW, 2000-08-01 (Added QUIET keyword)
Modified: ECW, 2000-08-02 (can now save results in an
optional result argument.)
Modified: ECW, 2000-08-02 (Added MAXNDIMS and MAXNATTS
keywords and error checking.)
Modified: ECW, 2001-04-11 (changed vartype to var_type)
Modified: ECW, 2002-05-17 (changed print commands to messages
made quiet totally quiet)
Modified: ECW, 2002-08-09 (added the recdim token to the result)