Class OpendapReader

java.lang.Object
noaa.coastwatch.io.EarthDataReader
noaa.coastwatch.io.OpendapReader
Direct Known Subclasses:
CWOpendapReader

public abstract class OpendapReader extends EarthDataReader
The OpendapReader class is the base class for readers that use the OPeNDAP API to read data and metadata.
Since:
3.2.1
Author:
Peter Hollemans
  • Field Details

    • connect

      protected opendap.dap.DConnect2 connect
      The data connection.
    • das

      protected opendap.dap.DAS das
      The data attribute tables.
    • dds

      protected opendap.dap.DDS dds
      The data descriptor object.
  • Constructor Details

    • OpendapReader

      protected OpendapReader(String url) throws IOException
      Creates a new reader using the specified URL.
      Parameters:
      url - the network location.
      Throws:
      IOException - if the an error occurred accessing the dataset.
  • Method Details

    • getAttributeMap

      protected static Map getAttributeMap(opendap.dap.AttributeTable table, Map map) throws IOException
      Creates a map of attributes and values from an attribute table. This makes it easier to use the attributes as they are given appropriate Java datatype values rather than string values. Any numeric values are converted to primitive arrays.
      Parameters:
      table - the attribute table to read.
      map - the map to add attribute values to, or null to create a new map.
      Returns:
      the map of attribute names to values.
      Throws:
      IOException - if an error occurred converting an attribute value to a numeric type.
    • getPrimitiveClassType

      protected static Class getPrimitiveClassType(opendap.dap.BaseType base)
      Gets the primitive Java class type for the specified OPeNDAP base type.
      Parameters:
      base - the OPeNDAP base type.
      Returns:
      the Java primitive class or null if the base type cannot be represented with a Java primitive.
    • isUnsigned

      protected static boolean isUnsigned(opendap.dap.BaseType base)
      Returns true if the OPeNDAP primitive type is unsigned.
    • close

      public void close() throws IOException
      Closes the reader.
      Specified by:
      close in class EarthDataReader
      Throws:
      IOException - if the data source had I/O errors.
    • main

      public static void main(String[] argv) throws Exception
      Tests this class.
      Parameters:
      argv - the array of command line parameters.
      Throws:
      Exception