ucar.visad
Class Util

java.lang.Object
  extended by ucar.visad.Util

public final class Util
extends Object

Provides support for utility functions.

Version:
$Revision: 1.81 $ $Date: 2007/08/19 15:55:31 $
Author:
Unidata Development Team

Field Summary
static String REALTYPE_ROOT
          The default root name for generic RealTypes
static String TEXT_IDENTIFIER
          The suffix added to text type names
 
Method Summary
static Real bearingDistance(EarthLocation el1, EarthLocation el2)
          Return the distance from a bearing as Real
static ucar.unidata.geoloc.Bearing calculateBearing(LatLonPoint pt1, LatLonPoint pt2, ucar.unidata.geoloc.Bearing result)
          Calculate the bearing between the 2 points.
static String cleanName(String name)
          Make a valid VisAD RealType name from the string.
static String cleanTypeName(MathType mathType)
          Remove any of the extra unit suffixes that get added to the type name
static String cleanTypeName(String name)
          A utility to strip off the unit name that gets appended to the real type name.
static Data clone(Data data, MathType type)
          Clones a data object, replacing the MathType.
static Data clone(Data data, MathType type, boolean unitOverride, boolean copy)
          Clones a data object, replacing the MathType.
static Field clone(Field field, Set domain)
          Clones a Field replacing the domain Set and copying the range values.
static Field clone(Field field, Set domain, boolean copyRange)
          Clones a Field replacing the domain Set.
static FlatField clone(FlatField flatField, Set domain, boolean copyRange)
          Clones a FlatField replacing the domain Set.
static RealType clone(RealType realType, String name)
          Clones a RealType but changes the name.
static Set clone(Set set, CoordinateSystem coordSys)
          Clones a set, replacing the CoordinateSystem.
static Field convertDomain(Field field, RealTupleType newDomainType, CoordinateSystem coordinateSystem)
          Converts the MathType of the domain of a Field.
static FlatField convertDomain(FlatField field, RealTupleType newDomainType, CoordinateSystem coordinateSystem)
          Converts the domain of a FlatField.
static SampledSet convertDomain(SampledSet oldDomain, RealTupleType newDomainType, CoordinateSystem coordinateSystem)
          Converts a SampledSet domain.
static double distance(LatLonPoint p1, LatLonPoint p2)
          Return the distance between the 2 points
static void dumpTypes(Data d)
          Wrapper for JPythonMethods.dumpTypes(Data)
static Set ensureCoordinateSystem(Set set, CoordinateSystem coordSys)
          Ensures that a set has a particular CoordinateSystem.
static Field ensureDomain(Field field, RealTupleType newDomainType, CoordinateSystem coordinateSystem)
          Ensures that a Field has a particular domain MathType.
static Field ensureDomain(Field field, Set domain)
          Ensures that a Field has a particular domain Set.
static FlatField ensureFlatFieldRangeType(FlatField flatField, RealType realType)
          Ensures that the MathType of the range of a FlatField is a specified RealType.
static Data ensureMathType(Data data, MathType type)
          Ensures that a data object has a particular MathType.
static Field ensureTupleRange(Field field)
          Ensures that the range of a Field is a Tuple.
static RealType[] ensureUnit(RealType[] types, Unit u)
          Ensure that the units for the array of RealTypes are compatible with the given unit.
static RealType ensureUnit(RealType type, Unit u)
          Ensure that the units for the RealType are compatible with the given unit.
static boolean exportAsNetcdf(Data data)
          Export the data object as a netCDF file
static int findIndex(Set set, Real value)
          _more_
static String formatAltitude(Real alt)
          Format an Altitude
static String formatEarthLocation(EarthLocation el, boolean includeAlt)
          Format a EarthLocation as a lat/lon/(alt) string.
static String formatLatLonPoint(LatLonPoint llp)
          Format an LatLonPoint as a lat/lon string.
static String formatReal(Real r)
          Format a real value to a nice looking number
static String formatUtcDate(DateTime dt, String pattern)
          Deprecated. use UtcDate.formatUtcDate(DateTime, String)
