Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
3717c745
Commit
3717c745
authored
Feb 10, 2017
by
Uwe Schulzweida
Browse files
setattribute: added docu.
parent
fea69b5a
Changes
8
Hide whitespace changes
Inline
Side-by-side
NEWS
View file @
3717c745
...
...
@@ -10,6 +10,7 @@ Version 1.8.0 (26 October 2016):
* setpartabn: added support for user defined attributes
* Reverse: adjust date/time by -1 second (introduced in last revision)
New operators:
* setattribute: Set attributes
* cmorlite: Apply variable_entry of cmor tables
* timcumsum: Cumulative sum over time.
* shiftx/shifty: Shift fields on rectilinear/curvilinear grids in x/y direction
...
...
OPERATORS
View file @
3717c745
...
...
@@ -153,8 +153,7 @@ Operator catalog:
Setgrid setgridarea Set grid cell area
Setzaxis setzaxis Set z-axis
Setzaxis genlevelbounds Generate level bounds
Setgatt setgatt Set global attribute
Setgatt setgatts Set global attributes
Setattributes setattribute Set attributes
Invert invertlat Invert latitudes
Invertlev invertlev Invert levels
Shiftxy shiftx Shift x
...
...
doc/tex/Modules
View file @
3717c745
...
...
@@ -30,7 +30,7 @@ Settime Modification
Change Modification
Setgrid Modification
Setzaxis Modification
Set
g
att
Modification
Setatt
ributes
Modification
Invert Modification
Invertlev Modification
Shiftxy Modification
...
...
doc/tex/mod/Setattributes
0 → 100644
View file @
3717c745
@BeginModule
@NewPage
@Name = Setattribute
@Title = Set attributes
@Section = Modification
@Class = Modification
@Arguments = infile outfile
@Operators = setattribute
@BeginDescription
This operator sets attributes of a dataset. Each attribute has the following structure:
[@bold{var_nm}@]@bold{att_nm}=@bold{att_val}
@IfMan
var_nm Variable name (optional). Example: pressure
att_nm Attribute name. Example: units
att_val Comma separated list of attribute values. Example: pascal
@EndifMan
@IfDoc
\begin{defalist}{\textbf{var_nm}}
\item[\ \ \ \textbf{var_nm}\ \ \hfill] Variable name (optional). Example: pressure
\item[\ \ \ \textbf{att_nm}\ \ \hfill] Attribute name. Example: units
\item[\ \ \ \textbf{att_val}\ \ \hfill] Comma separated list of attribute values. Example: pascal
\end{defalist}
@EndifDoc
The value of @bold{var_nm} is the name of the variable containing the attribute (named @bold{att_nm}) that
you want to set. Use wildcards to set the attribute @bold{att_nm} to more than one variable.
A value of @bold{var_nm} of '@bold{*}' will set the attribute @bold{att_nm} to all data variables.
If @bold{var_nm} is missing then @bold{att_nm} refers to a global attribute.
The value of @bold{att_nm} is the name of the attribute you want to set.
The value of @bold{att_val} is the contents of the attribute @bold{att_nm}. @bold{att_val} may be a single value
or one-dimensional array of elements. The type of the attribute value will be detected
automaticly from the contents of the value.
@EndDescription
@EndModule
@BeginOperator_setattribute
@Title = Set attributes
@Parameter = attributes
@EndOperator
@BeginParameter
@Item = attributes
STRING Comma separated list of attributes.
@EndParameter
@BeginExample
To set the units of the variable pressure to pascal use:
@BeginVerbatim
cdo setattribute,pressure@units=pascal infile outfile
@EndVerbatim
To set the global text attribute "my_att" to "my contents", use:
@BeginVerbatim
cdo setattribute,my_att="my contents" infile outfile
@EndVerbatim
Result of '\texttt{ncdump -h outfile}':
@BeginListing
netcdf outfile {
dimensions: ...
variables: ...
// global attributes:
:my_att = "my contents" ;
}
@EndListing
@EndExample
libcdi
@
14440b7b
Subproject commit
d80fbb45efcae7f218eb8933d23f3a00ee5be517
Subproject commit
14440b7b3b844cc0d31141b6fcd9e74b3a64b9e6
src/Setattribute.c
View file @
3717c745
...
...
@@ -141,7 +141,7 @@ void set_attributes(list_t *kvlist, int vlistID)
for
(
int
idx
=
0
;
idx
<
nv
;
++
idx
)
{
int
varID
=
varIDs
[
idx
];
if
(
cdoVerbose
)
printf
(
"varID, cdiID, attname %d %d %s
\n
"
,
varID
,
cdiID
,
attname
);
if
(
cdoVerbose
)
printf
(
"varID, cdiID, attname %d %d %s
%d
\n
"
,
varID
,
cdiID
,
attname
,
(
int
)
strlen
(
attname
)
);
if
(
dtype
==
CDI_DATATYPE_INT8
||
dtype
==
CDI_DATATYPE_INT16
||
dtype
==
CDI_DATATYPE_INT32
)
{
int
*
ivals
=
(
int
*
)
Malloc
(
nvalues
*
sizeof
(
int
));
...
...
src/modules.c
View file @
3717c745
...
...
@@ -697,9 +697,9 @@ static modules_t Modules[] =
{
Seloperator
,
NULL
,
SeloperatorOperators
,
1
,
CDI_REAL
,
1
,
1
},
{
Seltime
,
SeltimeHelp
,
SeltimeOperators
,
1
,
CDI_BOTH
,
1
,
1
},
{
Set
,
SetHelp
,
SetOperators
,
1
,
CDI_BOTH
,
1
,
1
},
{
Setattribute
,
NULL
,
SetattributeOperators
,
1
,
CDI_BOTH
,
1
,
1
},
{
Setattribute
,
SetattributeHelp
,
SetattributeOperators
,
1
,
CDI_BOTH
,
1
,
1
},
{
Setbox
,
SetboxHelp
,
SetboxOperators
,
1
,
CDI_REAL
,
1
,
1
},
{
Setgatt
,
SetgattHelp
,
SetgattOperators
,
1
,
CDI_BOTH
,
1
,
1
},
{
Setgatt
,
NULL
,
SetgattOperators
,
1
,
CDI_BOTH
,
1
,
1
},
{
Setgrid
,
SetgridHelp
,
SetgridOperators
,
1
,
CDI_BOTH
,
1
,
1
},
{
Sethalo
,
SethaloHelp
,
SethaloOperators
,
1
,
CDI_REAL
,
1
,
1
},
{
Setmiss
,
SetmissHelp
,
SetmissOperators
,
1
,
CDI_REAL
,
1
,
1
},
...
...
src/operator_help.h
View file @
3717c745
...
...
@@ -1114,31 +1114,35 @@ static const char *SetzaxisHelp[] = {
NULL
};
static
const
char
*
Set
g
attHelp
[]
=
{
static
const
char
*
Setatt
ribute
Help
[]
=
{
"NAME"
,
" set
g
att
, setgatts - Set global
attribute"
,
" setatt
ribute - Set
attribute
s
"
,
""
,
"SYNOPSIS"
,
" setgatt,attname,attstring infile outfile"
,
" setgatts,attfile infile outfile"
,
" setattribute,attributes infile outfile"
,
""
,
"DESCRIPTION"
,
" This module sets global text attributes of a dataset. Depending on the chosen "
,
" operator the attributes are read from a file or can be specified by a parameter."
,
""
,
"OPERATORS"
,
" setgatt Set global attribute"
,
" Sets one user defined global text attribute."
,
" setgatts Set global attributes"
,
" Sets user defined global text attributes. The name and text"
,
" of the global attributes are read from a file."
,
" This operator sets attributes of a dataset. Each attribute has the following structure:"
,
" "
,
" [var_nm@]att_nm=att_val"
,
" "
,
" var_nm Variable name (optional). Example: pressure"
,
" att_nm Attribute name. Example: units"
,
" att_val Comma separated list of attribute values. Example: pascal"
,
" "
,
" The value of var_nm is the name of the variable containing the attribute (named att_nm) that"
,
" you want to set. Use wildcards to set the attribute att_nm to more than one variable."
,
" A value of var_nm of '*' will set the attribute att_nm to all data variables."
,
" If var_nm is missing then att_nm refers to a global attribute."
,
" "
,
" The value of att_nm is the name of the attribute you want to set."
,
" "
,
" The value of att_val is the contents of the attribute att_nm. att_val may be a single value"
,
" or one-dimensional array of elements. The type of the attribute value will be detected"
,
" automaticly from the contents of the value."
,
""
,
"PARAMETER"
,
" attname,attstring STRING Name and text of the global attribute (without spaces!)"
,
" attfile STRING File name which contains global text attributes"
,
""
,
"NOTE"
,
" Besides NetCDF none of the supported data formats supports global attributes."
,
" attributes STRING Comma separated list of attributes. "
,
NULL
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment