visad
Class CoordinateSystem

java.lang.Object
  extended by visad.CoordinateSystem
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CachingCoordinateSystem, CartesianProductCoordinateSystem, CMYCoordinateSystem, CylindricalCoordinateSystem, EmpiricalCoordinateSystem, FlowSphericalCoordinateSystem, GridCoordinateSystem, HSVCoordinateSystem, IdentityCoordinateSystem, InverseCoordinateSystem, LambertAzimuthalEqualArea, LambertConformalConic, LogCoordinateSystem, NavigatedCoordinateSystem, PolarCoordinateSystem, PolarStereographic, SphericalCoordinateSystem, Vis5DVerticalSystem.Vis5DVerticalCoordinateSystem, WindPolarCoordinateSystem

public abstract class CoordinateSystem
extends java.lang.Object
implements java.io.Serializable

CoordinateSystem is the VisAD abstract superclass for coordinate systems for vectors in R^n for n>0. Specific coordinate systems are defined by extending this class and providing coordinate transformation logic in the toReference and fromReference methods.

CoordinateSystem objects should be immutable.

See Also:
Serialized Form

Constructor Summary
CoordinateSystem(RealTupleType reference, Unit[] units)
          Constructs from the type of the reference coordinate system and units for values in this coordinate system.
 
Method Summary
static boolean canConvert(RealTupleType out, CoordinateSystem coord_out, RealTupleType in, CoordinateSystem coord_in)
           
 boolean checkTable(FlatField table)
          is this needed ????
abstract  boolean equals(java.lang.Object cs)
          check for equality of CoordinateSystem objects; must test for cs == null
abstract  double[][] fromReference(double[][] value)
          convert RealTuple values from Reference coordinates; for efficiency, input and output values are passed as double[][] arrays rather than RealTuple[] arrays; the array organization is double[tuple_dimension][number_of_tuples]; can modify and return argument array
 double[][] fromReference(double[][] value, Unit[] units)
          if units are non-null, they are both the Unit[] of input value, and a holder for Unit[] of output
 float[][] fromReference(float[][] value)
          convert RealTuple values from Reference coordinates; for efficiency, input and output values are passed as double[][] arrays rather than RealTuple[] arrays; the array organization is double[tuple_dimension][number_of_tuples]; can modify and return argument array for efficiency, subclasses should override this implementation
 Unit[] getCoordinateSystemUnits()
           
 int getDimension()
           
 RealTupleType getReference()
           
 Unit[] getReferenceUnits()
           
abstract  double[][] toReference(double[][] value)
          convert RealTuple values to Reference coordinates; for efficiency, input and output values are passed as double[][] arrays rather than RealTuple[] arrays; the array organization is double[tuple_dimension][number_of_tuples]; can modify and return argument array
 double[][] toReference(double[][] value, Unit[] units)
          if units are non-null, they are both the Unit[] of input value, and a holder for Unit[] of output
 float[][] toReference(float[][] value)
          convert RealTuple values to Reference coordinates; for efficiency, input and output values are passed as double[][] arrays rather than RealTuple[] arrays; the array organization is double[tuple_dimension][number_of_tuples]; can modify and return argument array; for efficiency, subclasses should override this implementation
static double[][] transformCoordinates(RealTupleType out, CoordinateSystem coord_out, Unit[] units_out, ErrorEstimate[] errors_out, RealTupleType in, CoordinateSystem coord_in, Unit[] units_in, ErrorEstimate[] errors_in, double[][] value)
          Transforms double-valued coordinates between two RealTupleTypes.
static float[][] transformCoordinates(RealTupleType out, CoordinateSystem coord_out, Unit[] units_out, ErrorEstimate[] errors_out, RealTupleType in, CoordinateSystem coord_in, Unit[] units_in, ErrorEstimate[] errors_in, float[][] value)
          Transforms float-valued coordinates between two RealTupleTypes.
static double[][] transformCoordinatesFreeUnits(RealTupleType out, CoordinateSystem coord_out, Unit[] units_out, ErrorEstimate[] errors_out, RealTupleType in, CoordinateSystem coord_in, Unit[] units_in, ErrorEstimate[] errors_in, double[][] value)
          Transforms double-valued coordinates between two RealTupleTypes.
static float[][] transformCoordinatesFreeUnits(RealTupleType out, CoordinateSystem coord_out, Unit[] units_out, ErrorEstimate[] errors_out, RealTupleType in, CoordinateSystem coord_in, Unit[] units_in, ErrorEstimate[] errors_in, float[][] value)
          Transforms float-valued coordinates between two RealTupleTypes.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CoordinateSystem

public CoordinateSystem(RealTupleType reference,
                        Unit[] units)
                 throws VisADException
Constructs from the type of the reference coordinate system and units for values in this coordinate system. Subclasses must supply reference type and units.

