visad.data.gis
Class ArcAsciiGridAdapter

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

public class ArcAsciiGridAdapter
extends Object

AsciiArcGridAdapter converts an ASCII ArcGrid file into a VisAD Data object.

Author:
Don Murray

Field Summary
static RealType DEFAULT_DATA_TYPE
          Default data type
static RealTupleType DEFAULT_SPATIAL_TYPE
          Default spatial type
 
Constructor Summary
ArcAsciiGridAdapter(String filename)
          Create an ArcAsciiGridAdapter for the particular file.
ArcAsciiGridAdapter(String filename, RealTupleType spatialType)
          Create an ArcAsciiGridAdapter for the particular file and use the RealType specified for the data metadata.
ArcAsciiGridAdapter(String filename, RealTupleType spatialType, RealType dataType)
          Create an ArcAsciiGridAdapter for the particular file and use the RealType specified for the data metadata.
ArcAsciiGridAdapter(String filename, RealTupleType spatialType, RealType dataType, Unit dataUnit)
          Create an ArcAsciiGridAdapter for the particular file and use the supplied RealType for the data values, and units if different from default from RealType.
ArcAsciiGridAdapter(String filename, RealType dataType)
          Create an ArcAsciiGridAdapter for the particular file and use the RealType specified for the data metadata.
ArcAsciiGridAdapter(String filename, RealType dataType, Unit dataUnit)
          Create an ArcAsciiGridAdapter for the particular file and use the supplied RealType for the data values, and units if different from default from RealType.
ArcAsciiGridAdapter(String filename, String dataName)
          Create an ArcAsciiGridAdapter for the particular file and use the supplied RealType for the data values, and units if different from default from RealType.
ArcAsciiGridAdapter(String filename, String dataName, String unitSpec)
          Create an ArcAsciiGridAdapter for the particular file and use the supplied RealType for the data values, and units if different from default from RealType.
ArcAsciiGridAdapter(String filename, Unit dataUnit)
          Create an ArcAsciiGridAdapter for the particular file and use units specified for the data.
 
Method Summary
 Rectangle2D getBounds()
          Get the bounds of this grid
 float getCellSize()
          Deprecated. Use getCellSizeX and getCellSizeY
 float getCellSizeX()
          Get the cell size of this grid
 float getCellSizeY()
          Get the cell size of this grid
 int getColumns()
          Get the number of columns in this grid
 FieldImpl getData()
          Get the ASCIIGRID as a VisAD data object
 FieldImpl getData(MathType mathType)
          Get the ASCIIGRID as a VisAD data object with the specified domain and range.
 FieldImpl getData(RealTupleType spatialType, RealType dataType)
          Get the ASCIIGRID as a VisAD data object with the specified spatial domain and range.
 RealType getDataType()
          Get the type of the Data.
 Unit getDataUnit()
          Get the data units
 float getNoDataValue()
          Get the missing data value for this grid
 int getRows()
          Get the number of rows in this grid
 Gridded2DSet getSpatialSet()
          Get the domain set for this DEM as a Longitude, Latitude set
 Gridded2DSet getSpatialSet(RealTupleType spatialType)
          Get the spatial domain set for this ASCIIGRID with the specified type.
 RealTupleType getSpatialType()
          Get the spatial domain type.
 float getXLLCorner()
          Get the x value of the lower left corner of the grid.
 float getYLLCorner()
          Get the y value of the lower left corner of the grid.
static void main(String[] args)
          test this class "java visad.data.gis.ArcAsciiGridAdpater "
 void setDataType(RealType newType)
          Set the range type.
 void setDataUnit(Unit newUnit)
          Set the data units
 void setSpatialType(RealTupleType newSpatialType)
          Set the spatial domain type.
 String toString()
          Return a string representation of this grid as constructed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_SPATIAL_TYPE

public static final RealTupleType DEFAULT_SPATIAL_TYPE
Default spatial type


DEFAULT_DATA_TYPE

public static final RealType DEFAULT_DATA_TYPE
Default data type

Constructor Detail

ArcAsciiGridAdapter

public ArcAsciiGridAdapter(String filename)
                    throws VisADException
Create an ArcAsciiGridAdapter for the particular file. Data are assumed to be elevation values in meters

Parameters:
filename - name of file to read
Throws:
VisADException - couldn't create VisAD object

ArcAsciiGridAdapter

public ArcAsciiGridAdapter(String filename,
                           RealType dataType)
                    throws VisADException
Create an ArcAsciiGridAdapter for the particular file and use the RealType specified for the data metadata. Data are assumed to be in the default units of the RealType.

Parameters:
filename - name of file to read
dataType - RealType to use for range units
Throws:
VisADException - couldn't create VisAD object

ArcAsciiGridAdapter

public ArcAsciiGridAdapter(String filename,
                           RealTupleType spatialType)
                    throws VisADException
Create an ArcAsciiGridAdapter for the particular file and use the RealType specified for the data metadata. Data are assumed to be in the default units of the RealType.

Parameters:
filename - name of file to read
spatialType - RealTupleType to use for spatial domain
Throws:
VisADException - couldn't create VisAD object

ArcAsciiGridAdapter

public ArcAsciiGridAdapter(String filename,
                           RealTupleType spatialType,
                           RealType dataType)
                    throws VisADException
Create an ArcAsciiGridAdapter for the particular file and use the RealType specified for the data metadata. Data are assumed to be in the default units of the RealType.

Parameters:
filename - name of file to read
spatialType - RealTupleType to use for the spatial domain.
dataType - RealType to use for range units
Throws:
VisADException - couldn't create VisAD object

