ucar.unidata.data.grid
Class GridDataInstance

java.lang.Object
  extended by ucar.unidata.data.DataInstance
      extended by ucar.unidata.data.grid.GridDataInstance

public class GridDataInstance
extends DataInstance

A wrapper around grid data.

Version:
$Revision: 1.72 $ $Date: 2006/12/05 18:52:36 $
Author:
Jeff McWhirter

Field Summary
 
Fields inherited from class ucar.unidata.data.DataInstance
dataChoice, dataSelection, haveBeenInitialized, inError, myRequestProperties
 
Constructor Summary
GridDataInstance(DataChoice dataChoice, DataSelection dataSelection, Hashtable requestProperties)
          Create a GridDataInstance.
GridDataInstance(DataChoice dataChoice, DataSelection dataSelection, Hashtable requestProperties, Data theData)
          Create a GridDataInstance.
 
Method Summary
 float[][] getCoords3D()
          Get the array of 3D coordinate values from the spatial set, this returns the actual array, so don't change the values!
 DateTime[] getDateTimes()
          Get the array of times for this data
 Gridded3DSet getDomainSet3D()
          Get the 3D domain
 FieldImpl getFieldImpl()
          Deprecated. Use getGrid() instead
 FlatField getFlatField()
          Get a representative grid from one timestep.
 FieldImpl getGrid()
          Access to the FieldImpl made.
 FieldImpl getGrid(boolean copy)
          Access to the FieldImpl made.
 Real[] getLevels()
          Get the array of levels associated with this grid
 MapProjection getNavigation()
          Get the geolocation information for this grid
 int getNumRealTypes()
          Get the number of RealType (parameters) in this grid
 FieldImpl getOriginalGrid()
          Access to the original FieldImpl made.
 Range getRange(int idx)
          Return the idx'th range value
 Range[] getRanges()
          Get all the data ranges for this grid
 MathType getRangeType()
          The MathType of the parameter(s)
 Unit getRawUnit(int idx)
          Get the default unit for the parameter at idx
 RealType getRealType(int idx)
          The real type of the field
 String getRealTypeName(int idx)
          Get the name of the RealType of the parameter at idx
 ThreeDSize getSize()
          Get the sizes of the 3D domain
 int getSizeX()
          Get the number of X components in the domain
 int getSizeY()
          Get the number of Y components in the domain
 int getSizeZ()
          Get the number of Z components in the domain
 SampledSet getSpatialDomain()
          Get the spatial domain associated with this grid.
 CoordinateSystem getThreeDCoordTrans()
          Get the coordinate system for the 3D domain.
 RealType getZType()
          Get the RealType of the data's Z coordinate
 Unit getZUnit()
          Get the unit of the data's Z coordinate
static Unit getZUnit(FieldImpl field)
          Get the vertical unit for a given grid
 String getZUnitName()
          Get the name of the data's Z coordinate Unit
protected  void init()
          Initialize this object.
 boolean is3D()
          Check if this is a 3D grid or not
 boolean isTimeSequence()
          Get whether this is a time sequence or not
 void reInitialize()
          Reinitialize this GridDataInstance
 FieldImpl slice(SampledSet slice)
          Slice (resample) the grid along the slice Interface to GridUtil.slice().
 FieldImpl sliceAlongLatLonLine(LatLonPoint start, LatLonPoint end)
          Slice the grid at along a lat/lon line Interface to GridUtil.sliceAlongLatLonLine().
 FieldImpl sliceAlongLatLonLine(LatLonPoint start, LatLonPoint end, int samplingMode)
          Slice the grid at along a lat/lon line Interface to GridUtil.sliceAlongLatLonLine().
 FieldImpl sliceAtLevel(Real level)
          Slice the grid at a particular level.
 String toString()
          String representation of this GridDataInstance
 
