Project

General

Profile

cdo setgatt problem

Added by YUU YAN over 5 years ago

Hello everyone,

I am trying to add a line in global attributes. such as "ew = 0".

However, when I ran cdo setgatt,ew,0 old.nc new.nc, I got "ew = '0'". "0" is text rather than a parameter.

Can anybody tells me how to set?

Thank you!


Replies (1)

RE: cdo setgatt problem - Added by Ralf Mueller over 5 years ago

hi!

Please use the setattribute operator like

cdo settatribute,'ew=0' <ifile> <ofile>
for more please check the docu:
NAME
    setattribute - Set attributes

SYNOPSIS
    setattribute,attributes  infile outfile

DESCRIPTION
    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.

    A special meaning has the attribute name FILE. If this is the 1st attribute then all attributes
    are read from a file specified in the value of att_val.

PARAMETER
    attributes  STRING  Comma separated list of attributes. 

    (1-1/1)