visad.data.gis
Class UsgsDemAdapter

java.lang.Object
  extended by visad.data.gis.UsgsDemAdapter

public class UsgsDemAdapter
extends Object

UsgsDemAdapter converts the data in a USGS DEM file to a VisAD object. The specification for * the format can be found at http://rockyweb.cr.usgs.gov/nmpstds/acrodocs/dem/2DEM0198.PDF. Refer to this document for further explanation of the data elements of a DEM.

To simplify things, class UsgsDem changes the format of a USGS 7.5 minute DEM to a simpler "row by column" raster form rather than the "row by column by subcolumn" format in the specification.

Version:
$Revision: 1.10 $ $Date: 2009-03-02 23:35:48 $
Author:
Don Murray, Jeffrey Albert Bergamini (http://srproj.lib.calpoly.edu/projects/csc/jbergam/reports/final.html)

Constructor Summary
UsgsDemAdapter()
          Default constructor, everything remains null.
UsgsDemAdapter(String filename)
          Constructs a new UsgsDemAdapter object with data read from the given (native format, non-SDTS) USGS DEM file
 
Method Summary
 FieldImpl getData()
          Get the DEM as a VisAD data object
 Gridded2DSet getDomain()
          Get the domain set for this DEM
 void load(String filename)
          Reinitializes this UsgsDemAdapter object with data read from the given (non-SDTS) USGS DEM file.
static void main(String[] args)
           
static String padRight(Object obj, int i)
          This method takes any Object and using its String representation provided by its toString() method, pads it with blank characters on the right, to a specified length.
 String toString()
          Multi-line string representation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UsgsDemAdapter

public UsgsDemAdapter()
Default constructor, everything remains null. Call load() to load a file.


UsgsDemAdapter

public UsgsDemAdapter(String filename)
               throws IOException,
                      VisADException
Constructs a new UsgsDemAdapter object with data read from the given (native format, non-SDTS) USGS DEM file

Parameters:
filename - the name of the DEM file
Throws:
IOException
VisADException
Method Detail

load

public void load(String filename)
          throws IOException,
                 VisADException
Reinitializes this UsgsDemAdapter object with data read from the given (non-SDTS) USGS DEM file.

Parameters:
filename - the name of the DEM file
Throws:
IOException - - If an I/O error occurs (invalid file)
VisADException

toString

public String toString()
Multi-line string representation

Overrides:
toString in class Object
Returns:
An info string suitable for printing to the console.

padRight

public static String padRight(Object obj,
                              int i)
This method takes any Object and using its String representation provided by its toString() method, pads it with blank characters on the right, to a specified length.

Parameters:
obj - Object to be padded
i - padding length

getData

public FieldImpl getData()
                  throws VisADException
Get the DEM as a VisAD data object

Returns:
a FlatField of type ((x,y) -> altitude) where x,y is either (Longitude, Latitude) or (EASTING, NORTHING)
Throws:
VisADException

getDomain

public Gridded2DSet getDomain()
                       throws VisADException
Get the domain set for this DEM

Returns:
Gridded2DSet for domain
Throws:
VisADException

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception