3
ncatted \- netCDF Attribute Editor
8
[-l path] [-O] [-p path] [-R] [-r]
15
edits attributes in a netCDF file.
16
If you are editing attributes then you are spending too much time in the
17
world of metadata, and
19
was written to get you back out as
20
quickly and painlessly as possible.
29
attributes (all explained below).
32
allows each editing operation to be applied
33
to every variable in a file, thus saving you time when you want to
34
change attribute conventions throughout a file.
36
interprets character attributes as strings.
38
Because repeated use of
40
can considerably increase the size
45
switch is provided to override automatically appending the
48
global attribute in the
56
it changes the associated missing data self-consistently.
57
If the internal floating point representation of a missing value,
58
e.g., 1.0e36, differs between two machines then netCDF files produced
59
on those machines will have incompatible missing values.
62
to change the missing values in files from
63
different machines to a single value so that the files may then be
64
concatenated together, e.g., by
71
is understanding the meaning of the
72
structure describing the attribute modification,
76
contains five elements, which makes using
78
somewhat complicated, but powerful.
81
argument structure contains five arguments in the
104
Edit mode abbreviation.
107
See below for complete listing of valid values of
111
Attribute type abbreviation. Example:
113
See below for complete listing of valid values of
117
Attribute value. Example:
119
There should be no empty space between these five consecutive
121
The description of these arguments follows in their order of
126
is the name of the attribute you want to edit.
127
This meaning of this should be clear to all users of the
133
is the name of the variable containing the
136
that you want to edit.
137
There are two very important and useful exceptions to this rule.
140
can also be used to direct
143
edit global attributes, or to repeat the editing operation for every
147
of global\(rq indicates that
150
to a global attribute, rather than a particular variable's attribute.
153
supports for editing global
157
is left blank, on the other hand, then
159
attempts to perform the editing operation on every variable in the file.
160
This option may be convenient to use if you decide to change the
161
conventions you use for describing the data.
165
is a single character abbreviation (
188
does not have an attribute
206
already has an attribute
219
does not have an attribute
225
mode is selected, the
229
arguments are superfluous and may be left blank.
233
Change value of current
241
does not have an attribute
254
overwriting existing attribute
257
This is the default mode.
261
is a single character abbreviation (
270
the six primitive netCDF data types:
274
Value(s) specified in
276
will be stored as netCDF intrinsic
281
Value(s) specified in
283
will be stored as netCDF intrinsic
288
Value(s) specified in
290
will be stored as netCDF intrinsic
295
Value(s) specified in
297
will be stored as netCDF intrinsic
302
Value(s) specified in
304
will be stored as netCDF intrinsic
309
Value(s) specified in
311
will be stored as netCDF intrinsic
321
is what you want to change attribute
329
Attribute values for all types besides NC_CHAR must have an attribute
330
length of at least one.
333
may be a single value or one-dimensional array of
338
is not set or is set to empty space,
342
.B "-a units,T,o,c,"""""
344
.BR "-a units,T,o,c," ,
345
then the corresponding attribute is set to
347
When specifying an array of values, it is safest to enclose
349
in double or single quotes, e.g.,
350
.B "-a levels,T,o,s,""1,2,3,4"""
352
.BR "-a levels,T,o,s,'1,2,3,4'" .
353
The quotes are strictly unnecessary around
358
contains characters which would confuse the calling
359
shell, such as spaces, commas, and wildcard characters.
361
NCO processing of NC_CHAR attributes is a bit like Perl in that
362
it attempts to do what you want by default (but this sometimes causes
363
unexpected results if you want unusual data storage).
366
is NC_CHAR then the argument is interpreted as a
367
string and it may contain C-language escape sequences,
368
which NCO will interpret before writing anything to disk.
369
NCO translates valid escape sequences and stores the
370
appropriate ASCII code instead.
371
Since two byte escape sequences
373
ASCII codes, e.g., ASCII 10 (decimal), the stored
374
string attribute is one byte shorter than the input string length for
375
each embedded escape sequence.
376
These sequences in particular allow convenient editing of formatted text
378
See ncks netCDF Kitchen Sink, for more examples of string formatting
382
option) with special characters.
386
other special characters are also allowed by
388
if they are "protected" by a backslash.
389
NCO simply strips away the leading backslash from these characters
390
before editing the attribute.
391
No other characters require protection by a backslash.
392
Backslashes which precede any other character
393
will not be filtered and will be included in the attribute.
395
Note that the NUL character
396
which terminates C language
397
strings is assumed and need not be explicitly specified.
400
is input, it will not be translated (because it would
401
terminate the string in an additional location).
402
Because of these context-sensitive rules, if wish to use an attribute of
403
type NC_CHAR to store data, rather than text strings, you should use
409
Append the string "Data version 2.0.\\n" to the global attribute
412
ncatted -O -a history,global,a,c,"Data version 2.0\\n" in.nc
414
Note the use of embedded C language
419
Change the value of the
421
attribute for variable
423
from whatever it currently is to "temperature":
425
ncatted -O -a long_name,T,o,c,temperature in.nc
432
ncatted -O -a units,,d,, in.nc
436
was left blank in order to select all
437
variables in the file.
442
were left blank because
443
they are superfluous in
449
attributes to "meter second-1"
451
ncatted -O -a units,,m,c,"meter second-1" in.nc
456
attribute of variable
458
to an array of four integers.
460
ncatted -O -a quanta,energy,o,s,"010,101,111,121" in.nc
463
Demonstrate input of C-language escape sequences
465
other special characters
467
ncatted -h -a special,global,o,c,
468
'\\nDouble quote: \\"\\nTwo consecutive double quotes: \\"\\"\\n
469
Single quote: Beyond my shell abilities!\\nBackslash: \\\\n
470
Two consecutive backslashes: \\\\\\nQuestion mark: \\?\\n' in.nc
472
Note that the entire attribute is protected from the shell by single
474
These outer single quotes are necessary for interactive use, but may be
475
omitted in batch scripts.