Methods inherited from class ucar.unidata.data.DataInstance
checkInit, dataOk, getData, getData, getData, getDataChoice, getNextId, getParamName, needsInitialization, setDataSelection, setTheData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GridDataInstance

public GridDataInstance(DataChoice dataChoice,
                        DataSelection dataSelection,
                        Hashtable requestProperties)
                 throws VisADException,
                        RemoteException
Create a GridDataInstance.

Parameters:
dataChoice - choice describing the data
dataSelection - sub selection properties
requestProperties - special control request properties
Throws:
RemoteException - Java RMI error
VisADException - VisAD Error

GridDataInstance

public GridDataInstance(DataChoice dataChoice,
                        DataSelection dataSelection,
                        Hashtable requestProperties,
                        Data theData)
                 throws VisADException,
                        RemoteException
Create a GridDataInstance.

Parameters:
dataChoice - choice describing the data
dataSelection - sub selection properties
requestProperties - special control request properties
theData - Any initial data. Usually is null.
Throws:
RemoteException - Java RMI error
VisADException - VisAD Error
Method Detail

reInitialize

public void reInitialize()
                  throws VisADException,
                         RemoteException
Reinitialize this GridDataInstance

Overrides:
reInitialize in class DataInstance
Throws:
RemoteException - Java RMI error
VisADException - VisAD Error

init

protected void init()
             throws VisADException,
                    RemoteException
Initialize this object. Get the data and populate all the parameters

Overrides:
init in class DataInstance
Throws:
RemoteException - Java RMI error
VisADException - VisAD Error

getNavigation

public MapProjection getNavigation()
Get the geolocation information for this grid

Returns:
geolocation as a MapProjection.

isTimeSequence

public boolean isTimeSequence()
Get whether this is a time sequence or not

Returns:
true if a time sequence

is3D

public boolean is3D()
Check if this is a 3D grid or not

Returns:
true if a 3D grid

getSpatialDomain

public SampledSet getSpatialDomain()
Get the spatial domain associated with this grid. It is assumed that the spatial domain is the same for each timestep.

Returns:
spatial domain

getZUnit

public static Unit getZUnit(FieldImpl field)
                     throws VisADException,
                            RemoteException
Get the vertical unit for a given grid

Parameters:
field - 3D grid
Returns:
Unit of vertical coordinate
Throws:
RemoteException - Java RMI error
VisADException - VisAD Error

getRange

public Range getRange(int idx)
Return the idx'th range value

Parameters:
idx - range index
Returns:
the Range of values for that index

getRanges

public Range[] getRanges()
Get all the data ranges for this grid

Returns:
array of Ranges

getRealType

public RealType getRealType(int idx)
The real type of the field

Parameters:
idx - index of parameter
Returns:
RealType for parameter

getNumRealTypes

public int getNumRealTypes()
Get the number of RealType (parameters) in this grid

Returns:
number of parameters

getRangeType

public MathType getRangeType()
The MathType of the parameter(s)

Returns:
the Tuple of parameters

getRealTypeName

public String getRealTypeName(int idx)
Get the name of the RealType of the parameter at idx

Parameters:
idx - index of parameter
Returns:
name of the RealType.

getFieldImpl

public FieldImpl getFieldImpl()
Deprecated. Use getGrid() instead

Access to the FieldImpl made. Contains a sequence of times: (time -> (domain -> range)). Does not make a copy.

Returns:
the data in a FieldImpl

getGrid

public FieldImpl getGrid()
Access to the FieldImpl made. Contains a sequence of times: (time -> (domain -> range)). Does not copy data

Returns:
the data in a FieldImpl

getGrid

public FieldImpl getGrid(boolean copy)
Access to the FieldImpl made. Contains a sequence of times: (time -> (domain -> range))

Parameters:
copy - make a copy if true
Returns:
the data in a FieldImpl

getOriginalGrid

public FieldImpl getOriginalGrid()
Access to the original FieldImpl made. Contains a sequence of times: (time -> (domain -> range))

