Routines (alphabetical) > Routines: H > HDF-EOS Routines > EOS_SW_WRITEATTR

# EOS_SW_WRITEATTR

This function writes/updates attributes in a swath. If the attribute does not exist, it is created. If it does exist, then the value is updated.

## Examples

In this example, we write a single precision (32 bit) floating point number with the name “ScalarFloat” and the value 3.14:

f32 = 3.14

status = EOS_SW_WRITEATTR(swathid, "ScalarFloat", f32)

We can update this value by simply calling the function again with the new value:

f32 = 3.14159

status = EOS_SW_WRITEATTR(swathid, "ScalarFloat", f32)

## Syntax

Result = EOS_SW_WRITEATTR( swathID, attrname, datbuf [, COUNT=value] [, HDF_TYPE=value] )

## Return Value

Returns SUCCEED (0) if successful and FAIL (–1) otherwise.

## Arguments

### swathID

Swath id (long) returned by EOS_SW_CREATE or EOS_SW_ATTACH.

### attrname

Attribute name (string).

### datbuf

Attribute values (long). If HDF_TYPE is specified, the attribute values are first converted to the type specified by HDF_TYPE before being stored.

## Keywords

### COUNT

Number of values to store in attribute (long).

### HDF_TYPE

HDF data type of the attribute.

## Version History

5.2 | Introduced