dods.dap
Class DAS

java.lang.Object
  extended bydods.dap.DAS
All Implemented Interfaces:
java.lang.Cloneable

public class DAS
extends java.lang.Object
implements java.lang.Cloneable

The Data Attribute Structure is a set of name-value pairs used to describe the data in a particular dataset. The name-value pairs are called the "attributes." The values may be of any of the DODS simple data types (DByte, DInt32, DUInt32, DFloat64, DString and DURL), and may be scalar or vector. (Note that all values are actually stored as string data.)

A value may also consist of a set of other name-value pairs. This makes it possible to nest collections of attributes, giving rise to a hierarchy of attributes. DODS uses this structure to provide information about variables in a dataset.

In the following example of a DAS, several of the attribute collections have names corresponding to the names of variables in a hypothetical dataset. The attributes in that collection are said to belong to that variable. For example, the lat variable has an attribute units of degrees_north.

  Attributes {
      GLOBAL {
          String title "Reynolds Optimum Interpolation (OI) SST";
      }
      lat {
          String units "degrees_north";
          String long_name "Latitude";
          Float64 actual_range 89.5, -89.5;
      }
      lon {
          String units "degrees_east";
          String long_name "Longitude";
          Float64 actual_range 0.5, 359.5;
      }
      time {
          String units "days since 1-1-1 00:00:00";
          String long_name "Time";
          Float64 actual_range 726468., 729289.;
          String delta_t "0000-00-07 00:00:00";
      }
      sst {
          String long_name "Weekly Means of Sea Surface Temperature";
          Float64 actual_range -1.8, 35.09;
          String units "degC";
          Float64 add_offset 0.;
          Float64 scale_factor 0.0099999998;
          Int32 missing_value 32767;
      }
  }
 
Attributes may have arbitrary names, although in most datasets it is important to choose these names so a reader will know what they describe. In the above example, the GLOBAL attribute provides information about the entire dataset.

Data attribute information is an important part of the the data provided to a DODS client by a server, and the DAS is how this data is packaged for sending (and how it is received).

Version:
$Revision: 1.2 $
Author:
jehamby
See Also:
DDS, AttributeTable, Attribute

Constructor Summary
DAS()
          Create a new empty DAS.
 
Method Summary
 void addAttributeTable(java.lang.String name, AttributeTable a)
          Adds an AttributeTable to the DAS.
 java.lang.Object clone()
          Returns a clone of this DAS.
 AttributeTable getAttributeTable(java.lang.String name)
          Returns the AttributeTable with the given name.
 java.util.Enumeration getNames()
          Returns an Enumeration of the attribute names in this DAS.
 void parse(java.io.InputStream is)
          Reads a DAS from the named InputStream.
 void print(java.io.OutputStream os)
          Print the DAS on the given OutputStream.
 void print(java.io.PrintWriter os)
          Print the DAS on the given PrintWriter.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DAS

public DAS()
Create a new empty DAS.

Method Detail

clone

public java.lang.Object clone()
Returns a clone of this DAS. A deep copy is performed on all AttributeTables inside the DAS.

Returns:
a clone of this DAS.

getNames

public final java.util.Enumeration getNames()
Returns an Enumeration of the attribute names in this DAS. Use the getAttributeTable method to get the AttributeTable for a given name.

Returns:
an Enumeration of String.
See Also:
getAttributeTable(String)

getAttributeTable

public final AttributeTable getAttributeTable(java.lang.String name)
Returns the AttributeTable with the given name.

Parameters:
name - the name of the AttributeTable to return.
Returns:
the AttributeTable with the specified name, or null if there is no matching AttributeTable.
See Also:
AttributeTable

addAttributeTable

public void addAttributeTable(java.lang.String name,
                              AttributeTable a)
Adds an AttributeTable to the DAS.

Parameters:
name - the name of the AttributeTable to add.
a - the AttributeTable to add.
See Also:
AttributeTable

parse

public void parse(java.io.InputStream is)
           throws ParseException,
                  DASException
Reads a DAS from the named InputStream. This method calls a generated parser to interpret an ASCII representation of a DAS, and regenerate that DAS in memory.

Parameters:
is - the InputStream containing the DAS to parse.
Throws:
ParseException - error in parser.
DASException - error in constructing DAS.
TokenMgrError - error in token manager (unterminated quote).
See Also:
DASParser

print

public void print(java.io.PrintWriter os)
Print the DAS on the given PrintWriter.

Parameters:
os - the PrintWriter to use for output.

print

public final void print(java.io.OutputStream os)
Print the DAS on the given OutputStream.

Parameters:
os - the OutputStream to use for output.
See Also:
print(PrintWriter)