visad
Class CartesianProductCoordinateSystem

java.lang.Object
  extended by visad.CoordinateSystem
      extended by visad.CartesianProductCoordinateSystem
All Implemented Interfaces:
Serializable

public class CartesianProductCoordinateSystem
extends CoordinateSystem

A class for creating a new CoordinateSystem that is the product of two or more CoordinateSystems. This is useful for creating a new CoordinateSystem when combining values from different Data objects with different CoordinateSystems into a new Data object with a new CoordinateSystem that combines the CoordinateSystems from the original Data objects. An example would be where one CoordinateSystem transforms (row,col) -> (lat,lon) and another CoordinateSystem transforms (pressure) -> (altitude). The resulting CartesianProductCoordinateSystem would transform (row, col, pressure) -> (lat, lon, alt).

The resulting CartesianProductCoordinateSystem will have a dimension of the sum of the dimensions of the individual CoordinateSystems and a Reference RealTupleType that is the composite of the references of each CoordinateSystem. The CoordinateSystem Units are a composite of the Units of each of the CoordinateSystems as well.

See Also:
Serialized Form

Constructor Summary
CartesianProductCoordinateSystem(CoordinateSystem[] csArray)
          Construct a CartesianProductCoordinateSystem from an array of CoordinateSystems.
CartesianProductCoordinateSystem(CoordinateSystem a, CoordinateSystem b)
          Construct a CartesianProductCoordinateSystem from two other CoordinateSystems.
 
Method Summary
 boolean equals(Object o)
          Check to see if the object in question is equal to this CartesianProductCoordinateSystem.
 double[][] fromReference(double[][] refTuple)
          Convert array of reference valeus from Reference coordinates.
 float[][] fromReference(float[][] refTuple)
          Convert array of reference valeus from Reference coordinates.
 CoordinateSystem getCoordinateSystem(int index)
          Get a particular CoordinateSystem
 CoordinateSystem[] getCoordinateSystems()
          Get the arrays of CoordinateSystems being used in this product
 double[][] toReference(double[][] input)
          Convert input array to reference coordinates.
 float[][] toReference(float[][] input)
          Convert input array to reference coordinates.
 
Methods inherited from class visad.CoordinateSystem
canConvert, fromReference, fromReference, getCoordinateSystemUnits, getDimension, getReference, getReferenceUnits, toReference, toReference, transformCoordinates, transformCoordinates, transformCoordinates, transformCoordinates, transformCoordinatesFreeUnits, transformCoordinatesFreeUnits
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CartesianProductCoordinateSystem

public CartesianProductCoordinateSystem(CoordinateSystem a,
                                        CoordinateSystem b)
                                 throws VisADException
Construct a CartesianProductCoordinateSystem from two other CoordinateSystems.

Parameters:
a - first non-null CoordinateSystem
b - second non-null CoordinateSystem
Throws:
VisADException - a or b are null or VisAD object can't be created

CartesianProductCoordinateSystem

public CartesianProductCoordinateSystem(CoordinateSystem[] csArray)
                                 throws VisADException
Construct a CartesianProductCoordinateSystem from an array of CoordinateSystems.

Parameters:
csArray - non-null array of non-null CoordinateSystems
Throws:
VisADException - an element is null or VisAD object can't be created.
Method Detail

getCoordinateSystems

public CoordinateSystem[] getCoordinateSystems()
Get the arrays of CoordinateSystems being used in this product

Returns:
array of CoordinateSystems

getCoordinateSystem

public CoordinateSystem getCoordinateSystem(int index)
Get a particular CoordinateSystem

Parameters:
index - index into the array
Returns:
CoordinateSystem from array
Throws:
ArrayIndexOutOfBoundsException - (no need to declare) if index out of bounds

toReference

public double[][] toReference(double[][] input)
                       throws VisADException
Convert input array to reference coordinates.

Specified by:
toReference in class CoordinateSystem
Parameters:
input - input array
Returns:
array of values in reference space
Throws:
VisADException - input array has the wrong dimension or is null

fromReference

public double[][] fromReference(double[][] refTuple)
                         throws VisADException
Convert array of reference valeus from Reference coordinates. Input values are modified in this transaction.

Specified by:
fromReference in class CoordinateSystem
Parameters:
refTuple - reference tuple array
Returns:
array of values in non-reference space
Throws:
VisADException - input array has the wrong dimension or is null

toReference

public float[][] toReference(float[][] input)
                      throws VisADException
Convert input array to reference coordinates.

Overrides:
toReference in class CoordinateSystem
Parameters:
input - input array
Returns:
array of values in reference space
Throws:
VisADException - input array has the wrong dimension or is null

fromReference

public float[][] fromReference(float[][] refTuple)
                        throws VisADException
Convert array of reference valeus from Reference coordinates. Input values are modified in this transaction.

Overrides:
fromReference in class CoordinateSystem
Parameters:
refTuple - reference tuple array
Returns:
array of values in non-reference space
Throws:
VisADException - input array has the wrong dimension or is null

equals

public boolean equals(Object o)
Check to see if the object in question is equal to this CartesianProductCoordinateSystem.

Specified by:
equals in class CoordinateSystem
Parameters:
o - object in question
Returns:
true if the the object in question is composed of equal CoordinateSystems.