grads requires a certain amount of metadata in order to understand how
to read a NetCDF/HDF-SDS data file, also called a self-describing file
sdfopen command assumes all the metadata is internal to the self-describing
file, whereas the
xdfopen command allows the user to supplement
or replace any internal metadata via a data descriptor file. In this
xdfopen provides access to some self-describing files
that do not comply with the COARDS conventions.
filename is the name of the data descriptor file that
contains the supplemental metadata. It has a syntax very similar to
the regular data descriptor files that are used with the
The few differences are noted below:
This is the only required entry.
SDF_filenamemay be either the name of a netCDF or HDF-SDS file or a substitution template for a collection of netCDF or HDF-SDS files.
DSET, the only other data descriptor file entries that are supported are
ENDVARS. Valid arguments for the
yrev, zrev, template,and
Each of these entries requires an additional argument,
SDF_dimension_name, which comes before all the other arguments. The
SDF_dimension_nameis used to achieve dimension order independence, so it must be a real dimension in the SDF. The
SDF_dimension_namestring may be mixed case and should appear exactly as it is listed in the output from ncdump.If the coordinate variables in the SDF file exist and have the required metadata, then
SDF_dimension_nameis the only argument needed for the corresonding axis definition entry (
XDEF, YDEF, ZDEF,
TDEF, and EDEF) in the data descriptor file. If you need to supplement or override the coordinate metadata in the SDF file, you can fill out the axis definition entries in the descriptor file with the remaining arguments describing the size, linearity, start, and increment. For EDEF, there is support for three variations on the compact syntax of the EDEF entry:edef <SDF_dimension_name>edef <SDF_dimension_name> <size>edef <SDF_dimension_name> <size> names <list of names>
The first argument ("
varname") of the variable definition lines that appear between
ENDVARShas the following syntax:SDF_varname=>grads_varname
SDF_varnameis the name of the variable as it appears in the output from the NetCDF utility ncdump. It may be of mixed case. If it includes blanks, substitute "~" for the blanks. If everything up to and including the
"=>"is omitted, then
grads_varnamemust be identical to
SDF_varname. This syntax (when "
SDF_varname=>" is omitted) will only work properly in grads if
SDF_varnameis less than 15 characters and does not contain any upper case letters. As it was with the coordinate variables, if the data variables in the SDF file have the required metadata, then
SDF_varname=>grads_varnameis the only argument needed for the corresonding variable definition entry in the data descriptor file.
- The order of the variable definition lines between VARS and ENDVARS is not important.
filenamecontains only the DSET entry, then
xdfopendevolves into working just like
filenamedoes not need to be a full data descriptor file, it only needs to contain whatever metadata the SDF file lacks. Anything not specified in
filenamewill be looked for in the file's internal metadata.
SDF_dimension_nameparameter in the XDEF, YDEF, ZDEF, TDEF, and EDEF entries and the first parameter of the VARIABLE definition lines are the only parts of the data descriptor file that aren't converted to lower case before they are interpreted.
- For further information on the COARDS conventions, check out Conventions for the standardization of NetCDF files.
- (GrADS version 2.0.a7.1+) The CHSUB entry will work with xdfopen.
This example shows the data descriptor file that would be required in order to open a self-describing file that is missing much of the required metadata. Below is the sample data descriptor file for the NetCDF file moisture.nc. Follow this link to see output from ncdump for this file.
DSET ^moisture.ncTITLE This is a sampleUNDEF 99999.0XDEF dimension1 144 LINEAR 0.0 2.5YDEF dimension2 73 LINEAR 0.0 2.5VARS 1TDEF dimension3 365 LINEAR 0Z01JAN1979 1DYMoisture=>moisture 1 99 MoistureENDVARS
This second example comes from a real-world HDF-SDS file from the Data
Assimilation Office at NASA Goddard Space Flight Center. The data
descriptor file is shown below, and this
link shows the output from running the HDF version of ncdump on
DAOE054A.hdf. (Note that the output has been annotated with
explanatory comments -- they are preceded with "//")
DSET ^DAOE054A.hdfTITLE This is only a testOPTIONS YREVUNDEF 1.0E15XDEF XDim:DAOgrid 144 LINEAR -180.0 2.5YDEF YDim:DAOgrid 91 LINEAR -90.0 2.0ZDEF HGHT18DIMS:DAOgrid 18 LEVELS 1000 850 700 500 400 300 250 200 150 100 70 50 30 10 5 2 1 0.4TDEF TIME4DIMS:DAOgrid 4 LINEAR 0Z31JUL1993 6HRVARS 3GEOPOTENTIAL_HEIGHT=>hgt 18 99 geopotential heightENDVARSSPECIFICHUMIDITY=>shum 18 99 specific humidityTEMPERATURE=>temp 18 99 temperature