public final class Util
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
REALTYPE_ROOT
The default root name for generic RealTypes
|
static java.lang.String |
TEXT_IDENTIFIER
The suffix added to text type names
|
Modifier and Type | Method and Description |
---|---|
static boolean |
allMissing(visad.RealTuple rt)
Check to see if a RealTuple is all missing data.
|
static visad.Real |
bearingDistance(visad.georef.EarthLocation el1,
visad.georef.EarthLocation el2)
Return the distance from a bearing as Real
|
static ucar.unidata.geoloc.Bearing |
calculateBearing(visad.georef.LatLonPoint pt1,
visad.georef.LatLonPoint pt2)
Calculate the bearing between the 2 points.
|
static ucar.unidata.geoloc.Bearing |
calculateBearing(visad.georef.LatLonPoint pt1,
visad.georef.LatLonPoint pt2,
ucar.unidata.geoloc.Bearing result)
Calculate the bearing between the 2 points.
|
static java.lang.String |
cleanName(java.lang.String name)
Make a valid VisAD RealType name from the string.
|
static java.lang.String |
cleanTypeName(visad.MathType mathType)
Remove any of the extra unit suffixes that get added to the type name
|
static java.lang.String |
cleanTypeName(java.lang.String name)
A utility to strip off the unit name that gets appended to the real type name.
|
static visad.Data |
clone(visad.Data data,
visad.MathType type)
Clones a data object, replacing the MathType.
|
static visad.Data |
clone(visad.Data data,
visad.MathType type,
boolean unitOverride,
boolean copy)
Clones a data object, replacing the MathType.
|
static visad.Data |
clone(visad.Data data,
visad.MathType type,
boolean unitOverride,
boolean copy,
boolean copyDomain)
Clones a data object, replacing the MathType.
|
static visad.Field |
clone(visad.Field field,
visad.Set domain)
Clones a Field replacing the domain Set and copying the range values.
|
static visad.Field |
clone(visad.Field field,
visad.Set domain,
boolean copyRange)
Clones a Field replacing the domain Set.
|
static visad.FlatField |
clone(visad.FlatField flatField,
visad.Set domain,
boolean copyRange)
Clones a FlatField replacing the domain Set.
|
static visad.RealType |
clone(visad.RealType realType,
java.lang.String name)
Clones a RealType but changes the name.
|
static visad.Set |
clone(visad.Set set,
visad.CoordinateSystem coordSys)
Clones a set, replacing the CoordinateSystem.
|
static visad.Field |
convertDomain(visad.Field field,
visad.RealTupleType newDomainType,
visad.CoordinateSystem coordinateSystem)
Converts the MathType of the domain of a Field.
|
static visad.FlatField |
convertDomain(visad.FlatField field,
visad.RealTupleType newDomainType,
visad.CoordinateSystem coordinateSystem)
Converts the domain of a FlatField.
|
static visad.SampledSet |
convertDomain(visad.SampledSet oldDomain,
visad.RealTupleType newDomainType,
visad.CoordinateSystem coordinateSystem)
Converts a SampledSet domain.
|
static Range |
convertRange(Range range,
visad.Unit rangeUnit,
visad.Unit outUnit)
Utility to convert the given raw data range into the other units
|
static double |
distance(visad.georef.LatLonPoint p1,
visad.georef.LatLonPoint p2)
Return the distance between the 2 points
|
static void |
dumpTypes(visad.Data d)
Wrapper for JPythonMethods.dumpTypes(Data)
|
static visad.Set |
ensureCoordinateSystem(visad.Set set,
visad.CoordinateSystem coordSys)
Ensures that a set has a particular CoordinateSystem.
|
static visad.Field |
ensureDomain(visad.Field field,
visad.RealTupleType newDomainType,
visad.CoordinateSystem coordinateSystem)
Ensures that a Field has a particular domain MathType.
|
static visad.Field |
ensureDomain(visad.Field field,
visad.Set domain)
Ensures that a Field has a particular domain Set.
|
static visad.FlatField |
ensureFlatFieldRangeType(visad.FlatField flatField,
visad.RealType realType)
Ensures that the MathType of the range of a FlatField is a specified
RealType.
|
static visad.Data |
ensureMathType(visad.Data data,
visad.MathType type)
Ensures that a data object has a particular MathType.
|
static visad.Field |
ensureTupleRange(visad.Field field)
Ensures that the range of a Field is a Tuple.
|
static visad.RealType[] |
ensureUnit(visad.RealType[] types,
visad.Unit u)
Ensure that the units for the array of RealTypes are compatible
with the given unit.
|
static visad.RealType |
ensureUnit(visad.RealType type,
visad.Unit u)
Ensure that the units for the RealType are compatible with the given
unit.
|
static boolean |
exportAsNetcdf(visad.Data data)
Export the data object as a netCDF file
|
static int |
findIndex(visad.Set set,
visad.Real value)
Find the index of a value in a Set
|
static java.lang.String |
formatAltitude(visad.Real alt)
Format an Altitude
|
static java.lang.String |
formatEarthLocation(visad.georef.EarthLocation el,
boolean includeAlt)
Format a EarthLocation as a lat/lon/(alt) string.
|
static java.lang.String |
formatLatLonPoint(visad.georef.LatLonPoint llp)
Format an LatLonPoint as a lat/lon string.
|
static java.lang.String |
formatReal(visad.Real r)
Format a real value to a nice looking number
|
static java.lang.String |
formatUtcDate(visad.DateTime dt,
java.lang.String pattern)
Deprecated.
use UtcDate.formatUtcDate(DateTime, String)
|
static java.lang.String |
getCompatibleUnitName(visad.Unit u)
Replace illegal RealType characters in a Unit spec with underscores.
|
static visad.Unit[] |
getDefaultRangeUnits(visad.FieldImpl field)
Gets the default units of the (flat) components of the range of a FlatField.
|
protected static visad.Unit[] |
getDefaultUnits(visad.FlatField field,
int[] indexes,
visad.RealType[] types)
Gets the default units of the given range components of a FlatField.
|
static visad.Set |
getDomainSet(visad.Field field)
Utility method to get the domain set from the given field.
|
static visad.Set |
getDomainSetForClone(visad.Field field)
Get the domain for cloning
|
static visad.DateTime |
getGregorianDateTime(java.util.TimeZone zone,
int year,
int month,
int day,
int hour,
int min,
int sec)
Make a datetime from a year,...
|
static int |
getIndex(visad.TupleType tupleType,
java.lang.String lookingFor)
Find the index of the MathType in the given tuple type whose cleaned name
is equals to the lookingFor parameter.
|
static visad.CoordinateSystem |
getRangeCoordinateSystem(visad.Field field)
Gets the coordinate sytem of the RealTuple range of a Field.
|
static visad.CoordinateSystem[] |
getRangeCoordinateSystems(visad.Field field)
Gets the coordinate sytems of the components of the range of a Field.
|
static visad.SampledSet |
getRangeSampledSet(visad.Field field,
visad.MathType type)
Extracts the given range component from a Field as a SampledSet.
|
static visad.Unit[] |
getRangeUnits(visad.FlatField field)
Gets the units of the (flat) components of the range of a FlatField.
|
static double[] |
getRayPositionAtZ(visad.VisADRay ray,
double zValue)
Get the position of the ray at a particular Z value.
|
static visad.Real |
getReal(double value,
java.lang.String unitString)
Get a Real with the specified value and Unit
|
static visad.Real |
getReal(double value,
visad.Unit unit)
Get a Real with the specified value and Unit
|
static visad.RealType |
getRealType(visad.RealTupleType type,
java.lang.String start)
Get the RealType from the RealTupleType that corresponds to one that
begins with start.
|
static visad.RealType |
getRealType(visad.Unit unit)
Get a realtype with the unit
|
static visad.RealTuple |
getSample(visad.Set set,
int index)
Deprecated.
use visad.util.DataUtility.getSample() now
|
static double |
getValueAs(visad.Real r,
java.lang.String unitString)
Get the value of a Real in the unit specified
|
static double[] |
getVWorldCoords(visad.DisplayImpl display,
int x,
int y,
double[] retVals)
Get the VisAD Virtual World x,y coordinates for the given screen coords
|
static visad.FieldImpl |
indexedField(visad.Data[] datas,
boolean copy)
Get a FieldImpl with a domain of index and the range
of the datas.
|
static boolean |
isCompatible(visad.Data data,
visad.MathType type)
Indicates if a
Data object is compatible with a MathType . |
static boolean |
isEarthCoordinates(visad.RealTuple position)
Check if these are earth coordinates
|
static boolean |
isSorted(double[] values)
Indicates if an array is sorted.
|
static boolean |
isSorted(float[] values)
Indicates if an array is sorted.
|
static boolean |
isStrictlySorted(double[] values)
Indicates if an array is strictly sorted.
|
static boolean |
isStrictlySorted(float[] values)
Indicates if an array is strictly sorted.
|
static TwoFacedObject |
labeledReal(visad.Real r)
Wrap a Real as a TwoFacedObject with a formatted label
|
static TwoFacedObject |
labeledReal(visad.Real r,
boolean includeUnit)
Wrap a Real as a TwoFacedObject with a formatted label
|
static void |
main(java.lang.String[] args)
Test
|
static java.util.Date |
makeDate(visad.DateTime dttm)
Make a date from a DateTime
|
static java.util.List<java.util.Date> |
makeDates(visad.DateTime[] timesArray)
Make a list of Date object from the array of DateTime's
|
static visad.GriddedSet |
makeEarthDomainSet(float[] lats,
float[] lons,
float[] alts)
This makes a gridded earth domain set with the given lats, lons and (possible null) alts It uses RealTupleType.LatitudeLongitudeAltitude or RealTupleType.LatitudeLongitudeTuple as the type
|
static visad.GriddedSet |
makeEarthDomainSet(float[] lats,
float[] lons,
float[] alts,
visad.Unit[] units)
This makes a gridded earth domain set with the given lats, lons and (possible null) alts It uses RealTupleType.LatitudeLongitudeAltitude or RealTupleType.LatitudeLongitudeTuple as the type
|
static visad.georef.EarthLocation |
makeEarthLocation(double lat,
double lon)
Utility to make an earth location with a 0 altitude
|
static visad.georef.EarthLocation |
makeEarthLocation(double lat,
double lon,
double alt)
Utility to make an earth location with a altitude
|
static visad.georef.EarthLocation |
makeEarthLocation(visad.georef.LatLonPoint llp)
Utility to make an earth location with a 0 altitude
|
static visad.FlatField |
makeField(float lon1,
float lon2,
int length1,
float lat1,
float lat2,
int length2,
float fill,
java.lang.String unitString)
this makes a empty flat field with the given lat/lon bounds and lengths, the given fill value and the unit
|
static visad.FlatField |
makeField(java.awt.Image image,
boolean makeNansForAnyAlpha)
Create a VisAD Data object from the given Image
|
static visad.FlatField |
makeField(java.awt.Image image,
float alphaThreshold)
Create a VisAD Data object from the given Image
|
static visad.FlatField |
makeField(java.awt.Image image,
float alphaThreshold,
boolean makeAlpha)
Create a VisAD Data object from the given Image
|
static visad.FlatField |
makeField(java.awt.Image image,
float alphaThreshold,
boolean makeAlpha,
boolean incNames)
Create a VisAD Data object from the given Image
|
static visad.georef.MapProjection |
makeMapProjection(double lat1,
double lon1,
double lat2,
double lon2)
Make a map projection from the points
|
static visad.georef.MapProjection |
makeMapProjection(double lat1,
double lon1,
double lat2,
double lon2,
boolean makeSquare)
Make a map projection from the bounds
|
static visad.RealType |
makeRealType(java.lang.String name,
java.lang.String alias,
visad.Unit unit)
Make a RealType
|
static visad.RealType |
makeRealType(java.lang.String name,
visad.Unit unit)
Create a RealType from the name and unit.
|
static visad.FieldImpl[] |
makeTimeField(visad.Data[] ranges,
java.lang.Object time)
Make a time field
|
static visad.Data |
makeTimeField(visad.Data range,
java.util.List times)
This makes a field of T->range for the times in the list.
|
static visad.FieldImpl |
makeTimeField(java.util.List ranges,
java.util.List times)
Make a time field
|
static visad.Data |
makeTimeRangeField(visad.Data range,
java.util.List times)
This makes a field of T->range for the times in the list.
|
static visad.Set |
makeTimeSet(java.util.List times)
Make a time set from a list of times
|
static visad.SampledSet |
newSampledSet(int[] manifoldLengths,
visad.RealTupleType newSampledSetType,
double[][] newValues,
visad.CoordinateSystem coordinateSystem,
visad.Unit[] newUnits,
visad.ErrorEstimate[] newErrors)
Creates a new SampledSet using a given manifold dimensionality.
|
static visad.SampledSet |
newSampledSet(int[] manifoldLengths,
visad.RealTupleType newSampledSetType,
float[][] newValues,
visad.CoordinateSystem coordinateSystem,
visad.Unit[] newUnits,
visad.ErrorEstimate[] newErrors)
Creates a new SampledSet using a given manifold dimensionality.
|
static visad.SampledSet |
newSampledSet(visad.MathType type,
float[][] values,
int[] manifoldLengths,
visad.CoordinateSystem coordinateSystem,
visad.Unit[] units,
visad.ErrorEstimate[] errors,
boolean copy)
Creates a new SampledSet.
|
static visad.SampledSet |
newSampledSet(visad.SampledSet oldSampledSet,
double[][] newValues,
int[] manifoldLengths)
Creates a new SampledSet based on an existing SampledSet and new values.
|
static visad.SampledSet |
newSampledSet(visad.SampledSet oldSampledSet,
float[][] newValues,
int[] manifoldLengths)
Creates a new SampledSet based on an existing SampledSet and new values.
|
static visad.SampledSet |
newSampledSet(visad.SampledSet oldSampledSet,
visad.RealTupleType newSampledSetType,
double[][] newValues,
visad.CoordinateSystem coordinateSystem,
visad.Unit[] newUnits,
visad.ErrorEstimate[] newErrors)
Creates a new SampledSet using the topology of an existing SampledSet.
|
static visad.SampledSet |
newSampledSet(visad.SampledSet oldSampledSet,
visad.RealTupleType newSampledSetType,
float[][] newValues,
visad.CoordinateSystem coordinateSystem,
visad.Unit[] newUnits,
visad.ErrorEstimate[] newErrors)
Creates a new SampledSet using the topology of an existing SampledSet.
|
static visad.Unit |
parseUnit(java.lang.String unitIdentifier)
Parse a unit string specification and return the appropriate
unit.
|
static visad.Unit |
parseUnit(java.lang.String unitIdentifier,
java.lang.String unitName)
Parse a unit string specification and return the appropriate
unit.
|
static double[] |
performRotationAboutArbitraryVector(visad.MouseBehavior mouse,
double[] initialTransFormMatrix,
double angle,
double axisIComp,
double axisJComp,
double axisKComp,
double offsetIComp,
double offsetJComp,
double offsetKComp)
Perform rotation about an arbitrary vector
|
static void |
printData(visad.Data d)
Print out the data summary.
|
static void |
printDataType(visad.Data d)
Print out the data type summary.
|
static boolean |
propertySet(java.lang.Object object,
java.lang.String name,
java.lang.Object value,
boolean ignoreError)
Use reflection to find the Method with name "set" + Name.
|
static void |
setGlobeRadius(float[] position,
float radius)
Set the globe radious based on the position
|
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 double[] |
take(double[] values,
int[] indexes)
Takes indicated values from an array.
|
static float[] |
take(float[] values,
int[] indexes)
Takes indicated values from an array.
|
static ucar.unidata.geoloc.LatLonPointImpl |
toLatLonPoint(visad.georef.LatLonPoint llp)
Create a LatLonPointImpl from the VisAD LatLonPoint
|
static java.util.List |
toList(visad.Set set)
Convert the elements in the set to a List
|
static ucar.unidata.geoloc.LatLonPoint |
toLLP(visad.georef.EarthLocation el)
convert the visad EarthLocation into a ucar.unidata.geoloc.LatLonPoint
|
static ucar.unidata.geoloc.LatLonPoint |
toLLP(visad.georef.LatLonPoint llp)
Convert the visad LatLonPoint to a unidata.geoloc.LatLonPoint
|
static visad.Real |
toReal(java.lang.String value)
Parses the given String and returns the Real (if possible)
that the string represents.
|
static visad.Real |
toReal(java.lang.String value,
java.lang.String unitOpener,
java.lang.String unitCloser)
Create a Real from a string value
|
static visad.Data |
vetType(visad.MathType type,
visad.Data data)
Vets a data object against a MathType.
|
public static final java.lang.String TEXT_IDENTIFIER
public static java.lang.String REALTYPE_ROOT
protected static visad.Unit[] getDefaultUnits(visad.FlatField field, int[] indexes, visad.RealType[] types) throws java.lang.IllegalArgumentException, visad.TypeException, visad.VisADException
field
- The field to be examined.indexes
- Indexes of the components in the range of the
field.types
- Expected, compatible types for the components.java.lang.IllegalArgumentException
- field == null ||
indexes.length != types.length
,
or indexes out-of-bounds.visad.TypeException
- Type of component in range of field not
compatible with expected type.visad.VisADException
- Couldn't create necessary VisAD object.public static visad.RealType clone(visad.RealType realType, java.lang.String name) throws visad.VisADException
realType
- The realtype to be cloned.name
- The new name for the clone.visad.VisADException
- Couldn't create necessary VisAD object.public static boolean isCompatible(visad.Data data, visad.MathType type) throws visad.VisADException, java.rmi.RemoteException
Data
object is compatible with a MathType
.data
- The Data
object.type
- The MathType
.true
if and only if the given
Data
object is compatible with the given
MathType
.visad.VisADException
- if a VisAD failure occurs.java.rmi.RemoteException
- if a Java RMI failure occurs.public static visad.Data vetType(visad.MathType type, visad.Data data) throws visad.TypeException, visad.VisADException, java.rmi.RemoteException
This method should probably become MathType.vet(Data).
type
- The MathType that the data object must be
compatible with.data
- The data object.data
(as a programming
convenience).visad.TypeException
- The MathType and data object are incompatible.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.RealType ensureUnit(visad.RealType type, visad.Unit u) throws visad.VisADException
type
- RealType to checku
- unit to checkvisad.VisADException
- couldn't get a new RealTypepublic static java.lang.String getCompatibleUnitName(visad.Unit u)
u
- Unitpublic static java.lang.String cleanName(java.lang.String name)
name
- name to cleanpublic static visad.RealType[] ensureUnit(visad.RealType[] types, visad.Unit u) throws visad.VisADException
types
- array of RealTypes to checku
- unit to checkvisad.VisADException
- couldn't get a new RealTypepublic static visad.Data ensureMathType(visad.Data data, visad.MathType type) throws visad.UnimplementedException, visad.VisADException, java.rmi.RemoteException
This method should probably become "abstract Data Data.ensureMathType(MathType)" with subclass-dependent implementations.
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.visad.UnimplementedException
- Method not yet implemented.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.Field ensureDomain(visad.Field field, visad.Set domain) throws visad.UnimplementedException, visad.VisADException, java.rmi.RemoteException
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.visad.UnimplementedException
- Can't yet clone the class of the Field.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.Field ensureDomain(visad.Field field, visad.RealTupleType newDomainType, visad.CoordinateSystem coordinateSystem) throws visad.UnimplementedException, visad.VisADException, java.rmi.RemoteException
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
.visad.UnimplementedException
- Can't yet clone the class of the Field.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.Field ensureTupleRange(visad.Field field) throws java.rmi.RemoteException, visad.VisADException
field
- The Field.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.Field clone(visad.Field field, visad.Set domain) throws visad.UnimplementedException, visad.VisADException, java.rmi.RemoteException
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.visad.UnimplementedException
- Can't yet clone the class of the Field.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.Field clone(visad.Field field, visad.Set domain, boolean copyRange) throws visad.UnimplementedException, visad.VisADException, java.rmi.RemoteException
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.visad.UnimplementedException
- Can't yet clone the class of the Field.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.FlatField clone(visad.FlatField flatField, visad.Set domain, boolean copyRange) throws visad.VisADException, java.rmi.RemoteException
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.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.Field convertDomain(visad.Field field, visad.RealTupleType newDomainType, visad.CoordinateSystem coordinateSystem) throws visad.UnimplementedException, visad.VisADException, java.rmi.RemoteException
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
.visad.UnimplementedException
- Can't yet clone the class of the Field.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.FlatField convertDomain(visad.FlatField field, visad.RealTupleType newDomainType, visad.CoordinateSystem coordinateSystem) throws visad.VisADException, java.rmi.RemoteException
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
.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.SampledSet convertDomain(visad.SampledSet oldDomain, visad.RealTupleType newDomainType, visad.CoordinateSystem coordinateSystem) throws visad.VisADException, java.rmi.RemoteException
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
.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.SampledSet newSampledSet(visad.SampledSet oldSampledSet, float[][] newValues, int[] manifoldLengths) throws visad.VisADException, java.rmi.RemoteException
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.visad.VisADException
- Couldn't perform necessary VisAD operation.java.rmi.RemoteException
- Java RMI failure.public static visad.SampledSet newSampledSet(visad.SampledSet oldSampledSet, double[][] newValues, int[] manifoldLengths) throws visad.VisADException, java.rmi.RemoteException
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.visad.VisADException
- Couldn't perform necessary VisAD operation.java.rmi.RemoteException
- Java RMI failure.public static visad.SampledSet newSampledSet(visad.SampledSet oldSampledSet, visad.RealTupleType newSampledSetType, float[][] newValues, visad.CoordinateSystem coordinateSystem, visad.Unit[] newUnits, visad.ErrorEstimate[] newErrors) throws visad.VisADException, java.rmi.RemoteException
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.visad.VisADException
- Couldn't perform necessary VisAD operation.java.rmi.RemoteException
- Java RMI failure.public static visad.SampledSet newSampledSet(visad.SampledSet oldSampledSet, visad.RealTupleType newSampledSetType, double[][] newValues, visad.CoordinateSystem coordinateSystem, visad.Unit[] newUnits, visad.ErrorEstimate[] newErrors) throws visad.VisADException, java.rmi.RemoteException
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.visad.VisADException
- Couldn't perform necessary VisAD operation.java.rmi.RemoteException
- Java RMI failure.public static visad.SampledSet newSampledSet(int[] manifoldLengths, visad.RealTupleType newSampledSetType, double[][] newValues, visad.CoordinateSystem coordinateSystem, visad.Unit[] newUnits, visad.ErrorEstimate[] newErrors) throws visad.VisADException, java.rmi.RemoteException
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.visad.VisADException
- Couldn't perform necessary VisAD operation.java.rmi.RemoteException
- Java RMI failure.public static visad.SampledSet newSampledSet(int[] manifoldLengths, visad.RealTupleType newSampledSetType, float[][] newValues, visad.CoordinateSystem coordinateSystem, visad.Unit[] newUnits, visad.ErrorEstimate[] newErrors) throws visad.VisADException, java.rmi.RemoteException
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.visad.VisADException
- Couldn't perform necessary VisAD operation.java.rmi.RemoteException
- Java RMI failure.public static visad.CoordinateSystem getRangeCoordinateSystem(visad.Field field) throws visad.VisADException, java.rmi.RemoteException
field
- The Field.null
.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.CoordinateSystem[] getRangeCoordinateSystems(visad.Field field) throws visad.VisADException, java.rmi.RemoteException
field
- The Field.null
.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.Unit[] getRangeUnits(visad.FlatField field)
field
- The FlatField.null
.public static visad.Unit[] getDefaultRangeUnits(visad.FieldImpl field)
field
- The FlatField.null
.public static visad.Data clone(visad.Data data, visad.MathType type) throws visad.UnimplementedException, visad.VisADException, java.rmi.RemoteException
This method should probably become "abstract Data Data.clone(MathType)" with subclass-dependent implementations.
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.visad.UnimplementedException
- Method not yet implemented.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.Set getDomainSet(visad.Field field)
field
- The fieldpublic static visad.Set getDomainSetForClone(visad.Field field)
field
- the fieldpublic static visad.Data clone(visad.Data data, visad.MathType type, boolean unitOverride, boolean copy) throws visad.UnimplementedException, visad.VisADException, java.rmi.RemoteException
This method should probably become "abstract Data Data.clone(MathType)" with subclass-dependent implementations.
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.unitOverride
- if the units are not compatible, if true,
assume values are in units of new type.copy
- if true, copy the data values for Fields.visad.UnimplementedException
- Method not yet implemented.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.Data clone(visad.Data data, visad.MathType type, boolean unitOverride, boolean copy, boolean copyDomain) throws visad.UnimplementedException, visad.VisADException, java.rmi.RemoteException
This method should probably become "abstract Data Data.clone(MathType)" with subclass-dependent implementations.
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.unitOverride
- if the units are not compatible, if true,
assume values are in units of new type.copy
- if true, copy the data values for Fields.copyDomain
- if true, make a copy of the domain as wellvisad.UnimplementedException
- Method not yet implemented.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.Set ensureCoordinateSystem(visad.Set set, visad.CoordinateSystem coordSys) throws visad.UnimplementedException, visad.VisADException, java.rmi.RemoteException
This method should probably become "abstract Set Set.ensureCoordinateSystem(CoordinateSystem)".
set
- The set.coordSys
- The CoordinateSystem for the returned Set. May
be null
.set
with the given
coordinate system. Clones the set only if
necessary.visad.UnimplementedException
- Can't clone set.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.Set clone(visad.Set set, visad.CoordinateSystem coordSys) throws visad.UnimplementedException, visad.VisADException, java.rmi.RemoteException
This method should probably become "abstract Set Set.clone(CoordinateSystem)".
set
- The set to be cloned.coordSys
- The CoordinateSystem for the returned Set. May
be null
.set
but with the given
CoordinateSystem.visad.UnimplementedException
- Method not yet implemented for particular set.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.SampledSet getRangeSampledSet(visad.Field field, visad.MathType type) throws visad.VisADException, java.rmi.RemoteException
field
- The field to have a component extracted.type
- The MathType of the component to be
extracted.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.FlatField ensureFlatFieldRangeType(visad.FlatField flatField, visad.RealType realType) throws visad.VisADException, java.rmi.RemoteException
flatField
- The FlatField to have it's range be
type
.realType
- The type for the returned FlatField.flatFieldield
with
realType
as the MathType of the
range. May be flatField
.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.SampledSet newSampledSet(visad.MathType type, float[][] values, int[] manifoldLengths, visad.CoordinateSystem coordinateSystem, visad.Unit[] units, visad.ErrorEstimate[] errors, boolean copy) throws visad.VisADException, java.rmi.RemoteException
type
- The type for the SampledSet.values
- The values for the SampledSet.manifoldLengths
- The dimensionality of the manifold with the
first element corresponding to the innermost
manifold dimension. Ignored if the values
constitute a single data point. May be
null
, in which case the manifold
is assumed to be 1-dimensional and the
resulting set will be an IrregularSet. If non-
null
, then the resulting set will
be a GriddedSet.coordinateSystem
- The coordinate system transformation for the
SampledSet. May be null
.units
- The units of the values. May be
null
.errors
- The uncertainty of the values. May be
null
.copy
- Whether or not to copy the values.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static visad.RealTuple getSample(visad.Set set, int index) throws visad.VisADException, java.rmi.RemoteException
set
- The set to have a sample returned.index
- The index of the sample to be returned.visad.VisADException
- Couldn't create necessary VisAD object.java.rmi.RemoteException
- Java RMI failure.public static float[] take(float[] values, int[] indexes)
values
- The input array of values.indexes
- Which elements to extract.public static double[] take(double[] values, int[] indexes)
values
- The input array of values.indexes
- Which elements to extract.public static boolean isSorted(float[] values)
values
- The array to check.public static boolean isSorted(double[] values)
values
- The array to check.public static boolean isStrictlySorted(float[] values)
values
- The array to check.public static boolean isStrictlySorted(double[] values)
values
- The array to check.public static int[] sortedIndexes(float[] values, boolean increasing)
values
- The array to examine.increasing
- Whether the sort is to be increasing or decreasing.public static int[] sortedIndexes(double[] values, boolean increasing)
values
- The array to examine.increasing
- Whether the sort is to be increasing or decreasing.public static int[] strictlySortedIndexes(float[] values, boolean increasing)
values
- The array to examine.increasing
- Whether the sort is to be increasing or decreasing.public static int[] strictlySortedIndexes(double[] values, boolean increasing)
values
- The array to examine.increasing
- Whether the sort is to be increasing or decreasing.public static visad.RealType getRealType(visad.RealTupleType type, java.lang.String start) throws visad.VisADException
type
- type to searchstart
- starting characters of name. This is useful when
Plain import creates names like "pres_0"visad.VisADException
public static visad.Unit parseUnit(java.lang.String unitIdentifier) throws visad.VisADException
unitIdentifier
- unit specificationvisad.VisADException
- problem parsing unitpublic static visad.Unit parseUnit(java.lang.String unitIdentifier, java.lang.String unitName) throws visad.VisADException
unitIdentifier
- unit specificationunitName
- Name to clone unit withvisad.VisADException
- problem parsing unitpublic static java.lang.String formatUtcDate(visad.DateTime dt, java.lang.String pattern)
dt
- DateTime objectpattern
- format patternpublic static java.util.Date makeDate(visad.DateTime dttm) throws visad.VisADException
dttm
- DateTime to usevisad.VisADException
- problem converting unitspublic static visad.DateTime getGregorianDateTime(java.util.TimeZone zone, int year, int month, int day, int hour, int min, int sec) throws visad.VisADException
zone
- timezone to usevisad.VisADException
- problem converting unitspublic static java.util.List<java.util.Date> makeDates(visad.DateTime[] timesArray) throws visad.VisADException
timesArray
- array of DateTimesvisad.VisADException
- problem createing the datespublic static visad.Real toReal(java.lang.String value) throws java.lang.Exception
dddd dddd unit dddd[unit] dddd(unit) dddd{unit} dddd
value
- The string valuejava.lang.Exception
- problem with unit spec or parsing.public static visad.Real toReal(java.lang.String value, java.lang.String unitOpener, java.lang.String unitCloser) throws java.lang.Exception
value
- numeric valueunitOpener
- character for start of Unit specunitCloser
- character for end of Unit specjava.lang.Exception
- problem parsing the strings or creating the Realpublic static double distance(visad.georef.LatLonPoint p1, visad.georef.LatLonPoint p2)
p1
- Point 1p2
- Point 2public static ucar.unidata.geoloc.LatLonPointImpl toLatLonPoint(visad.georef.LatLonPoint llp) throws visad.VisADException
llp
- the LatLonPointvisad.VisADException
- problem getting values from LatLonPointpublic static ucar.unidata.geoloc.Bearing calculateBearing(visad.georef.LatLonPoint pt1, visad.georef.LatLonPoint pt2, ucar.unidata.geoloc.Bearing result) throws visad.VisADException
pt1
- Point 1pt2
- Point 2result
- Object to use if non-nullvisad.VisADException
- When pt2 cannot be converted to the unit of pt1public static ucar.unidata.geoloc.Bearing calculateBearing(visad.georef.LatLonPoint pt1, visad.georef.LatLonPoint pt2) throws visad.VisADException
pt1
- Point 1pt2
- Point 2visad.VisADException
- When pt2 cannot be converted to the unit of pt1public static java.lang.String formatReal(visad.Real r)
r
- real to formatpublic static TwoFacedObject labeledReal(visad.Real r)
r
- real to wrappublic static TwoFacedObject labeledReal(visad.Real r, boolean includeUnit)
r
- real to wrapincludeUnit
- if true, add the unit to the labelpublic static visad.FieldImpl indexedField(visad.Data[] datas, boolean copy) throws visad.VisADException, java.rmi.RemoteException
datas
- Data objects for range. Must all be of same type.copy
- true to copy data.java.rmi.RemoteException
- Java RMI problemvisad.VisADException
- problem creating fieldpublic static void main(java.lang.String[] args)
args
- cmd line argspublic static visad.Real bearingDistance(visad.georef.EarthLocation el1, visad.georef.EarthLocation el2) throws java.lang.Exception
el1
- start locationel2
- end locationjava.lang.Exception
- problem calculating the distancepublic static double getValueAs(visad.Real r, java.lang.String unitString) throws visad.VisADException, java.rmi.RemoteException
r
- RealunitString
- string representation of the return Unitjava.rmi.RemoteException
- Java RMI Exceptionvisad.VisADException
- Unit problempublic static visad.Real getReal(double value, java.lang.String unitString) throws visad.VisADException, java.rmi.RemoteException
value
- the valueunitString
- the Unitjava.rmi.RemoteException
- Java RMI Exceptionvisad.VisADException
- Unit problempublic static visad.Real getReal(double value, visad.Unit unit) throws visad.VisADException, java.rmi.RemoteException
value
- the valueunit
- the Unitjava.rmi.RemoteException
- Java RMI Exceptionvisad.VisADException
- Unit problempublic static visad.RealType getRealType(visad.Unit unit) throws visad.VisADException, java.rmi.RemoteException
unit
- unitjava.rmi.RemoteException
- Java RMI Exceptionvisad.VisADException
- Unit problempublic static double[] getRayPositionAtZ(visad.VisADRay ray, double zValue)
ray
- ray to usezValue
- Z valuepublic static java.lang.String cleanTypeName(java.lang.String name)
name
- Initial real type namepublic static java.lang.String cleanTypeName(visad.MathType mathType)
mathType
- the typepublic static int getIndex(visad.TupleType tupleType, java.lang.String lookingFor)
tupleType
- Tuple typelookingFor
- String to search forpublic static visad.RealType makeRealType(java.lang.String name, visad.Unit unit) throws visad.VisADException
name
- name of typeunit
- can be nullvisad.VisADException
- unable to create the RealType (shouldn't happen)public static visad.RealType makeRealType(java.lang.String name, java.lang.String alias, visad.Unit unit) throws visad.VisADException
name
- name of the RealTypealias
- the aliasunit
- the default unitvisad.VisADException
- problem creating the RealTypepublic static java.lang.String formatLatLonPoint(visad.georef.LatLonPoint llp)
llp
- LatLonPoint to formatpublic static visad.georef.EarthLocation makeEarthLocation(double lat, double lon) throws java.lang.Exception
lat
- latitudelon
- longitudejava.lang.Exception
- problem creating earth locationpublic static visad.georef.EarthLocation makeEarthLocation(double lat, double lon, double alt) throws java.lang.Exception
lat
- latitudelon
- longitudealt
- longitudejava.lang.Exception
- problem creating earth locationpublic static visad.georef.EarthLocation makeEarthLocation(visad.georef.LatLonPoint llp) throws java.lang.Exception
llp
- lat/lonjava.lang.Exception
- problem creating earth locationpublic static java.lang.String formatEarthLocation(visad.georef.EarthLocation el, boolean includeAlt)
el
- EarthLocation to formatincludeAlt
- include Altitude in the returnpublic static java.lang.String formatAltitude(visad.Real alt)
alt
- The altitudepublic static void dumpTypes(visad.Data d) throws visad.VisADException
d
- the Data objectvisad.VisADException
- problem dumping the datapublic static double[] getVWorldCoords(visad.DisplayImpl display, int x, int y, double[] retVals)
display
- the displayx
- the canvas X coordinatey
- the canvas Y coordinateretVals
- the return array (may be null)public static visad.FlatField makeField(java.awt.Image image, boolean makeNansForAnyAlpha) throws java.io.IOException, visad.VisADException
image
- image to usemakeNansForAnyAlpha
- If true then we make a field with an alpha
value and we turn the other values into nan-sjava.io.IOException
- problem reading the imagevisad.VisADException
- problem creating the FlatFieldpublic static visad.FlatField makeField(java.awt.Image image, float alphaThreshold) throws java.io.IOException, visad.VisADException
image
- image to usealphaThreshold
- If there is an alpha channel in the image then set the field value to nan
for any alhpa greater than the given threshold. Do nothing if threshold<0
value and we turn the other values into nan-sjava.io.IOException
- problem reading the imagevisad.VisADException
- problem creating the FlatFieldpublic static visad.FlatField makeField(java.awt.Image image, float alphaThreshold, boolean makeAlpha) throws java.io.IOException, visad.VisADException
image
- image to usealphaThreshold
- If there is an alpha channel in the image then set the field value to nan
for any alhpa greater than the given threshold. Do nothing if threshold<0
value and we turn the other values into nan-smakeAlpha
- if true, make an alpha channel as welljava.io.IOException
- problem reading the imagevisad.VisADException
- problem creating the FlatFieldpublic static visad.FlatField makeField(java.awt.Image image, float alphaThreshold, boolean makeAlpha, boolean incNames) throws java.io.IOException, visad.VisADException
image
- image to usealphaThreshold
- If there is an alpha channel in the image then set the field value to nan
for any alhpa greater than the given threshold. Do nothing if threshold<0
value and we turn the other values into nan-smakeAlpha
- if true, make an alpha channel as wellincNames
- if true, make new namesjava.io.IOException
- problem reading the imagevisad.VisADException
- problem creating the FlatFieldpublic static visad.georef.MapProjection makeMapProjection(double lat1, double lon1, double lat2, double lon2) throws visad.VisADException
lat1
- lower left latitudelon1
- lower left longitudelat2
- upper right latitudelon2
- upper right longitudevisad.VisADException
- problem creating the map projectionvisad.VisADException
- problem making projectionpublic static visad.georef.MapProjection makeMapProjection(double lat1, double lon1, double lat2, double lon2, boolean makeSquare) throws visad.VisADException
lat1
- min latitudelon1
- min longitudelat2
- max latitudelon2
- max longitudemakeSquare
- if true, normalize to a squarevisad.VisADException
- problem making the projection or invalid inputpublic static boolean propertySet(java.lang.Object object, java.lang.String name, java.lang.Object value, boolean ignoreError) throws java.lang.Exception
object
- The object to invoke the set property method on.name
- The name of the method.value
- The String representation of the value to set.ignoreError
- If true then don't print out an errorjava.lang.Exception
- problem setting the propertypublic static visad.Data makeTimeField(visad.Data range, java.util.List times) throws visad.VisADException, java.rmi.RemoteException
range
- The rangetimes
- List of timesjava.rmi.RemoteException
- Java RMI problemvisad.VisADException
- VisAD problempublic static visad.FieldImpl makeTimeField(java.util.List ranges, java.util.List times) throws visad.VisADException, java.rmi.RemoteException
ranges
- ranges for each timetimes
- list of timesjava.rmi.RemoteException
- Java RMI problemvisad.VisADException
- VisAD problempublic static visad.FieldImpl[] makeTimeField(visad.Data[] ranges, java.lang.Object time) throws visad.VisADException, java.rmi.RemoteException
ranges
- ranges for each timetime
- list of timesjava.rmi.RemoteException
- Java RMI problemvisad.VisADException
- VisAD problempublic static visad.Data makeTimeRangeField(visad.Data range, java.util.List times) throws visad.VisADException, java.rmi.RemoteException
range
- The rangetimes
- List of timesjava.rmi.RemoteException
- Java RMI problemvisad.VisADException
- VisAD problempublic static int findIndex(visad.Set set, visad.Real value) throws visad.VisADException, java.rmi.RemoteException
set
- the setvalue
- the valuejava.rmi.RemoteException
- Java RMI problemvisad.VisADException
- VisAD problempublic static java.util.List toList(visad.Set set) throws visad.VisADException, java.rmi.RemoteException
set
- The setjava.rmi.RemoteException
- Java RMI problemvisad.VisADException
- VisAD problempublic static visad.Set makeTimeSet(java.util.List times) throws visad.VisADException, java.rmi.RemoteException
times
- the timesjava.rmi.RemoteException
- Java RMI problemvisad.VisADException
- VisAD problempublic static boolean exportAsNetcdf(visad.Data data) throws java.lang.Exception
data
- the VisAD data to exportjava.lang.Exception
- can't write data as netCDFpublic static visad.FlatField makeField(float lon1, float lon2, int length1, float lat1, float lat2, int length2, float fill, java.lang.String unitString) throws visad.VisADException, java.rmi.RemoteException
lon1
- longitude 1lon2
- longitude 2length1
- number of lon pointslat1
- lat 1lat2
- lat 2length2
- number of lat pointsfill
- the fill value for the rangeunitString
- the unitjava.rmi.RemoteException
- on badnessvisad.VisADException
- on badnesspublic static visad.GriddedSet makeEarthDomainSet(float[] lats, float[] lons, float[] alts) throws visad.VisADException
lats
- the latslons
- the lonsalts
- the (possibly null) altitudesvisad.VisADException
- on badnesspublic static visad.GriddedSet makeEarthDomainSet(float[] lats, float[] lons, float[] alts, visad.Unit[] units) throws visad.VisADException
lats
- the latslons
- the lonsalts
- the (possibly null) altitudesvisad.VisADException
- on badnesspublic static ucar.unidata.geoloc.LatLonPoint toLLP(visad.georef.EarthLocation el)
el
- the earth locationpublic static ucar.unidata.geoloc.LatLonPoint toLLP(visad.georef.LatLonPoint llp)
llp
- the visad llppublic static Range convertRange(Range range, visad.Unit rangeUnit, visad.Unit outUnit)
range
- data rangerangeUnit
- the unit for the rangeoutUnit
- the converted unitpublic static boolean allMissing(visad.RealTuple rt)
rt
- RealTuple in questionpublic static double[] performRotationAboutArbitraryVector(visad.MouseBehavior mouse, double[] initialTransFormMatrix, double angle, double axisIComp, double axisJComp, double axisKComp, double offsetIComp, double offsetJComp, double offsetKComp)
mouse
- MouseBehavior for matrix manipulationinitialTransFormMatrix
- the initial matrixangle
- the angle of rotationaxisIComp
- i component of the axisaxisJComp
- j component of the axisaxisKComp
- k component of the axisoffsetIComp
- offset i componentoffsetJComp
- offset j componentoffsetKComp
- offset k componentpublic static boolean isEarthCoordinates(visad.RealTuple position)
position
- the positionpublic static void setGlobeRadius(float[] position, float radius)
position
- the positionradius
- the radiuspublic static void printData(visad.Data d)
d
- the Data to printpublic static void printDataType(visad.Data d)
d
- the Data to print