2007 Unidata NetCDF Workshop for Developers and Data Providers > NetCDF Utilities
4.0 ncdump
The ncdump command-line utility converts netCDF
data to a human-readable text form.
The ncdump program is often the first command used to look at a
new netCDF dataset. Given a netCDF file, ncdump produces on standard
output a
text representation of specified information in the netCDF file, either CDL or
NcML.
- To look at just the "header" information (also known as the file
schema or metadata) of a netCDF file, use the "-h" option, for example:
ncdump -h co2.nc
More information is available by using the "-c" option,
which specifies all the header information plus values of the
coordinate variables.
ncdump -h co2.nc
To see the same information in NcML, a dialect of XML, use the "-x"
option:
ncdump -x -h co2.nc
To request values for only particular variables, use
the "-v variable-list" option.
To see brief or full annotation of indices of variable values
in C notation (0-based) or Fortran notation (1-based), use "-b C",
"-b F", "-f C"
or "-f F". For example, to get the 200th value of the co2
variable from co2.nc:
ncdump -v co2 -f F co2.nc | grep "co2(200)"
The Java netCDF package has another implementation of ncdump
that can also output CDL or NcML. For example, here's how you could
output NcML for co2.nc:
java -cp toolsUI.jar ucar.nc2.NCdump co2.nc -ncml
2007 Unidata NetCDF Workshop for Developers and Data Providers > NetCDF Utilities