static String getCompatibleUnitName(Unit u)
          Replace illegal RealType characters in a Unit spec with underscores.
static Unit[] getDefaultRangeUnits(FieldImpl field)
          Gets the default units of the (flat) components of the range of a FlatField.
protected static Unit[] getDefaultUnits(FlatField field, int[] indexes, RealType[] types)
          Gets the default units of the given range components of a FlatField.
static int getIndex(TupleType tupleType, String lookingFor)
          Find the index of the MathType in the given tuple type whose cleaned name is equals to the lookingFor parameter.
static GraphicsConfiguration getPreferredConfig(GraphicsDevice d, boolean is3D, boolean useStereo)
          Get graphics configuration for the screen
static CoordinateSystem getRangeCoordinateSystem(Field field)
          Gets the coordinate sytem of the RealTuple range of a Field.
static CoordinateSystem[] getRangeCoordinateSystems(Field field)
          Gets the coordinate sytems of the components of the range of a Field.
static SampledSet getRangeSampledSet(Field field, MathType type)
          Extracts the given range component from a Field as a SampledSet.
static Unit[] getRangeUnits(FlatField field)
          Gets the units of the (flat) components of the range of a FlatField.
static double[] getRayPositionAtZ(VisADRay ray, double zValue)
          Get the position of the ray at a particular Z value.
static Real getReal(double value, String unitString)
          Get a Real with the specified value and Unit
static Real getReal(double value, Unit unit)
          Get a Real with the specified value and Unit
static RealType getRealType(RealTupleType type, String start)
          Get the RealType from the RealTupleType that corresponds to one that begins with start.
static RealType getRealType(Unit unit)
          Get a realtype with the unit
static RealTuple getSample(Set set, int index)
          Deprecated. use visad.util.DataUtility.getSample() now
static double getValueAs(Real r, String unitString)
          Get the value of a Real in the unit specified
static double[] getVWorldCoords(DisplayImpl display, int x, int y, double[] retVals)
          Get the VisAD Virtual World x,y coordinates for the given screen coords
static FieldImpl indexedField(Data[] datas, boolean copy)
          Get a FieldImpl with a domain of index and the range of the datas.
static boolean isCompatible(Data data, MathType type)
          Indicates if a Data object is compatible with a MathType.
static boolean isSorted(float[] values)
          Indicates if an array is sorted.
static boolean isStrictlySorted(float[] values)
          Indicates if an array is strictly sorted.
static TwoFacedObject labeledReal(Real r)
          Wrap a Real as a TwoFacedObject with a formatted label
static TwoFacedObject labeledReal(Real r, boolean includeUnit)
          Wrap a Real as a TwoFacedObject with a formatted label
static void main(String[] args)
          Test
static Date makeDate(DateTime dttm)
          _more_
static List makeDates(DateTime[] timesArray)
          _more_
static GriddedSet makeEarthDomainSet(float[] lats, float[] lons, float[] alts)
           
static EarthLocation makeEarthLocation(double lat, double lon)
          Utility to make an earth location with a 0 altitude
static EarthLocation makeEarthLocation(LatLonPoint llp)
          Utility to make an earth location with a 0 altitude
static FlatField makeField(float lon1, float lon2, int length1, float lat1, float lat2, int length2, float fill, String unitString)
          _more_
static FlatField makeField(Image image, boolean makeNansForAnyAlpha)
          Create a VisAD Data object from the given Image
static MapProjection makeMapProjection(double lat1, double lon1, double lat2, double lon2)
          _more_
static RealType makeRealType(String name, String alias, Unit unit)
           
static RealType makeRealType(String name, Unit unit)
          Create a RealType from the name and unit.
static Data makeTimeField(Data range, List times)
          This makes a field of T->range for the times in the list.
static FieldImpl makeTimeField(List ranges, List times)
           
static Data makeTimeRangeField(Data range, List times)
          This makes a field of T->range for the times in the list.
static Set makeTimeSet(List times)
          _more_