Parameters:
reference - The type of the reference coordinate system. Numeric values in the reference coordinate system shall be in units of reference.getDefaultUnits() unless specified otherwise.
units - The default units for this coordinate system. Numeric values in this coordinate system shall be in units of units unless specified otherwise. May be null or an array of null-s.
Throws:
VisADException - Couldn't create necessary VisAD object.
Method Detail

getReference

public RealTupleType getReference()

getDimension

public int getDimension()

getReferenceUnits

public Unit[] getReferenceUnits()

getCoordinateSystemUnits

public Unit[] getCoordinateSystemUnits()

toReference

public abstract double[][] toReference(double[][] value)
                                throws VisADException
convert RealTuple values to Reference coordinates; for efficiency, input and output values are passed as double[][] arrays rather than RealTuple[] arrays; the array organization is double[tuple_dimension][number_of_tuples]; can modify and return argument array

Throws:
VisADException

fromReference

public abstract double[][] fromReference(double[][] value)
                                  throws VisADException
convert RealTuple values from Reference coordinates; for efficiency, input and output values are passed as double[][] arrays rather than RealTuple[] arrays; the array organization is double[tuple_dimension][number_of_tuples]; can modify and return argument array

Throws:
VisADException

toReference

public float[][] toReference(float[][] value)
                      throws VisADException
convert RealTuple values to Reference coordinates; for efficiency, input and output values are passed as double[][] arrays rather than RealTuple[] arrays; the array organization is double[tuple_dimension][number_of_tuples]; can modify and return argument array; for efficiency, subclasses should override this implementation

Throws:
VisADException

fromReference

public float[][] fromReference(float[][] value)
                        throws VisADException
convert RealTuple values from Reference coordinates; for efficiency, input and output values are passed as double[][] arrays rather than RealTuple[] arrays; the array organization is double[tuple_dimension][number_of_tuples]; can modify and return argument array for efficiency, subclasses should override this implementation

Throws:
VisADException

canConvert

public static boolean canConvert(RealTupleType out,
                                 CoordinateSystem coord_out,
                                 RealTupleType in,
                                 CoordinateSystem coord_in)

transformCoordinates

public static double[][] transformCoordinates(RealTupleType out,
                                              CoordinateSystem coord_out,
                                              Unit[] units_out,
                                              ErrorEstimate[] errors_out,
                                              RealTupleType in,
                                              CoordinateSystem coord_in,
                                              Unit[] units_in,
                                              ErrorEstimate[] errors_in,
                                              double[][] value)
                                       throws VisADException

Transforms double-valued coordinates between two RealTupleTypes. Unit conversion is always performed even if no coordinate transformation is done.

This implementation uses transformCoordinatesFreeUnits(visad.RealTupleType, visad.CoordinateSystem, visad.Unit[], visad.ErrorEstimate[], visad.RealTupleType, visad.CoordinateSystem, visad.Unit[], visad.ErrorEstimate[], double[][]) to do most of the transformation.

If both RealTupleTypes have a reference coordinate system, then this implementation always transforms the input domain values by first transforming them according to the input reference coordinate system and then inverse transforming them according to the output reference coordinate system -- even if the input and output RealTupleTypes are equal.

Parameters:
out - The output RealTupleType.
coord_out - The coordinate system transformation associated with the output RealTupleType or null.
units_out - The output units.
errors_out - The output error estimates or null.
in - The input RealTupleType.
coord_in - The coordinate system transformation associated with the output RealTupleType or null.
units_in - The input units or null.
errors_in - The input error estimates or null.
value - The input coordinate values. value[i][j] is the j-th sample of the i-th component. The values might be modified upon return from this method.
Returns:
The transformed coordinate values not in the input array.
Throws:
VisADException - if a VisAD failure occurs.
java.lang.NullPointerException - if units_out is null.

transformCoordinatesFreeUnits

public static double[][] transformCoordinatesFreeUnits(RealTupleType out,
                                                       CoordinateSystem coord_out,
                                                       Unit[] units_out,
                                                       ErrorEstimate[] errors_out,
                                                       RealTupleType in,
                                                       CoordinateSystem coord_in,
                                                       Unit[] units_in,
                                                       ErrorEstimate[] errors_in,
                                                       double[][] value)
                                                throws VisADException

Transforms double-valued coordinates between two RealTupleTypes. This is just like transformCoordinates(visad.RealTupleType, visad.CoordinateSystem, visad.Unit[], visad.ErrorEstimate[], visad.RealTupleType, visad.CoordinateSystem, visad.Unit[], visad.ErrorEstimate[], double[][]), except that final Unit conversion to units_out is not done; rather, units_out[i] is set to the final Unit of value[i].

