table of contents
other versions
- jessie 4.4.2-1
- jessie-backports 4.6.3-1~bpo8+1
- stretch 4.6.3-1+b1
- testing 4.7.9-1
- stretch-backports 4.7.9-1~bpo9+1
- unstable 4.7.9-1
NCATTED(1) | General Commands Manual | NCATTED(1) |
NAME¶
ncatted - netCDF Attribute EditorSYNTAX¶
ncatted [-a att_dsc] [-a ...] [--bfr sz][-D dbg_lvl] [-h] [--hdr_pad sz] [-l path] [-O] [-p path] [-R] [-r] [--ram_all] input-file [ output-file]DESCRIPTION¶
ncatted edits attributes in a netCDF file. If you are editing attributes then you are spending too much time in the world of metadata, and ncatted was written to get you back out as quickly and painlessly as possible. ncatted can append, create, delete, modify, and overwrite attributes (all explained below). Furthermore, ncatted allows each editing operation to be applied to every variable in a file, thus saving you time when you want to change attribute conventions throughout a file. ncatted interprets character attributes as strings. Because repeated use of ncatted can considerably increase the size of the history global attribute, the -h switch is provided to override automatically appending the command to the history global attribute in the output-file. When ncatted is used to change the _FillValue attribute, it changes the associated missing data self-consistently. If the internal floating point representation of a missing value, e.g., 1.0e36, differs between two machines then netCDF files produced on those machines will have incompatible missing values. This allows ncatted to change the missing values in files from different machines to a single value so that the files may then be concatenated together, e.g., by ncrcat, without losing any information. The key to mastering ncatted is understanding the meaning of the structure describing the attribute modification, att_dsc. Each att_dsc contains five elements, which makes using ncatted somewhat complicated, but powerful. The att_dsc argument structure contains five arguments in the following order: att_dsc = att_nm, var_nm, mode, att_type, att_val- att_nm
- Attribute name. Example: units
- var_nm
- Variable name. Example: pressure
- mode
- Edit mode abbreviation. Example: a. See below for complete listing of valid values of mode.
- att_type
- Attribute type abbreviation. Example: c. See below for complete listing of valid values of att_type.
- att_val
- Attribute value. Example: pascal. There should be no empty space between these five consecutive arguments. The description of these arguments follows in their order of appearance.
- a
- Append. Append value att_val to current var_nm attribute att_nm value att_val, if any. If var_nm does not have an attribute att_nm, there is no effect.
- c
- Create. Create variable var_nm attribute att_nm with att_val if att_nm does not yet exist. If var_nm already has an attribute att_nm, there is no effect.
- d
- Delete. Delete current var_nm attribute att_nm. If var_nm does not have an attribute att_nm, there is no effect. When Delete mode is selected, the att_type and att_val arguments are superfluous and may be left blank.
- m
- Modify. Change value of current var_nm attribute att_nm to value att_val. If var_nm does not have an attribute att_nm, there is no effect.
- o
- Overwrite. Write attribute att_nm with value att_val to variable var_nm, overwriting existing attribute att_nm, if any. This is the default mode.
- f
- Float. Value(s) specified in att_val will be stored as netCDF intrinsic type NC_FLOAT.
- d
- Double. Value(s) specified in att_val will be stored as netCDF intrinsic type NC_DOUBLE.
- l
- Long. Value(s) specified in att_val will be stored as netCDF intrinsic type NC_LONG.
- s
- Short. Value(s) specified in att_val will be stored as netCDF intrinsic type NC_SHORT.
- c
- Char. Value(s) specified in att_val will be stored as netCDF intrinsic type NC_CHAR.
- b
- Byte. Value(s) specified in att_val will be stored as netCDF intrinsic type NC_BYTE. The specification of att_type is optional in Delete mode.
EXAMPLES¶
Append the string "Data version 2.0.\n" to the global attribute history:ncatted -O -a history,global,a,c,"Data version
2.0\n" in.nc
Note the use of embedded C language printf()-style escape sequences.
Change the value of the long_name attribute for variable T from
whatever it currently is to "temperature":
ncatted -O -a long_name,T,o,c,temperature in.nc
Delete all existing units attributes:
ncatted -O -a units,,d,, in.nc
The value of var_nm was left blank in order to select all variables in
the file. The values of att_type and att_val were left blank
because they are superfluous in Delete mode.
Modify all existing units attributes to "meter second-1"
ncatted -O -a units,,m,c,"meter second-1"
in.nc
Overwrite the quanta attribute of variable energy to an array of
four integers.
ncatted -O -a
quanta,energy,o,s,"010,101,111,121" in.nc
See the manual for more complex examples, including how to input C-language
escape sequences and other special characters like backslashes and question
marks.
AUTHOR¶
NCO manual pages written by Charlie Zender and originally formatted by Brian Mays.REPORTING BUGS¶
Report bugs to <http://sf.net/bugs/?group_id=3331>.COPYRIGHT¶
Copyright © 1995-2012 Charlie ZenderSEE ALSO¶
The full documentation for NCO is maintained as a Texinfo manual called the NCO User's Guide. Because NCO is mathematical in nature, the documentation includes TeX-intensive portions not viewable on character-based displays. Hence the only complete and authoritative versions of the NCO User's Guide are the PDF (recommended), DVI, and Postscript versions at <http://nco.sf.net/nco.pdf>, <http://nco.sf.net/nco.dvi>, and <http://nco.sf.net/nco.ps>, respectively. HTML and XML versions are available at <http://nco.sf.net/nco.html> and <http://nco.sf.net/nco.xml>, respectively. If the info and NCO programs are properly installed at your site, the command- info nco