static SampledSet newSampledSet(int[] manifoldLengths, RealTupleType newSampledSetType, double[][] newValues, CoordinateSystem coordinateSystem, Unit[] newUnits, ErrorEstimate[] newErrors)
          Creates a new SampledSet using a given manifold dimensionality.
static SampledSet newSampledSet(int[] manifoldLengths, RealTupleType newSampledSetType, float[][] newValues, CoordinateSystem coordinateSystem, Unit[] newUnits, ErrorEstimate[] newErrors)
          Creates a new SampledSet using a given manifold dimensionality.
static SampledSet newSampledSet(MathType type, float[][] values, int[] manifoldLengths, CoordinateSystem coordinateSystem, Unit[] units, ErrorEstimate[] errors, boolean copy)
          Creates a new SampledSet.
static SampledSet newSampledSet(SampledSet oldSampledSet, double[][] newValues, int[] manifoldLengths)
          Creates a new SampledSet based on an existing SampledSet and new values.
static SampledSet newSampledSet(SampledSet oldSampledSet, float[][] newValues, int[] manifoldLengths)
          Creates a new SampledSet based on an existing SampledSet and new values.
static SampledSet newSampledSet(SampledSet oldSampledSet, RealTupleType newSampledSetType, double[][] newValues, CoordinateSystem coordinateSystem, Unit[] newUnits, ErrorEstimate[] newErrors)
          Creates a new SampledSet using the topology of an existing SampledSet.
static SampledSet newSampledSet(SampledSet oldSampledSet, RealTupleType newSampledSetType, float[][] newValues, CoordinateSystem coordinateSystem, Unit[] newUnits, ErrorEstimate[] newErrors)
          Creates a new SampledSet using the topology of an existing SampledSet.
static Unit parseUnit(String unitIdentifier)
          Parse a unit string specification and return the appropriate unit.
static Unit parseUnit(String unitIdentifier, String unitName)
          Parse a unit string specification and return the appropriate unit.
static boolean propertySet(Object object, String name, Object value, boolean ignoreError)
          Use reflection to find the Method with name "set" + Name.
static int[] sortedIndexes(double[] values, boolean increasing)
          Returns the element indexes that would sort an array.
static int[] sortedIndexes(float[] values, boolean increasing)
          Returns the element indexes that would sort an array.
static int[] strictlySortedIndexes(double[] values, boolean increasing)
          Returns the element indexes that would strictly sort an array.
static int[] strictlySortedIndexes(float[] values, boolean increasing)
          Returns the element indexes that would strictly sort an array.
static float[] take(float[] values, int[] indexes)
          Takes indicated values from an array.
static ucar.unidata.geoloc.LatLonPointImpl toLatLonPoint(LatLonPoint llp)
           
static List toList(Set set)
          Convert the elements in the set to a List
static ucar.unidata.geoloc.LatLonPoint toLLP(EarthLocation el)
           
static ucar.unidata.geoloc.LatLonPoint toLLP(LatLonPoint llp)
           
static Real toReal(String value)
          Parses the given String and returns the Real (if possible) that the string represents.
static Real toReal(String value, String unitOpener, String unitCloser)
           
static Data vetType(MathType type, Data data)
          Vets a data object against a MathType.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEXT_IDENTIFIER

public static final String TEXT_IDENTIFIER
The suffix added to text type names

See Also:
Constant Field Values

REALTYPE_ROOT

public static String REALTYPE_ROOT
The default root name for generic RealTypes

Method Detail

getDefaultUnits

protected static Unit[] getDefaultUnits(FlatField field,
                                        int[] indexes,
                                        RealType[] types)
                                 throws IllegalArgumentException,
                                        TypeException,
                                        VisADException
Gets the default units of the given range components of a FlatField.

Parameters:
field - The field to be examined.
indexes - Indexes of the components in the range of the field.
types - Expected, compatible types for the components.
Returns:
The units of the range components.
Throws:
IllegalArgumentException - field == null || indexes.length != types.length, or indexes out-of-bounds.
TypeException - Type of component in range of field not compatible with expected type.
VisADException - Couldn't create necessary VisAD object.

clone

public static RealType clone(RealType realType,
                             String name)
                      throws VisADException