Returns:
the data in a FieldImpl

getRawUnit

public Unit getRawUnit(int idx)
Get the default unit for the parameter at idx

Parameters:
idx - index of parameter
Returns:
default unit

getDomainSet3D

public Gridded3DSet getDomainSet3D()
Get the 3D domain

Returns:
3D domain or null if not a 3D grid

getCoords3D

public float[][] getCoords3D()
Get the array of 3D coordinate values from the spatial set, this returns the actual array, so don't change the values!

Returns:
array of coordinates or null if not a 3D grid. This returns the actual array, so don't change the values!

getThreeDCoordTrans

public CoordinateSystem getThreeDCoordTrans()
Get the coordinate system for the 3D domain. The reference of the coordinate transform should be lat/lon/alt

Returns:
coordinate system with reference of lat/lon/alt or null if 2D data

getSize

public ThreeDSize getSize()
Get the sizes of the 3D domain

Returns:
the sizes

getSizeX

public int getSizeX()
Get the number of X components in the domain

Returns:
number of X components

getSizeY

public int getSizeY()
Get the number of Y components in the domain

Returns:
number of Y components

getSizeZ

public int getSizeZ()
Get the number of Z components in the domain

Returns:
number of Z components

getFlatField

public FlatField getFlatField()
Get a representative grid from one timestep. May be entire grid if not a sequence.

Returns:
one timestep grid (with no time dimension)

getZUnit

public Unit getZUnit()
Get the unit of the data's Z coordinate

Returns:
Unit zUnit the data's z coordinate unit.

getZType

public RealType getZType()
Get the RealType of the data's Z coordinate

Returns:
RealType the RealType of the Z (vertical) coordinate

getZUnitName

public String getZUnitName()
Get the name of the data's Z coordinate Unit

Returns:
String zUnit from z coordinate RealType unit.

toString

public String toString()
String representation of this GridDataInstance

Overrides:
toString in class Object
Returns:
output string

getLevels

public Real[] getLevels()
Get the array of levels associated with this grid

Returns:
array of levels

getDateTimes

public DateTime[] getDateTimes()
Get the array of times for this data

Returns:
array of times

sliceAtLevel

public FieldImpl sliceAtLevel(Real level)
                       throws VisADException
Slice the grid at a particular level. Interface to GridUtil.sliceAtLevel().

Parameters:
level - level to slice at
Returns:
2D grid of data at the level
Throws:
VisADException - problems doing slice
See Also:
GridUtil.sliceAtLevel(FieldImpl, Real)

sliceAlongLatLonLine

public FieldImpl sliceAlongLatLonLine(LatLonPoint start,
                                      LatLonPoint end)
                               throws VisADException
Slice the grid at along a lat/lon line Interface to GridUtil.sliceAlongLatLonLine().

Parameters:
start - starting position for line
end - ending position for line
Returns:
slice along the line
Throws:
VisADException - problem doing slice
See Also:
GridUtil.sliceAlongLatLonLine(FieldImpl, LatLonPoint, LatLonPoint)

sliceAlongLatLonLine

public FieldImpl sliceAlongLatLonLine(LatLonPoint start,
                                      LatLonPoint end,
                                      int samplingMode)
                               throws VisADException
Slice the grid at along a lat/lon line Interface to GridUtil.sliceAlongLatLonLine().

Parameters:
start - starting position for line
end - ending position for line
samplingMode - type of sampling
Returns:
slice along the line
Throws:
VisADException - problem doing slice
See Also:
GridUtil.sliceAlongLatLonLine(FieldImpl, LatLonPoint, LatLonPoint)

slice

public FieldImpl slice(SampledSet slice)
                throws VisADException
Slice (resample) the grid along the slice Interface to GridUtil.slice().

Parameters:
slice - resampling domain
Returns:
slice of data from grid along the domain
Throws:
VisADException - problem with slice