Next: Programming:Introduction
Previous: nc2pnm
Index: Contents
ncattdef: Attribute changer for NetCDF files
Synopsis
ncattdef [-h] ncName [defName]
Parameters
Parameters in [ ] are optional.
- -h
- Prints help information and quits.
- ncName
- Name of the NetCDF file to process - must be the first parameter.
- defName
- Name of file containing attribute definitions in CDL syntax.
Discussion
The program ncattdef opens the existing NetCDF file named ncName.
It then parses the contents of defName or stdin, if defName
was omitted and adds global and variable attributes to ncName if
possible.
Only valid CDL attribute definitions are accepted. Syntax errors are
reported on stderr and parsing is continued.
- Note:
- Specifying an empty attribute value causes ncattdef to delete the
attribute if it exists. This feature is not specified in the CDL syntax
description.
Examples
- ncattdef rrr.nc definitions.txt
- Opens rrr.nc and changes its attributes according to the
CDL definitions in definitions.txt
- ncattdef rrr.nc definitions.txt >& /dev/null
- Same as before but doesn't print error messages.
- echo Blocks:identifier = "pgm raw" ; | ncattdef Blocks.nc
- Opens Blocks.nc and adds the attribute identifier with
the value "pgm raw" to the variable Blocks.
- ncdump ncName1 | grep variableName | ncattdef ncName2
- Copies all attributes of variableName from ncName1 to
ncName2, as far as possible.
Return Values
These values can be returned as exit status by ncattdef:
- PipsOk (0)
- Program terminated normally.
- PipsErrorFileRead (-1)
- The definitions file could not be opened.
- PipsErrorFileWrite (-2)
- The NetCDF file could not be written or closed.
- PipsNetcdfMissing (-4)
- There haven't been specified any command line parameters.
- PipsBadParameter (-5)
- An unknown command line option; filenames must not start with a hyphen.
Restrictions and known bugs
- Definitions of multidimensional attributes are ignored.
- The character '\' is - violating CDL syntax - not interpreted but passed
unchanged, so "\n" is the same as '\','n'.
Frank Heimes (Dr-Frank.Heimes@epost.de), 31 Jan 1995
Phone: +49 (721) 6091 - 424, FAX: +49 (721) 6091 - 233
http://members.tripod.de/DrFrankHeimes/pips/ncattdef.html