If both RealTupleTypes have a reference coordinate system, then this implementation always transforms the input domain values by first transforming them according to the input reference coordinate system and then inverse transforming them according to the output reference coordinate system -- even if the input and output RealTupleTypes are equal.

Parameters:
out - The output RealTupleType.
coord_out - The coordinate system transformation associated with the output RealTupleType or null.
units_out - The output units or null.
errors_out - The output error estimates or null.
in - The input RealTupleType.
coord_in - The coordinate system transformation associated with the output RealTupleType or null.
units_in - The input units or null.
errors_in - The input error estimates or null.
value - The input coordinate values. value[i][j] is the j-th sample of the i-th component.
Returns:
The transformed coordinate values. Possibly in the input array.
Throws:
VisADException - if a VisAD failure occurs.

transformCoordinates

public static float[][] transformCoordinates(RealTupleType out,
                                             CoordinateSystem coord_out,
                                             Unit[] units_out,
                                             ErrorEstimate[] errors_out,
                                             RealTupleType in,
                                             CoordinateSystem coord_in,
                                             Unit[] units_in,
                                             ErrorEstimate[] errors_in,
                                             float[][] value)
                                      throws VisADException

Transforms float-valued coordinates between two RealTupleTypes. Unit conversion is always performed even if no coordinate transformation is done.

This implementation uses transformCoordinatesFreeUnits(visad.RealTupleType, visad.CoordinateSystem, visad.Unit[], visad.ErrorEstimate[], visad.RealTupleType, visad.CoordinateSystem, visad.Unit[], visad.ErrorEstimate[], double[][]) to do most of the transformation.

If both RealTupleTypes have a reference coordinate system, then this implementation always transforms the input domain values by first transforming them according to the input reference coordinate system and then inverse transforming them according to the output reference coordinate system -- even if the input and output RealTupleTypes are equal.

Parameters:
out - The output RealTupleType.
coord_out - The coordinate system transformation associated with the output RealTupleType or null.
units_out - The output units.
errors_out - The output error estimates or null.
in - The input RealTupleType.
coord_in - The coordinate system transformation associated with the output RealTupleType or null.
units_in - The input units or null.
errors_in - The input error estimates or null.
value - The input coordinate values. value[i][j] is the j-th sample of the i-th component. The values might be modified upon return from this method.
Returns:
The transformed coordinate values not in the input array.
Throws:
VisADException - if a VisAD failure occurs.
java.lang.NullPointerException - if units_out is null.

transformCoordinatesFreeUnits

public static float[][] transformCoordinatesFreeUnits(RealTupleType out,
                                                      CoordinateSystem coord_out,
                                                      Unit[] units_out,
                                                      ErrorEstimate[] errors_out,
                                                      RealTupleType in,
                                                      CoordinateSystem coord_in,
                                                      Unit[] units_in,
                                                      ErrorEstimate[] errors_in,
                                                      float[][] value)
                                               throws VisADException

Transforms float-valued coordinates between two RealTupleTypes. This is just like transformCoordinates(visad.RealTupleType, visad.CoordinateSystem, visad.Unit[], visad.ErrorEstimate[], visad.RealTupleType, visad.CoordinateSystem, visad.Unit[], visad.ErrorEstimate[], double[][]), except that final Unit conversion to units_out is not done; rather, units_out[i] is set to the final Unit of value[i].

If both RealTupleTypes have a reference coordinate system, then this implementation always transforms the input domain values by first transforming them according to the input reference coordinate system and then inverse transforming them according to the output reference coordinate system -- even if the input and output RealTupleTypes are equal.

Parameters:
out - The output RealTupleType.
coord_out - The coordinate system transformation associated with the output RealTupleType or null.
units_out - The output units or null.
errors_out - The output error estimates or null.
in - The input RealTupleType.
coord_in - The coordinate system transformation associated with the output RealTupleType or null.
units_in - The input units or null.
errors_in - The input error estimates or null.
value - The input coordinate values. value[i][j] is the j-th sample of the i-th component.
Returns:
The transformed coordinate values. Possibly in the input array.
Throws:
VisADException - if a VisAD failure occurs.

toReference

public double[][] toReference(double[][] value,
                              Unit[] units)
                       throws VisADException
if units are non-null, they are both the Unit[] of input value, and a holder for Unit[] of output

Throws:
VisADException

fromReference

public double[][] fromReference(double[][] value,
                                Unit[] units)
                         throws VisADException
if units are non-null, they are both the Unit[] of input value, and a holder for Unit[] of output

Throws:
VisADException

checkTable

public boolean checkTable(FlatField table)
                   throws VisADException
is this needed ????

Throws:
VisADException

equals

public abstract boolean equals(java.lang.Object cs)
check for equality of CoordinateSystem objects; must test for cs == null

Overrides:
equals in class java.lang.Object