Clones a RealType but changes the name.

Parameters:
realType - The realtype to be cloned.
name - The new name for the clone.
Returns:
The cloned realtype with the new name.
Throws:
VisADException - Couldn't create necessary VisAD object.

isCompatible

public static boolean isCompatible(Data data,
                                   MathType type)
                            throws VisADException,
                                   RemoteException
Indicates if a Data object is compatible with a MathType.

Parameters:
data - The Data object.
type - The MathType.
Returns:
true if and only if the given Data object is compatible with the given MathType.
Throws:
VisADException - if a VisAD failure occurs.
RemoteException - if a Java RMI failure occurs.

vetType

public static Data vetType(MathType type,
                           Data data)
                    throws TypeException,
                           VisADException,
                           RemoteException
Vets a data object against a MathType. The data object must be compatible with the MathType or an exception is thrown.

This method should probably become MathType.vet(Data).

Parameters:
type - The MathType that the data object must be compatible with.
data - The data object.
Returns:
data (as a programming convenience).
Throws:
TypeException - The MathType and data object are incompatible.
VisADException - Couldn't create necessary VisAD object.
RemoteException - Java RMI failure.

ensureUnit

public static RealType ensureUnit(RealType type,
                                  Unit u)
                           throws VisADException
Ensure that the units for the RealType are compatible with the given unit.

Parameters:
type - RealType to check
u - unit to check
Returns:
the original RealType or a RealType with compatible units.
Throws:
VisADException - couldn't get a new RealType

getCompatibleUnitName

public static String getCompatibleUnitName(Unit u)
Replace illegal RealType characters in a Unit spec with underscores.

Parameters:
u - Unit
Returns:
a compatible unit name

cleanName

public static String cleanName(String name)
Make a valid VisAD RealType name from the string. Remove spaces, "." and parens.

Parameters:
name - name to clean
Returns:
cleaned up name

ensureUnit

public static RealType[] ensureUnit(RealType[] types,
                                    Unit u)
                             throws VisADException
Ensure that the units for the array of RealTypes are compatible with the given unit.

Parameters:
types - array of RealTypes to check
u - unit to check
Returns:
the original RealTypes or an array of RealTypes with compatible units.
Throws:
VisADException - couldn't get a new RealType

ensureMathType

public static Data ensureMathType(Data data,
                                  MathType type)
                           throws UnimplementedException,
                                  VisADException,
                                  RemoteException
Ensures that a data object has a particular MathType. Clones the data object only if necessary.

This method should probably become "abstract Data Data.ensureMathType(MathType)" with subclass-dependent implementations.

Parameters:
data - The data object.
type - The type for the returned data object. Must be compatible with the current type of the data object. The data object will be cloned only if necessary.
Returns:
A data object with the given MathType.
Throws:
UnimplementedException - Method not yet implemented.
VisADException - Couldn't create necessary VisAD object.
RemoteException - Java RMI failure.

ensureDomain

public static Field ensureDomain(Field field,
                                 Set domain)
                          throws UnimplementedException,
                                 VisADException,
                                 RemoteException
Ensures that a Field has a particular domain Set. Clones the Field only if necessary.

Parameters:
field - The Field the have a particular domain Set.
domain - The particular domain Set for the Field to have. Must be compatible with the Field's existing domain set.
Returns:
The Field with the particular domain set.
Throws:
UnimplementedException - Can't yet clone the class of the Field.
VisADException - Couldn't create necessary VisAD object.
RemoteException - Java RMI failure.

ensureDomain

public static Field ensureDomain(Field field,
                                 RealTupleType newDomainType,
                                 CoordinateSystem coordinateSystem)
                          throws UnimplementedException,
                                 VisADException,
                                 RemoteException
Ensures that a Field has a particular domain MathType. Clones the Field only if necessary.

