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

# EOS_SW_DEFDATAFIELD

This function defines data fields to be stored in the swath. The dimensions are entered as a string consisting of data dimensions separated by commas. The API will attempt to merge into a single object those fields that share dimensions and in case of multidimensional fields, numbertype. If the merge keyword is not set, the API will not attempt to merge it with other fields. Because merging breaks the one-to-one correspondence between HDF-EOS fields and HDF SDS arrays, it should not be set if the user wishes to access the HDF-EOS field directly using HDF routines. To assure that the fields defined by EOS_SW_DEFDATAFIELD are properly established in the file, the swath should be detached (and then reattached) before writing to any fields.

Note: Array ordering of variables used or returned by this routine changed in IDL 5.5. Programs written for versions of this routine prior to IDL 5.5 may need to be modified to work correctly with the current version.

## Examples

In this example, we define a three dimensional data field named Spectra with dimensions Bands, DataTrack, and DataXtrack:

status = EOS_SW_DEFDATAFIELD(swathID, "Spectra", $

"Bands,DataTrack,DataXtrack", 5, /MERGE)

## Syntax

Result = EOS_SW_DEFDATAFIELD( swathID, fieldname, dimlist, numbertype [, /MERGE] )

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

### fieldname

Name of field (string) to be defined.

### dimlist

The list of data dimensions (string) defining the field.

### numbertype

The HDF data type (long) of the data stored in the field.

## Keywords

### MERGE

If set, automatic merging will occur. By default, fields are not merged.

## Version History

5.2 | Introduced