setattr - Adds or changes an attribute in a dataset

SYNOPSIS

setattr  [ parameter=value ... ]  [ inputfile ... ]

Parameters are: name, var_name, units, datatype, length, value.

DESCRIPTION

The function setattr can either add a new attribute to a dataset or variable, or change the characteristics and value of an existing attribute.

Built-in variable attributes (units, bad_value, valid_min, valid_max, scale_factor, scale_offset) can be set using setattr. var_units is considered a synonym for the built-in variable attribute units. add_offset is considered a synonym for the built-in variable attribute scale_offset.

PARAMETERS

name

The name of the attribute to add or change. There is no default.

var_name

The name of the variable for which the attribute is intended. If no name is supplied, then the attribute is assumed to be a dataset attribute.

units

The units of the attribute. This is not required. The default is no units.

std_date, std_time, std_latitude and std_longitude should be used for date, time, latitude, longitude valued attributes, respectively.

datatype

The datatype of the attribute. Valid responses are [byte, short, long, real, double, and str##]. String length is encoded in its datatype. There is no default.

datatype is not required when any of the above standard units are used.

length

The array length of the attribute. This should be 1 for string-valued attributes and scalar numeric attributes. String length is encoded in its datatype.

Valid responses are any positive integer. The default is 1.

value

The value of the attribute. Valid responses depend on the datatype and array length. There is no default. See formats for date, time, latitude and longitude formats.

EXAMPLES

Set the timeadj and satellite attribute for the dataset unreg/avhrr.

[10] % setattr unreg.avhrr
name           : char( 31) ? timeadj
units          : char( 31) ? [] std_time
value          : char( 15) ? 00:00:00.7

[11] % setattr unreg.avhrr
name           : char( 31) ? satellite
units          : char( 31) ? []
datatype       : char( 15) ? str12
value          : char( 12) ? noaa-8

SEE ALSO

editvar, datasets, etx, formats

NOTES

Many attributes defining an earth transform are defined in radians, even though the contents functions reports them in degrees. One must be very careful when setting these attributes by hand. See etx for the true units for these attributes.


Last Update: $Date: 1999/02/04 16:44:13 $