Parameters:
field - The Field the have a particular domain Set.
newDomainType - The particular MathType for the domain of the Field to have. Coordinate conversions are done if and when necessary and possible.
coordinateSystem - The CoordinateSystem which, together with newDomainType, form the basis for the desired domain. May be null.
Returns:
The Field with the particular domain set.
Throws:
UnimplementedException - Can't yet clone the class of the Field.
VisADException - Couldn't create necessary VisAD object.
RemoteException - Java RMI failure.

ensureTupleRange

public static Field ensureTupleRange(Field field)
                              throws RemoteException,
                                     VisADException
Ensures that the range of a Field is a Tuple.

Parameters:
field - The Field.
Returns:
A Field identical to the input field but with a Tuple range. May be the same field. The range will be a RealTuple if possible.
Throws:
VisADException - Couldn't create necessary VisAD object.
RemoteException - Java RMI failure.

clone

public static Field clone(Field field,
                          Set domain)
                   throws UnimplementedException,
                          VisADException,
                          RemoteException
Clones a Field replacing the domain Set and copying the range values.

Parameters:
field - The Field to be cloned..
domain - The domain Set for the cloned Field to have. Must be compatible with the Field's existing domain set.
Returns:
A clone of the Field with the particular domain set.
Throws:
UnimplementedException - Can't yet clone the class of the Field.
VisADException - Couldn't create necessary VisAD object.
RemoteException - Java RMI failure.

clone

public static Field clone(Field field,
                          Set domain,
                          boolean copyRange)
                   throws UnimplementedException,
                          VisADException,
                          RemoteException
Clones a Field replacing the domain Set.

Parameters:
field - The Field to be cloned.
domain - The domain Set for the cloned Field to have. Need only be topologically equivalent to the Field's existing domain set.
copyRange - If true then the range of the old Field will be copied to the new Field; otherwise not.
Returns:
A clone of the Field with the particular domain set.
Throws:
UnimplementedException - Can't yet clone the class of the Field.
VisADException - Couldn't create necessary VisAD object.
RemoteException - Java RMI failure.

clone

public static FlatField clone(FlatField flatField,
                              Set domain,
                              boolean copyRange)
                       throws VisADException,
                              RemoteException
Clones a FlatField replacing the domain Set. The actual range units in the clone may differ from those of the input FlatField.

Parameters:
flatField - The FlatField to be cloned.
domain - The domain Set for the cloned FlatField to have. Need only be topologically equivalent to existing domain.
copyRange - If true then the range of the old FlatField will be copied to the new Field; otherwise not.
Returns:
A clone of the FlatField with the particular domain set.
Throws:
VisADException - Couldn't create necessary VisAD object.
RemoteException - Java RMI failure.

convertDomain

public static Field convertDomain(Field field,
                                  RealTupleType newDomainType,
                                  CoordinateSystem coordinateSystem)
                           throws UnimplementedException,
                                  VisADException,
                                  RemoteException
Converts the MathType of the domain of a Field.

Parameters:
field - The Field to be converted.
newDomainType - The MathType of the domain for the converted Field to have. Coordinate conversions are done if and when necessary and possible.
coordinateSystem - The CoordinateSystem which, together with newDomainType, form the basis for the desired domain. May be null.
Returns:
A clone of the Field with the particular domain type.
Throws:
UnimplementedException - Can't yet clone the class of the Field.
VisADException - Couldn't create necessary VisAD object.
RemoteException - Java RMI failure.

convertDomain

public static FlatField convertDomain(FlatField field,
                                      RealTupleType newDomainType,
                                      CoordinateSystem coordinateSystem)
                               throws VisADException,
                                      RemoteException
Converts the domain of a FlatField.

Parameters:
field - The FlatField to be converted.
newDomainType - The MathType for the converted FlatField. Coordinate conversions are done if and when necessary and possible.
coordinateSystem - The CoordinateSystem which, together with newDomainType, form the basis for the desired domain. May be null.
Returns:
A copy of the input Field but with the domain converted to the new MathType.
Throws:
VisADException - Couldn't create necessary VisAD object.
RemoteException - Java RMI failure.

convertDomain

public static SampledSet convertDomain(SampledSet oldDomain,
                                       RealTupleType newDomainType,
                                       CoordinateSystem coordinateSystem)
                                throws VisADException,
                                       RemoteException
