[Next] [Previous] [Index]
Next: ncattdef Previous: pnm2nc Index: Contents

nc2pnm : Converter NetCDF to PNM


Synopsis

nc2pnm [-h] ncName [-v varName] [-i imgName] [-t imgType] [n]

Parameters

Parameters in [ ] are optional.
-h
Prints help information and quits.
ncName
Name of the NetCDF file to process - must be the first parameter.
varName
Name of the variable to extract.
imgName
Name of the imagefile(s) to create.
imgType
Image type to create. Possible values: pbmascii, pgmascii, ppmascii, pgmraw, ppmraw
n
Number of the image to extract from the variable.

Discussion

The program nc2pnm opens the existing NetCDF file named ncName. It then copies the specified images from the specified variable to one or more image files in the specified format in the current directory. If varName is omitted then all variables are extracted. If imgName is omitted then the variable name is used. Hence if no variable name is given but an image name then only the first variable will be extracted. In order to make the image filenames unique, a dot and the image number is appended to each filename; the lowest number is 0.

The type of image to create is derived from the following sources (precedence high to low):

  1. The -t imgType command line parameter.
  2. The value of the identifier attribute of that variable.
  3. The data type of the variable. Byte data is stored in PGMRAW images, long data is stored in PPMRAW images.

The program attempts to extract any variables whose data type length is the same as of byte or long. The variables may be of any dimensionality; up to the last three dimensions will always be used for extraction.

Examples

nc2pnm Blocks.nc
Opens Blocks.nc and stores all images of all variables in separate files with the variable names.
nc2pnm rrr.nc -v Chest2.pgm
Opens rrr.nc and stores the images of the variable Chest2.pgm in the files Chest2.pgm.0, Chest2.pgm.1, Chest2.pgm.2, ....
nc2pnm images.nc -v img 3
Opens images.nc and stores the 4th image of the variable img in the file img.3.

Return Values

These values can be returned as exit status by nc2pnm:
PipsOk (0)
Program terminated normally.
PipsErrorFileRead (-1)
The NetCDF file could not be opened.
PipsErrorFileWrite (-2)
The image 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.
PipsSinglePara (-6)
The -v, -i or -t option didn't have a name with it.
PipsInvalidVar (-10)
A non-existing variable name has been specified for extraction.
PipsDataIncompat (-11)
A variable was specified that can not be extracted.

Restrictions and known bugs


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/nc2pnm.html