ArcAsciiGridAdapter

public ArcAsciiGridAdapter(String filename,
                           Unit dataUnit)
                    throws VisADException
Create an ArcAsciiGridAdapter for the particular file and use units specified for the data. Data are assumed to be altitudes.

Parameters:
filename - name of file to read
dataUnit - Unit of data
Throws:
VisADException - if unit is incompatible

ArcAsciiGridAdapter

public ArcAsciiGridAdapter(String filename,
                           String dataName)
                    throws VisADException
Create an ArcAsciiGridAdapter for the particular file and use the supplied RealType for the data values, and units if different from default from RealType.

Parameters:
filename - name of file to read
dataName - name to use for creating RealType
Throws:
VisADException - if unit is incompatible, or problem with file

ArcAsciiGridAdapter

public ArcAsciiGridAdapter(String filename,
                           String dataName,
                           String unitSpec)
                    throws VisADException
Create an ArcAsciiGridAdapter for the particular file and use the supplied RealType for the data values, and units if different from default from RealType.

Parameters:
filename - name of file to read
dataName - name for the data
unitSpec - valid Unit specification
Throws:
VisADException - if unit is incompatible, or problem with file

ArcAsciiGridAdapter

public ArcAsciiGridAdapter(String filename,
                           RealType dataType,
                           Unit dataUnit)
                    throws VisADException
Create an ArcAsciiGridAdapter for the particular file and use the supplied RealType for the data values, and units if different from default from RealType.

Parameters:
filename - name of file to read
dataType - RealType to use for range units
dataUnit - Unit of data if different from dataType default units.
Throws:
VisADException - if unit is incompatible, or problem with file

ArcAsciiGridAdapter

public ArcAsciiGridAdapter(String filename,
                           RealTupleType spatialType,
                           RealType dataType,
                           Unit dataUnit)
                    throws VisADException
Create an ArcAsciiGridAdapter for the particular file and use the supplied RealType for the data values, and units if different from default from RealType.

Parameters:
filename - name of file to read
spatialType - RealTupleType to use for the spatial domain.
dataType - RealType to use for range units
dataUnit - Unit of data if different from dataType default units.
Throws:
VisADException - if unit is incompatible, or problem with file
Method Detail

getData

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

Returns:
a FlatField of type ((getSpatialType()) -> getDataType())
Throws:
VisADException

getData

public FieldImpl getData(RealTupleType spatialType,
                         RealType dataType)
                  throws VisADException
Get the ASCIIGRID as a VisAD data object with the specified spatial domain and range.

Parameters:
spatialType - type for spatial domain
dataType - type for range
Returns:
a FlatField of type ((spatialType) -> dataType)
Throws:
VisADException

getData

public FieldImpl getData(MathType mathType)
                  throws VisADException
Get the ASCIIGRID as a VisAD data object with the specified domain and range.

Parameters:
mathType - type to use. If it's a FunctionType, it defines the return objects function type. If it's a RealTupleType, it defines the domain type, if it's a RealType, it defines the data type.
Returns:
a FlatField based on mathType
Throws:
VisADException

getSpatialSet

public Gridded2DSet getSpatialSet()
                           throws VisADException
Get the domain set for this DEM as a Longitude, Latitude set

Returns:
Gridded2DSet for domain
Throws:
VisADException

getSpatialSet

public Gridded2DSet getSpatialSet(RealTupleType spatialType)
                           throws VisADException
Get the spatial domain set for this ASCIIGRID with the specified type.

Parameters:
spatialType - RealTupleType (dimension 2) to use for this domain
Returns:
Gridded2DSet for spatial domain
Throws:
VisADException

getXLLCorner

public float getXLLCorner()
Get the x value of the lower left corner of the grid.

Returns:
x value of lower left corner.

getYLLCorner

public float getYLLCorner()
Get the y value of the lower left corner of the grid.

Returns:
y value of lower left corner.

getCellSize

public float getCellSize()
Deprecated. Use getCellSizeX and getCellSizeY

Get the cell size of this grid

Returns:
cell size

getCellSizeX

public float getCellSizeX()
Get the cell size of this grid

Returns:
cell size

getCellSizeY

public float getCellSizeY()
Get the cell size of this grid

Returns:
cell size

getNoDataValue

public float getNoDataValue()
Get the missing data value for this grid

Returns:
missing data value (or NaN if not specified)

getRows

public int getRows()
Get the number of rows in this grid

Returns:
number of rows

getColumns

public int getColumns()
Get the number of columns in this grid

Returns:
number of columns

getSpatialType

public RealTupleType getSpatialType()
Get the spatial domain type.

Returns:
type of the spatial set.

setSpatialType

public void setSpatialType(RealTupleType newSpatialType)
Set the spatial domain type.

Parameters:
newSpatialType - new type for

setDataType

public void setDataType(RealType newType)
Set the range type.

Parameters:
newType - new type for range

getDataType

public RealType getDataType()
Get the type of the Data.

Returns:
type of the data

setDataUnit

public void setDataUnit(Unit newUnit)
Set the data units

Parameters:
newUnit - new units for data

getDataUnit

public Unit getDataUnit()
Get the data units

Returns:
units of the data

getBounds

public Rectangle2D getBounds()
Get the bounds of this grid

Returns:
bounds as a rectangle.

toString

public String toString()
Return a string representation of this grid as constructed.

Overrides:
toString in class Object
Returns:
String representation:

main

public static void main(String[] args)
                 throws Exception
test this class "java visad.data.gis.ArcAsciiGridAdpater "

Throws:
Exception