Converts a SampledSet domain.

Parameters:
oldDomain - The domain to be converted.
newDomainType - The type of the new domain.
coordinateSystem - The CoordinateSystem which, together with newDomainType, form the basis for the desired domain. May be null.
Returns:
The old domain converted into the new type. Coordinate system transformations are done if and when necessary and possible.
Throws:
VisADException - Couldn't create necessary VisAD object.
RemoteException - Java RMI failure.

newSampledSet

public static SampledSet newSampledSet(SampledSet oldSampledSet,
                                       float[][] newValues,
                                       int[] manifoldLengths)
                                throws VisADException,
                                       RemoteException
Creates a new SampledSet based on an existing SampledSet and new values.

Parameters:
oldSampledSet - The existing SampledSet.
newValues - The values for the new SampledSet.
manifoldLengths - The manifold dimensionality (i.e. the number and size of each dimension). May be null in which case an IrregularSet is created and returned; otherwise, the first element is the size of the innermost dimension, etc.
Returns:
The new SampledSet corresponding to the input arguments.
Throws:
VisADException - Couldn't perform necessary VisAD operation.
RemoteException - Java RMI failure.

newSampledSet

public static SampledSet newSampledSet(SampledSet oldSampledSet,
                                       double[][] newValues,
                                       int[] manifoldLengths)
                                throws VisADException,
                                       RemoteException
Creates a new SampledSet based on an existing SampledSet and new values.

Parameters:
oldSampledSet - The existing SampledSet.
newValues - The values for the new SampledSet.
manifoldLengths - The manifold dimensionality (i.e. the number and size of each dimension). May be null in which case an IrregularSet is created and returned; otherwise, the first element is the size of the innermost dimension, etc.
Returns:
The new SampledSet corresponding to the input arguments.
Throws:
VisADException - Couldn't perform necessary VisAD operation.
RemoteException - Java RMI failure.

newSampledSet

public static SampledSet newSampledSet(SampledSet oldSampledSet,
                                       RealTupleType newSampledSetType,
                                       float[][] newValues,
                                       CoordinateSystem coordinateSystem,
                                       Unit[] newUnits,
                                       ErrorEstimate[] newErrors)
                                throws VisADException,
                                       RemoteException
Creates a new SampledSet using the topology of an existing SampledSet.

Parameters:
oldSampledSet - The old SampledSet to be used for the topology of the new SampledSet.
newSampledSetType - The type of the new SampledSet.
newValues - The values for the new SampledSet.
coordinateSystem - The CoordinateSystem for the new SampledSet.
newUnits - The units for the new SampledSet.
newErrors - The new ErrorEstimate-s for the new SampledSet.
Returns:
The new SampledSet corresponding to the input arguments.
Throws:
VisADException - Couldn't perform necessary VisAD operation.
RemoteException - Java RMI failure.

newSampledSet

public static SampledSet newSampledSet(SampledSet oldSampledSet,
                                       RealTupleType newSampledSetType,
                                       double[][] newValues,
                                       CoordinateSystem coordinateSystem,
                                       Unit[] newUnits,
                                       ErrorEstimate[] newErrors)
                                throws VisADException,
                                       RemoteException
Creates a new SampledSet using the topology of an existing SampledSet.

Parameters:
oldSampledSet - The old SampledSet to be used for the topology of the new SampledSet.
newSampledSetType - The type of the new SampledSet.
newValues - The values for the new SampledSet.
coordinateSystem - The CoordinateSystem for the new SampledSet.
newUnits - The units for the new SampledSet.
newErrors - The new ErrorEstimate-s for the new SampledSet.
Returns:
The new SampledSet corresponding to the input arguments.
Throws:
VisADException - Couldn't perform necessary VisAD operation.
RemoteException - Java RMI failure.

newSampledSet

public static SampledSet newSampledSet(int[] manifoldLengths,
                                       RealTupleType newSampledSetType,
                                       double[][] newValues,
                                       CoordinateSystem coordinateSystem,
                                       Unit[] newUnits,
                                       ErrorEstimate[] newErrors)
                                throws VisADException,
                                       RemoteException
