Package ucar.visad
Class Util
java.lang.Object
ucar.visad.Util
Provides support for utility functions.
- Version:
- $Revision: 1.81 $ $Date: 2007/08/19 15:55:31 $
- Author:
- Unidata Development Team
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
allMissing
(RealTuple rt) Check to see if a RealTuple is all missing data.static Real
bearingDistance
(EarthLocation el1, EarthLocation el2) Return the distance from a bearing as Realstatic ucar.unidata.geoloc.Bearing
calculateBearing
(LatLonPoint pt1, LatLonPoint pt2) Calculate the bearing between the 2 points.static ucar.unidata.geoloc.Bearing
calculateBearing
(LatLonPoint pt1, LatLonPoint pt2, ucar.unidata.geoloc.Bearing result) Calculate the bearing between the 2 points.static String
Make a valid VisAD RealType name from the string.static String
cleanTypeName
(String name) A utility to strip off the unit name that gets appended to the real type name.static String
cleanTypeName
(MathType mathType) Remove any of the extra unit suffixes that get added to the type namestatic Data
Clones a data object, replacing the MathType.static Data
Clones a data object, replacing the MathType.static Data
Clones a data object, replacing the MathType.static Field
Clones a Field replacing the domain Set and copying the range values.static Field
Clones a Field replacing the domain Set.static FlatField
Clones a FlatField replacing the domain Set.static RealType
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 Range
convertRange
(Range range, Unit rangeUnit, Unit outUnit) Utility to convert the given raw data range into the other unitsstatic double
distance
(LatLonPoint p1, LatLonPoint p2) Return the distance between the 2 pointsstatic void
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 filestatic int
Find the index of a value in a Setstatic String
formatAltitude
(Real alt) Format an Altitudestatic String
formatEarthLocation
(EarthLocation el, boolean includeAlt) Format a EarthLocation as a lat/lon/(alt) string.static String
Format an LatLonPoint as a lat/lon string.static String
formatReal
(Real r) Format a real value to a nice looking numberstatic String
formatUtcDate
(DateTime dt, String pattern) Return a formated date in UTC time.static String
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 Set
getDomainSet
(Field field) Utility method to get the domain set from the given field.static Set
getDomainSetForClone
(Field field) Get the domain for cloningstatic DateTime
getGregorianDateTime
(TimeZone zone, int year, int month, int day, int hour, int min, int sec) Make a datetime from a year,...static int
Find the index of the MathType in the given tuple type whose cleaned name is equals to the lookingFor parameter.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
Get a Real with the specified value and Unitstatic Real
Get a Real with the specified value and Unitstatic 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 unitstatic RealTuple
Gets the specified sample of a VisAD Set.static double
getValueAs
(Real r, String unitString) Get the value of a Real in the unit specifiedstatic double[]
getVWorldCoords
(DisplayImpl display, int x, int y, double[] retVals) Get the VisAD Virtual World x,y coordinates for the given screen coordsstatic 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) static boolean
isEarthCoordinates
(RealTuple position) Check if these are earth coordinatesstatic 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
(Real r) Wrap a Real as a TwoFacedObject with a formatted labelstatic TwoFacedObject
labeledReal
(Real r, boolean includeUnit) Wrap a Real as a TwoFacedObject with a formatted labelstatic void
Teststatic Date
Make a date from a DateTimeMake a list of Date object from the array of DateTime'sstatic 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 typestatic GriddedSet
makeEarthDomainSet
(float[] lats, float[] lons, float[] alts, 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 typestatic EarthLocation
makeEarthLocation
(double lat, double lon) Utility to make an earth location with a 0 altitudestatic EarthLocation
makeEarthLocation
(double lat, double lon, double alt) Utility to make an earth location with a altitudestatic EarthLocation
Utility to make an earth location with a 0 altitudestatic FlatField
makeField
(float lon1, float lon2, int length1, float lat1, float lat2, int length2, float fill, String unitString) this makes a empty flat field with the given lat/lon bounds and lengths, the given fill value and the unitstatic FlatField
Create a VisAD Data object from the given Imagestatic FlatField
Create a VisAD Data object from the given Imagestatic FlatField
Create a VisAD Data object from the given Imagestatic FlatField
Create a VisAD Data object from the given Imagestatic MapProjection
makeMapProjection
(double lat1, double lon1, double lat2, double lon2) Make a map projection from the pointsstatic MapProjection
makeMapProjection
(double lat1, double lon1, double lat2, double lon2, boolean makeSquare) Make a map projection from the boundsstatic RealType
makeRealType
(String name, String alias, Unit unit) Make a RealTypestatic RealType
makeRealType
(String name, Unit unit) Create a RealType from the name and unit.static FieldImpl
makeTimeField
(List ranges, List times) Make a time fieldstatic FieldImpl[]
makeTimeField
(Data[] ranges, Object time) Make a time fieldstatic Data
makeTimeField
(Data range, List times) This makes a field of T->range for the times in the list.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) Make a time set from a list of timesstatic 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
Parse a unit string specification and return the appropriate unit.static Unit
Parse a unit string specification and return the appropriate unit.static double[]
performRotationAboutArbitraryVector
(MouseBehavior mouse, double[] initialTransFormMatrix, double angle, double axisIComp, double axisJComp, double axisKComp, double offsetIComp, double offsetJComp, double offsetKComp) Perform rotation about an arbitrary vectorstatic void
Print out the data summary.static void
Print out the data type summary.static boolean
propertySet
(Object object, String name, 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 positionstatic 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
(LatLonPoint llp) Create a LatLonPointImpl from the VisAD LatLonPointstatic List
Convert the elements in the set to a Liststatic ucar.unidata.geoloc.LatLonPoint
toLLP
(EarthLocation el) convert the visad EarthLocation into a ucar.unidata.geoloc.LatLonPointstatic ucar.unidata.geoloc.LatLonPoint
toLLP
(LatLonPoint llp) Convert the visad LatLonPoint to a unidata.geoloc.LatLonPointstatic Real
Parses the given String and returns the Real (if possible) that the string represents.static Real
Create a Real from a string valuestatic Data
Vets a data object against a MathType.
-
Field Details
-
TEXT_IDENTIFIER
The suffix added to text type names- See Also:
-
REALTYPE_ROOT
The default root name for generic RealTypes
-
-
Method Details
-
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
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
- Parameters:
data
- TheData
object.type
- TheMathType
.- Returns:
true
if and only if the givenData
object is compatible with the givenMathType
.- 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
Ensure that the units for the RealType are compatible with the given unit.- Parameters:
type
- RealType to checku
- unit to check- Returns:
- the original RealType or a RealType with compatible units.
- Throws:
VisADException
- couldn't get a new RealType
-
getCompatibleUnitName
Replace illegal RealType characters in a Unit spec with underscores.- Parameters:
u
- Unit- Returns:
- a compatible unit name
-
cleanName
Make a valid VisAD RealType name from the string. Remove spaces, "." and parens.- Parameters:
name
- name to clean- Returns:
- cleaned up name
-
ensureUnit
Ensure that the units for the array of RealTypes are compatible with the given unit.- Parameters:
types
- array of RealTypes to checku
- 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 withnewDomainType
, form the basis for the desired domain. May benull
.- 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
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
- Iftrue
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
- Iftrue
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 withnewDomainType
, form the basis for the desired domain. May benull
.- 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 withnewDomainType
, form the basis for the desired domain. May benull
.- 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 withnewDomainType
, form the basis for the desired domain. May benull
.- 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 benull
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 benull
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 benull
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 benull
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
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
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.
-
getDomainSet
Utility method to get the domain set from the given field. This is a bit of a hack in that it checks if the field is a AreaImageFlatField. If it is then call a special getDomainSetNoRead method- Parameters:
field
- The field- Returns:
- Its domain set
-
getDomainSetForClone
Get the domain for cloning- Parameters:
field
- the field- Returns:
- the domain
-
clone
public static Data clone(Data data, MathType type, boolean unitOverride, boolean copy) 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.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.- 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 clone(Data data, MathType type, boolean unitOverride, boolean copy, boolean copyDomain) 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.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 well- 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.
-
ensureCoordinateSystem
public static Set ensureCoordinateSystem(Set set, CoordinateSystem coordSys) throws UnimplementedException, VisADException, RemoteException Ensures that a set has a particular CoordinateSystem. Clones the set only if necessaryThis method should probably become "abstract Set Set.ensureCoordinateSystem(CoordinateSystem)".
- Parameters:
set
- The set.coordSys
- The CoordinateSystem for the returned Set. May benull
.- Returns:
- A set like
set
with the given coordinate system. Clones the set only if necessary. - Throws:
UnimplementedException
- Can't clone set.VisADException
- Couldn't create necessary VisAD object.RemoteException
- Java RMI failure.
-
clone
public static Set clone(Set set, CoordinateSystem coordSys) throws UnimplementedException, VisADException, RemoteException Clones a set, replacing the CoordinateSystem.This method should probably become "abstract Set Set.clone(CoordinateSystem)".
- Parameters:
set
- The set to be cloned.coordSys
- The CoordinateSystem for the returned Set. May benull
.- Returns:
- A clone of
set
but with the given CoordinateSystem. - Throws:
UnimplementedException
- Method not yet implemented for particular set.VisADException
- Couldn't create necessary VisAD object.RemoteException
- Java RMI failure.
-
getRangeSampledSet
public static SampledSet getRangeSampledSet(Field field, MathType type) throws VisADException, RemoteException Extracts the given range component from a Field as a SampledSet.- Parameters:
field
- The field to have a component extracted.type
- The MathType of the component to be extracted.- Returns:
- The SampledSet of component values.
- Throws:
VisADException
- Couldn't create necessary VisAD object.RemoteException
- Java RMI failure.
-
ensureFlatFieldRangeType
public static FlatField ensureFlatFieldRangeType(FlatField flatField, RealType realType) throws VisADException, RemoteException Ensures that the MathType of the range of a FlatField is a specified RealType. Clones the FlatField only if necessary.- Parameters:
flatField
- The FlatField to have it's range betype
.realType
- The type for the returned FlatField.- Returns:
- A FlatField identical to
flatFieldield
withrealType
as the MathType of the range. May beflatField
. - Throws:
VisADException
- Couldn't create necessary VisAD object.RemoteException
- Java RMI failure.
-
newSampledSet
public static SampledSet newSampledSet(MathType type, float[][] values, int[] manifoldLengths, CoordinateSystem coordinateSystem, Unit[] units, ErrorEstimate[] errors, boolean copy) throws VisADException, RemoteException Creates a new SampledSet.- Parameters:
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 benull
, 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 benull
.units
- The units of the values. May benull
.errors
- The uncertainty of the values. May benull
.copy
- Whether or not to copy the values.- Returns:
- A SampledSet with the given attributes.
- Throws:
VisADException
- Couldn't create necessary VisAD object.RemoteException
- Java RMI failure.
-
getSample
Gets the specified sample of a VisAD Set.- Parameters:
set
- The set to have a sample returned.index
- The index of the sample to be returned.- Returns:
- The sample at the specified index. Will be empty if the index is out-of-bounds. Will have a single component if the set is one-dimensional.
- Throws:
VisADException
- Couldn't create necessary VisAD object.RemoteException
- Java RMI failure. deprecated use visad.util.DataUtility.getSample() now
-
take
public static float[] take(float[] values, int[] indexes) Takes indicated values from an array.- Parameters:
values
- The input array of values.indexes
- Which elements to extract.- Returns:
- A new array with the indicated elements.
-
take
public static double[] take(double[] values, int[] indexes) Takes indicated values from an array.- Parameters:
values
- The input array of values.indexes
- Which elements to extract.- Returns:
- A new array with the indicated elements.
-
isSorted
public static boolean isSorted(float[] values) Indicates if an array is sorted. The sense (increasing or decreasing) is irrelevant and is non-strict.- Parameters:
values
- The array to check.- Returns:
- True if and only if the array is sorted.
-
isSorted
public static boolean isSorted(double[] values) Indicates if an array is sorted. The sense (increasing or decreasing) is irrelevant and is non-strict.- Parameters:
values
- The array to check.- Returns:
- True if and only if the array is sorted.
-
isStrictlySorted
public static boolean isStrictlySorted(float[] values) Indicates if an array is strictly sorted. The sense (increasing or decreasing) is irrelevant.- Parameters:
values
- The array to check.- Returns:
- True if and only if the array is strictly sorted.
-
isStrictlySorted
public static boolean isStrictlySorted(double[] values) Indicates if an array is strictly sorted. The sense (increasing or decreasing) is irrelevant.- Parameters:
values
- The array to check.- Returns:
- True if and only if the array is strictly sorted.
-
sortedIndexes
public static int[] sortedIndexes(float[] values, boolean increasing) Returns the element indexes that would sort an array. The first elements of the output index array will index the NaN-s in the input array, if any.- Parameters:
values
- The array to examine.increasing
- Whether the sort is to be increasing or decreasing.- Returns:
- The indexes of the elements that would sort the array when taken in order. The first indexes will index the NaN-s of the input array, if any.
-
sortedIndexes
public static int[] sortedIndexes(double[] values, boolean increasing) Returns the element indexes that would sort an array. The first elements of the output index array will index the NaN-s in the input array, if any.- Parameters:
values
- The array to examine.increasing
- Whether the sort is to be increasing or decreasing.- Returns:
- The indexes of the elements that would sort the array when taken in order. The first indexes will index the NaN-s of the input array, if any.
-
strictlySortedIndexes
public static int[] strictlySortedIndexes(float[] values, boolean increasing) Returns the element indexes that would strictly sort an array. Nan-s in the input array will be ignored.- Parameters:
values
- The array to examine.increasing
- Whether the sort is to be increasing or decreasing.- Returns:
- The indexes of the elements that would strictly sort the array when taken in order.
-
strictlySortedIndexes
public static int[] strictlySortedIndexes(double[] values, boolean increasing) Returns the element indexes that would strictly sort an array. Nan-s in the input array will be ignored.- Parameters:
values
- The array to examine.increasing
- Whether the sort is to be increasing or decreasing.- Returns:
- The indexes of the elements that would strictly sort the array when taken in order.
-
getRealType
Get the RealType from the RealTupleType that corresponds to one that begins with start.- Parameters:
type
- type to searchstart
- starting characters of name. This is useful when Plain import creates names like "pres_0"- Returns:
- RealType that matches or null if no match
- Throws:
VisADException
-
parseUnit
Parse a unit string specification and return the appropriate unit. Handles some non-standard units.- Parameters:
unitIdentifier
- unit specification- Returns:
- unit that corresponds to that specification
- Throws:
VisADException
- problem parsing unit
-
parseUnit
Parse a unit string specification and return the appropriate unit. Handles some non-standard units.- Parameters:
unitIdentifier
- unit specificationunitName
- Name to clone unit with- Returns:
- unit that corresponds to that specification
- Throws:
VisADException
- problem parsing unit
-
formatUtcDate
Return a formated date in UTC time. Uses DateTime.formatString() with the UTC (GMT) time zone.- Parameters:
dt
- DateTime objectpattern
- format pattern- Returns:
- formatted date. deprecated use UtcDate.formatUtcDate(DateTime, String)
-
makeDate
Make a date from a DateTime- Parameters:
dttm
- DateTime to use- Returns:
- the Date
- Throws:
VisADException
- problem converting units
-
getGregorianDateTime
public static DateTime getGregorianDateTime(TimeZone zone, int year, int month, int day, int hour, int min, int sec) throws VisADException Make a datetime from a year,...- Parameters:
zone
- timezone to use- Returns:
- the DateTime
- Throws:
VisADException
- problem converting units
-
makeDates
Make a list of Date object from the array of DateTime's- Parameters:
timesArray
- array of DateTimes- Returns:
- a List of Date objects
- Throws:
VisADException
- problem createing the dates
-
toReal
Parses the given String and returns the Real (if possible) that the string represents. The String may be of the form:dddd dddd unit dddd[unit] dddd(unit) dddd{unit} dddd
- Parameters:
value
- The string value- Returns:
- The real or null if it could not convert the given value
- Throws:
Exception
- problem with unit spec or parsing.
-
toReal
Create a Real from a string value- Parameters:
value
- numeric valueunitOpener
- character for start of Unit specunitCloser
- character for end of Unit spec- Returns:
- a Real
- Throws:
Exception
- problem parsing the strings or creating the Real
-
distance
Return the distance between the 2 points- Parameters:
p1
- Point 1p2
- Point 2- Returns:
- The distance
-
toLatLonPoint
public static ucar.unidata.geoloc.LatLonPointImpl toLatLonPoint(LatLonPoint llp) throws VisADException Create a LatLonPointImpl from the VisAD LatLonPoint- Parameters:
llp
- the LatLonPoint- Returns:
- the corresponding LatLonPointImpl
- Throws:
VisADException
- problem getting values from LatLonPoint
-
calculateBearing
public static ucar.unidata.geoloc.Bearing calculateBearing(LatLonPoint pt1, LatLonPoint pt2, ucar.unidata.geoloc.Bearing result) throws VisADException Calculate the bearing between the 2 points. See calculateBearing below.- Parameters:
pt1
- Point 1pt2
- Point 2result
- Object to use if non-null- Returns:
- The bearing
- Throws:
VisADException
- When pt2 cannot be converted to the unit of pt1
-
calculateBearing
public static ucar.unidata.geoloc.Bearing calculateBearing(LatLonPoint pt1, LatLonPoint pt2) throws VisADException Calculate the bearing between the 2 points. See calculateBearing below.- Parameters:
pt1
- Point 1pt2
- Point 2- Returns:
- The bearing
- Throws:
VisADException
- When pt2 cannot be converted to the unit of pt1
-
formatReal
Format a real value to a nice looking number- Parameters:
r
- real to format- Returns:
- formatted value
-
labeledReal
Wrap a Real as a TwoFacedObject with a formatted label- Parameters:
r
- real to wrap- Returns:
- Real with a nice label
-
labeledReal
Wrap a Real as a TwoFacedObject with a formatted label- Parameters:
r
- real to wrapincludeUnit
- if true, add the unit to the label- Returns:
- Real with a nice label
-
indexedField
public static FieldImpl indexedField(Data[] datas, boolean copy) throws VisADException, RemoteException Get a FieldImpl with a domain of index and the range of the datas.- Parameters:
datas
- Data objects for range. Must all be of same type.copy
- true to copy data.- Returns:
- FieldImpl of index -> datas.getType()
- Throws:
RemoteException
- Java RMI problemVisADException
- problem creating field
-
main
Test- Parameters:
args
- cmd line args
-
bearingDistance
Return the distance from a bearing as Real- Parameters:
el1
- start locationel2
- end location- Returns:
- the distance between them
- Throws:
Exception
- problem calculating the distance
-
getValueAs
Get the value of a Real in the unit specified- Parameters:
r
- RealunitString
- string representation of the return Unit- Returns:
- the value in the unit
- Throws:
RemoteException
- Java RMI ExceptionVisADException
- Unit problem
-
getReal
Get a Real with the specified value and Unit- Parameters:
value
- the valueunitString
- the Unit- Returns:
- a Real with the value and Unit
- Throws:
RemoteException
- Java RMI ExceptionVisADException
- Unit problem
-
getReal
Get a Real with the specified value and Unit- Parameters:
value
- the valueunit
- the Unit- Returns:
- a Real with the value and Unit
- Throws:
RemoteException
- Java RMI ExceptionVisADException
- Unit problem
-
getRealType
Get a realtype with the unit- Parameters:
unit
- unit- Returns:
- RealType of that unit (or null if unit incompatible with a RealType with the same name)
- Throws:
RemoteException
- Java RMI ExceptionVisADException
- Unit problem
-
getRayPositionAtZ
Get the position of the ray at a particular Z value.- Parameters:
ray
- ray to usezValue
- Z value- Returns:
- coordinates at Z value
-
cleanTypeName
A utility to strip off the unit name that gets appended to the real type name. This also strips off the '(Text)' for text types- Parameters:
name
- Initial real type name- Returns:
- name with unit part stripped off
-
cleanTypeName
Remove any of the extra unit suffixes that get added to the type name- Parameters:
mathType
- the type- Returns:
- the type name cleaned up
-
getIndex
Find the index of the MathType in the given tuple type whose cleaned name is equals to the lookingFor parameter.- Parameters:
tupleType
- Tuple typelookingFor
- String to search for- Returns:
- The index or -1 if not found
-
makeRealType
Create a RealType from the name and unit. The unit is used as part of the name so it should be unique.- Parameters:
name
- name of typeunit
- can be null- Returns:
- RealType of form "name_unit"
- Throws:
VisADException
- unable to create the RealType (shouldn't happen)
-
makeRealType
Make a RealType- Parameters:
name
- name of the RealTypealias
- the aliasunit
- the default unit- Returns:
- the RealType
- Throws:
VisADException
- problem creating the RealType
-
formatLatLonPoint
Format an LatLonPoint as a lat/lon string.- Parameters:
llp
- LatLonPoint to format- Returns:
- The formatted LatLonPoint
-
makeEarthLocation
Utility to make an earth location with a 0 altitude- Parameters:
lat
- latitudelon
- longitude- Returns:
- earth location
- Throws:
Exception
- problem creating earth location
-
makeEarthLocation
Utility to make an earth location with a altitude- Parameters:
lat
- latitudelon
- longitudealt
- longitude- Returns:
- earth location
- Throws:
Exception
- problem creating earth location
-
makeEarthLocation
Utility to make an earth location with a 0 altitude- Parameters:
llp
- lat/lon- Returns:
- earth location
- Throws:
Exception
- problem creating earth location
-
formatEarthLocation
Format a EarthLocation as a lat/lon/(alt) string.- Parameters:
el
- EarthLocation to formatincludeAlt
- include Altitude in the return- Returns:
- The formatted lat/lon/alt
-
formatAltitude
Format an Altitude- Parameters:
alt
- The altitude- Returns:
- The formatted alt
-
dumpTypes
Wrapper for JPythonMethods.dumpTypes(Data)- Parameters:
d
- the Data object- Throws:
VisADException
- problem dumping the data
-
getVWorldCoords
Get the VisAD Virtual World x,y coordinates for the given screen coords- Parameters:
display
- the displayx
- the canvas X coordinatey
- the canvas Y coordinateretVals
- the return array (may be null)- Returns:
- an array of the x,y,z coordinates or null
-
makeField
public static FlatField makeField(Image image, boolean makeNansForAnyAlpha) throws IOException, VisADException Create a VisAD Data object from the given Image- Parameters:
image
- image to usemakeNansForAnyAlpha
- If true then we make a field with an alpha value and we turn the other values into nan-s- Returns:
- a FlatField representation of the image
- Throws:
IOException
- problem reading the imageVisADException
- problem creating the FlatField
-
makeField
public static FlatField makeField(Image image, float alphaThreshold) throws IOException, VisADException Create a VisAD Data object from the given Image- Parameters:
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 thresholdinvalid input: '<'0 value and we turn the other values into nan-s- Returns:
- a FlatField representation of the image
- Throws:
IOException
- problem reading the imageVisADException
- problem creating the FlatField
-
makeField
public static FlatField makeField(Image image, float alphaThreshold, boolean makeAlpha) throws IOException, VisADException Create a VisAD Data object from the given Image- Parameters:
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 thresholdinvalid input: '<'0 value and we turn the other values into nan-smakeAlpha
- if true, make an alpha channel as well- Returns:
- a FlatField representation of the image
- Throws:
IOException
- problem reading the imageVisADException
- problem creating the FlatField
-
makeField
public static FlatField makeField(Image image, float alphaThreshold, boolean makeAlpha, boolean incNames) throws IOException, VisADException Create a VisAD Data object from the given Image- Parameters:
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 thresholdinvalid input: '<'0 value and we turn the other values into nan-smakeAlpha
- if true, make an alpha channel as wellincNames
- if true, make new names- Returns:
- a FlatField representation of the image
- Throws:
IOException
- problem reading the imageVisADException
- problem creating the FlatField
-
makeMapProjection
public static MapProjection makeMapProjection(double lat1, double lon1, double lat2, double lon2) throws VisADException Make a map projection from the points- Parameters:
lat1
- lower left latitudelon1
- lower left longitudelat2
- upper right latitudelon2
- upper right longitude- Returns:
- a corresponding MapProjection
- Throws:
VisADException
- problem creating the map projectionVisADException
- problem making projection
-
makeMapProjection
public static MapProjection makeMapProjection(double lat1, double lon1, double lat2, double lon2, boolean makeSquare) throws VisADException Make a map projection from the bounds- Parameters:
lat1
- min latitudelon1
- min longitudelat2
- max latitudelon2
- max longitudemakeSquare
- if true, normalize to a square- Returns:
- the MapProjection
- Throws:
VisADException
- problem making the projection or invalid input
-
propertySet
public static boolean propertySet(Object object, String name, Object value, boolean ignoreError) throws Exception Use reflection to find the Method with name "set" + Name. If found then convert the given value to the appropriate type and invoke the method.- Parameters:
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 error- Returns:
- Did we successfully set the property
- Throws:
Exception
- problem setting the property
-
makeTimeField
This makes a field of T->range for the times in the list. If the times list if null or empty it just returns the range- Parameters:
range
- The rangetimes
- List of times- Returns:
- The time field or the range if times is null
- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
makeTimeField
public static FieldImpl makeTimeField(List ranges, List times) throws VisADException, RemoteException Make a time field- Parameters:
ranges
- ranges for each timetimes
- list of times- Returns:
- the time field
- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
makeTimeField
public static FieldImpl[] makeTimeField(Data[] ranges, Object time) throws VisADException, RemoteException Make a time field- Parameters:
ranges
- ranges for each timetime
- list of times- Returns:
- the time field
- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
makeTimeRangeField
public static Data makeTimeRangeField(Data range, List times) throws VisADException, RemoteException This makes a field of T->range for the times in the list. If the times list if null or empty it just returns the range- Parameters:
range
- The rangetimes
- List of times- Returns:
- The time field or the range if times is null
- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
findIndex
Find the index of a value in a Set- Parameters:
set
- the setvalue
- the value- Returns:
- the index or -1 if units not convertible
- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
toList
Convert the elements in the set to a List- Parameters:
set
- The set- Returns:
- The list if items in the set
- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
makeTimeSet
Make a time set from a list of times- Parameters:
times
- the times- Returns:
- the Set
- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
exportAsNetcdf
Export the data object as a netCDF file- Parameters:
data
- the VisAD data to export- Returns:
- true if successful
- Throws:
Exception
- can't write data as netCDF
-
makeField
public static FlatField makeField(float lon1, float lon2, int length1, float lat1, float lat2, int length2, float fill, String unitString) throws VisADException, RemoteException this makes a empty flat field with the given lat/lon bounds and lengths, the given fill value and the unit- Parameters:
lon1
- longitude 1lon2
- longitude 2length1
- number of lon pointslat1
- lat 1lat2
- lat 2length2
- number of lat pointsfill
- the fill value for the rangeunitString
- the unit- Returns:
- the field
- Throws:
RemoteException
- on badnessVisADException
- on badness
-
makeEarthDomainSet
public static GriddedSet makeEarthDomainSet(float[] lats, float[] lons, float[] alts) throws VisADException 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- Parameters:
lats
- the latslons
- the lonsalts
- the (possibly null) altitudes- Returns:
- the griddedset
- Throws:
VisADException
- on badness
-
makeEarthDomainSet
public static GriddedSet makeEarthDomainSet(float[] lats, float[] lons, float[] alts, Unit[] units) throws VisADException 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- Parameters:
lats
- the latslons
- the lonsalts
- the (possibly null) altitudes- Returns:
- the griddedset
- Throws:
VisADException
- on badness
-
toLLP
convert the visad EarthLocation into a ucar.unidata.geoloc.LatLonPoint- Parameters:
el
- the earth location- Returns:
- The LatLonPoint
-
toLLP
Convert the visad LatLonPoint to a unidata.geoloc.LatLonPoint- Parameters:
llp
- the visad llp- Returns:
- the unidata llp
-
convertRange
Utility to convert the given raw data range into the other units- Parameters:
range
- data rangerangeUnit
- the unit for the rangeoutUnit
- the converted unit- Returns:
- Converted range
-
allMissing
Check to see if a RealTuple is all missing data. RealTuple.isMissing() only checks if it has null components, not if each component is missing.- Parameters:
rt
- RealTuple in question- Returns:
- true if RealTuple is null, isMissing() or all Real components have NaN values
-
performRotationAboutArbitraryVector
public static double[] performRotationAboutArbitraryVector(MouseBehavior mouse, double[] initialTransFormMatrix, double angle, double axisIComp, double axisJComp, double axisKComp, double offsetIComp, double offsetJComp, double offsetKComp) Perform rotation about an arbitrary vector- Parameters:
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 component- Returns:
- the rotated matrix
-
isEarthCoordinates
Check if these are earth coordinates- Parameters:
position
- the position- Returns:
- true if earth coordinates
-
setGlobeRadius
public static void setGlobeRadius(float[] position, float radius) Set the globe radious based on the position- Parameters:
position
- the positionradius
- the radius
-
printData
Print out the data summary. Wrapper around visad.python.JPythonMethods.dumpTypes(Data d)- Parameters:
d
- the Data to print
-
printDataType
Print out the data type summary. Wrapper around visad.python.JPythonMethods.dumpType(Data d)- Parameters:
d
- the Data to print
-