Attributes are referred to by var_nm@att_nm
All the following are valid statements:
global@text="Test Attributes"; /* Assign a global variable attribute */
a1[$time]=time*20;
a1@long_name="Kelvin";
a1@min=a1.min();
a1@max=a1.max();
a1@min++;
--a1@max; q
a1(0)=a1@min;
a1($time.size-1)=a1@max;
A value list can be used on the RHS of an assign...
a1@trip1={1,2,3} ;
a1@triplet={a1@min,(a1@min+a1@max)/2,a1@max};
The netCDF specification allows all attribute types to have a size
greater than one.
The maximum is defined by NC_MAX_ATTRS.
The following is an ncdump of the metadata for variable a1
double a1(time) ;
a1:long_name = "Kelvin" ;
a1:max = 199. ;
a1:min = 21. ;
a1:trip1 = 1, 2, 3 ;
a1:triplet = 21., 110., 199. ;
The size() method can be used with attributes.
For example, to save an attribute text string in a variable,
defdim("sng_len", a1@long_name.size());
sng_arr[$sng_len]=a1@long_name; // sng_arr now contains "Kelvin"
Attributes defined in a script are stored in memory and are written to Output after script completion. To stop the attribute being written use the ram_delete() method or use a bogus variable name.
Attribute Propagation & Inheritance
prs_mdp[time,lat,lon,lev]=P0*hyam+hybm*PS; // prs_mdp gets attributes from PO
th_min=1.0 + 2*three_dmn_var_dbl.min($time); // th_min gets attributes from three_dmn_var_dbl
If the attribute name contains non-regular characters use ID quoting. See see ID Quoting
'b..m1@c--lost'=23;