Creates a new SampledSet using a given manifold dimensionality.

Parameters:
manifoldLengths - The manifold dimensionality (i.e. the number and size of each dimension). May be null in which case an IrregularSet is created and returned; otherwise, the first element is the size of the innermost dimension, etc.
newSampledSetType - The type of the new SampledSet.
newValues - The values for the new SampledSet.
coordinateSystem - The CoordinateSystem for the new SampledSet.
newUnits - The units for the new SampledSet.
newErrors - The new ErrorEstimate-s for the new SampledSet.
Returns:
The new SampledSet corresponding to the input arguments. Will be an IrregularSet, a GriddedSet, or a SingletonSet.
Throws:
VisADException - Couldn't perform necessary VisAD operation.
RemoteException - Java RMI failure.

newSampledSet

public static SampledSet newSampledSet(int[] manifoldLengths,
                                       RealTupleType newSampledSetType,
                                       float[][] newValues,
                                       CoordinateSystem coordinateSystem,
                                       Unit[] newUnits,
                                       ErrorEstimate[] newErrors)
                                throws VisADException,
                                       RemoteException
Creates a new SampledSet using a given manifold dimensionality.

Parameters:
manifoldLengths - The manifold dimensionality (i.e. the number and size of each dimension). May be null in which case an IrregularSet is created and returned; otherwise, the first element is the size of the innermost dimension, etc.
newSampledSetType - The type of the new SampledSet.
newValues - The values for the new SampledSet.
coordinateSystem - The CoordinateSystem for the new SampledSet.
newUnits - The units for the new SampledSet.
newErrors - The new ErrorEstimate-s for the new SampledSet.
Returns:
The new SampledSet corresponding to the input arguments. Will be an IrregularSet, a GriddedSet, or a SingletonSet.
Throws:
VisADException - Couldn't perform necessary VisAD operation.
RemoteException - Java RMI failure.

getRangeCoordinateSystem

public static CoordinateSystem getRangeCoordinateSystem(Field field)
                                                 throws VisADException,
                                                        RemoteException
Gets the coordinate sytem of the RealTuple range of a Field.

Parameters:
field - The Field.
Returns:
The CoordinateSystem of the range of the Field if appropriate; otherwise null.
Throws:
VisADException - Couldn't create necessary VisAD object.
RemoteException - Java RMI failure.

getRangeCoordinateSystems

public static CoordinateSystem[] getRangeCoordinateSystems(Field field)
                                                    throws VisADException,
                                                           RemoteException
Gets the coordinate sytems of the components of the range of a Field.

Parameters:
field - The Field.
Returns:
The CoordinateSystems of the components of the range of the Field if appropriate; otherwise, null.
Throws:
VisADException - Couldn't create necessary VisAD object.
RemoteException - Java RMI failure.

getRangeUnits

public static Unit[] getRangeUnits(FlatField field)
Gets the units of the (flat) components of the range of a FlatField.

Parameters:
field - The FlatField.
Returns:
The units of the (flat) components of the range of the FlatField. Won't be null.

getDefaultRangeUnits

public static Unit[] getDefaultRangeUnits(FieldImpl field)
Gets the default units of the (flat) components of the range of a FlatField.

Parameters:
field - The FlatField.
Returns:
The default units of the (flat) components of the range of the FlatField. Won't be null.

clone

public static Data clone(Data data,
                         MathType type)
                  throws UnimplementedException,
                         VisADException,
                         RemoteException
Clones a data object, replacing the MathType. If the input data object is a FlatField, then the actual range units of the clone may differ from those of the input data object.

This method should probably become "abstract Data Data.clone(MathType)" with subclass-dependent implementations.

Parameters:
data - The data object to be cloned.
type - The type for the returned data object. Must be compatible with the current type of the data object.
Returns:
The cloned data object with the new MathType.
Throws:
UnimplementedException - Method not yet implemented.
VisADException - Couldn't create necessary VisAD object.
RemoteException - Java RMI failure.

clone

public static Data c