Class FlatField
- java.lang.Object
-
- visad.ThingImpl
-
- visad.DataImpl
-
- visad.FunctionImpl
-
- visad.FieldImpl
-
- visad.FlatField
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Data, Field, FlatFieldIface, Function, Thing
- Direct Known Subclasses:
- CachedFlatField, FileFlatField, ImageFlatField, JamaMatrix, SingleBandedImageImpl, Sounding, Spectrum
public class FlatField extends FieldImpl implements FlatFieldIface
FlatField is the VisAD class for finite samplings of functions whose range type and range coordinate systems are simple enough to allow efficient representation. The DomainSet, DomainCoordinateSystem, RangeSet, RangeCoordinateSystem and RangeCoordinateSystems variables of FlatField are immutable.A FlatField range type may be either a RealType (for a function with range = R), a RealTupleType (for a function with range = R^n for n > 0), or a TupleType of RealType-s and RealTupleType-s..
VisAD avoids invoking methods once per datum through the use of FlatField's. These are logically Field's of Tuple's of RealType's and RealTupleType's. Internally FlatField's are stored as arrays of numerical values, rather than the arrays of data objects stored in Field's. Many of the methods in the FlatField class and in other classes (e.g., CoordinateTransform, Set, Unit) process data in the form double[Dimension][Length] where Length is the number of samples in a Field and Dimension is the number of Tuple elements in the Field range values. Note that the order of the Length and Dimension indices are reversed as array indices. This allows efficient processing of long columns of Field value components. For example, if Latitude is one component of Field values, then any computation involving Latitude can be applied in a tight loop to all Latitude's in the Field.
FlatField's support range types more general than RealTuple's. To understand the motive, consider a set of observations that include Latitude, Longitude, Altitude, Pressure, Temperature, etc. We can organize these as a Field whose range values have the Tuple type:
(Latitude, Longitude, Altitude, Pressure, Temperature, ...)However, in order to declare that (Latitude, Longitude, Altitude) is a coordinate system with coordinate transform functions to other spatial coordinate systems, we need to organize:(Latitude, Longitude, Altitude)as a RealTupleType. Hence the range type of the Field of observations must be:((Latitude, Longitude, Altitude), Pressure, Temperature, ...)which is not a RealTupleType (since one of its components is a RealTupleType). In order to process such data efficiently, FlatField's must support range types that are Tuple's of RealType's and RealTupleType's.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class visad.DataImpl
DataImpl.Syncher
-
-
Field Summary
-
Fields inherited from interface visad.Data
ABS, ACOS, ACOS_DEGREES, ADD, ASIN, ASIN_DEGREES, ATAN, ATAN_DEGREES, ATAN2, ATAN2_DEGREES, CEIL, COS, COS_DEGREES, DEGREES_TO_RADIANS, DEPENDENT, DIVIDE, EXP, FLOOR, INDEPENDENT, INV_ATAN2, INV_ATAN2_DEGREES, INV_DIVIDE, INV_POW, INV_REMAINDER, INV_SUBTRACT, LOG, MAX, MIN, MULTIPLY, NEAREST_NEIGHBOR, NEGATE, NO_ERRORS, NOP, POW, RADIANS_TO_DEGREES, REMAINDER, RINT, ROUND, SIN, SIN_DEGREES, SQRT, SUBTRACT, TAN, TAN_DEGREES, WEIGHTED_AVERAGE
-
-
Constructor Summary
Constructors Constructor and Description FlatField(FunctionType type)Constructs a FlatField from a function type.FlatField(FunctionType type, Set domain_set)Constructs a FlatField from a function type and a (non-default) domain Set.FlatField(FunctionType type, Set domain_set, CoordinateSystem[] range_coord_syses, Set[] range_sets, Unit[] units)Constructs a FlatField from a function type, a sampling set of the domain, coordinate systems for the range components, sampling sets for the range components, and units for the range components.FlatField(FunctionType type, Set domain_set, CoordinateSystem range_coord_sys, CoordinateSystem[] range_coord_syses, Set[] range_sets, Unit[] units)Constructs a FlatField from a function type, a sampling set of the domain, a coordinate system for the range, coordinate systems for the range components, sampling sets for the range components, and units for the range components.FlatField(FunctionType type, Set domain_set, CoordinateSystem range_coord_sys, Set[] range_sets, Unit[] units)Constructs a FlatField from a function type, a sampling set of the domain, a coordinate system for the range, sampling sets for the range components, and units for the range components.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description DataadjustSamplingError(Data error, int error_mode)return a FlatField that clones this, except its ErrorEstimate-s are adjusted for sampling errors in errorDatabinary(Data data, int op, MathType new_type, int sampling_mode, int error_mode)Return new Field with value 'this op data'.voidclearMissing()Mark this FlatField as non-missingjava.lang.Objectclone()Clones this instance.DataShadowcomputeRanges(ShadowType type, DataShadow shadow)Recursive version of computeRanges(), called down through Data object tree.FieldconvertToField()convert this FlatField to a (non-Flat) FieldImplDataderivative(int error_mode)return the tuple of derivatives of this Function with respect to all RealType components of its domain RealTuple; propogate errors according to error_modeDataderivative(MathType[] derivType_s, int error_mode)return the tuple of derivatives of this Function with respect to all RealType components of its domain RealTuple; set result MathTypes of tuple components to derivType_s; propogate errors according to error_modeDataderivative(RealTuple location, RealType[] d_partial_s, MathType[] derivType_s, int error_mode)return the tuple of derivatives of this Function with respect to the RealTypes in d_partial_s; the RealTypes in d_partial_s may occur in this Function's domain RealTupleType, or, if the domain has a CoordinateSystem, in its Reference RealTupleType; set result MathTypes of tuple components to derivType_s; propogate errors according to error_modeFunctionderivative(RealType d_partial, int error_mode)return the derivative of this Function with respect to d_partial; d_partial may occur in this Function's domain RealTupleType, or, if the domain has a CoordinateSystem, in its Reference RealTupleType; propogate errors according to error_modeFunctionderivative(RealType d_partial, MathType derivType, int error_mode)return the derivative of this Function with respect to d_partial; set result MathType to derivType; d_partial may occur in this Function's domain RealTupleType, or, if the domain has a CoordinateSystem, in its Reference RealTupleType; propogate errors according to error_modebooleanequals(java.lang.Object obj)Fieldextract(int component)extract field from this[].component; this is OK, when we get around to itFieldextract(int component, boolean copy)extract field from this[].component; this is OK, when we get around to itstatic voidfillField(FlatField image, double step, double half)Unit[]getDefaultRangeUnits()Get default range Unit-s for 'Flat' components.float[][]getFloats()Returns the range values in their default units as floats.float[][]getFloats(boolean copy)Returns the range values in their default units as floats.CoordinateSystem[]getRangeCoordinateSystem()Returns the range CoordinateSystem assuming that the range type is a RealTupleType (and throws a TypeException if its not).CoordinateSystem[]getRangeCoordinateSystem(int i)Returns the CoordinateSystem of a component of the range.intgetRangeDimension()Gets the number of components in the "flat" range.ErrorEstimate[]getRangeErrors()return array of ErrorEstimates associated with each RealType component of range; each ErrorEstimate is a mean error for all samples of a range RealType componentSet[]getRangeSets()Returns the sampling set of each flat component.Unit[][]getRangeUnits()return array of Units associated with each RealType component of range; these may differ from default Units of range RealTypes, but must be convertable; the second index has length = 1 (since all samples have the same Units)DatagetSample(int index)Get the range value at the index-th sample.DatagetSample(int index, boolean metadataOnly)A stub routine which simply invokesgetSampleto overrideFieldImpl.getSamplejava.lang.String[][]getStringValues()Get String values for Text componentsdouble[][]getValues()Returns the range values in their default units as doubles.double[][]getValues(boolean copy)Returns the range values in their default units as doubles.double[]getValues(int s_index)Get values for 'Flat' components in default range Unit-s.byte[][]grabBytes()booleanisFlatField()return true if this a FlatField or a RemoteField adapting a FlatFieldbooleanisMissing()Test whether range values are missingjava.lang.StringlongString(java.lang.String pre)static voidmain(java.lang.String[] args)run 'java visad.FlatField' to test the FlatField classstatic FlatFieldmakeField(FunctionType type, int length, boolean irregular)construct a FlatField of given type; used for testingstatic FlatFieldmakeField1(FunctionType type, double first1, double last1, int length1, double first2, double last2, int length2)construct a FlatField with a 2-D domain and a 1-D range; used for testingstatic FlatFieldmakeField2(FunctionType type, double first1, double last1, int length1, double first2, double last2, int length2)construct a FlatField with a 2-D domain and a 2-D range; used for testingFieldresample(Set set, int sampling_mode, int error_mode)Resamples the range to domain samples of a given set.FieldresampleDouble(Set set, int sampling_mode, int error_mode)Resamples the range to domain samples of a given double set.voidsetRangeErrors(ErrorEstimate[] errors)Sets the ErrorEstimates associated with each RealType component of the range.voidsetSample(int index, Data range)Set the range value at the index-th samplevoidsetSample(int index, Data range, boolean copy)Set the range value at the index-th samplevoidsetSamples(Data[] range, boolean copy)set the range values of the function; the order of range values must be the same as the order of domain indices in the DomainSet; copy argument included for consistency with Field, but ignoredvoidsetSamples(double[][] range)set range array as range values of this FlatField; the array is dimensioned double[number_of_range_components][number_of_range_samples]; the order of range values must be the same as the order of domain indices in the DomainSetvoidsetSamples(double[][] range, boolean copy)set range array as range values of this FlatField; the array is dimensioned double[number_of_range_components][number_of_range_samples]; the order of range values must be the same as the order of domain indices in the DomainSet; copy array if copy flag is truevoidsetSamples(double[][] range, ErrorEstimate[] errors, boolean copy)set the range values of the function including ErrorEstimate-s; the order of range values must be the same as the order of domain indices in the DomainSetvoidsetSamples(float[][] range)set range array as range values of this FlatField; the array is dimensioned float[number_of_range_components][number_of_range_samples]; the order of range values must be the same as the order of domain indices in the DomainSetvoidsetSamples(float[][] range, boolean copy)set range array as range values of this FlatField; the array is dimensioned float[number_of_range_components][number_of_range_samples]; the order of range values must be the same as the order of domain indices in the DomainSet; copy array if copy flag is truevoidsetSamples(float[][] range, ErrorEstimate[] errors, boolean copy)set the range values of the function including ErrorEstimate-s; the order of range values must be the same as the order of domain indices in the DomainSetvoidsetSamples(int[] indices, double[][] range)voidsetSamples(int start, double[][] range)update a subset of a FlatField's range samples, where start is the index of the first sample to update and range[0].length is the number of samples to update; the array is dimensioned double[number_of_range_components][number_of_range_samples]java.lang.StringtoString()Dataunary(int op, MathType new_type, int sampling_mode, int error_mode)Return new FlatField with value 'this op'.float[][]unpackFloats()unpack an array of floats from field sample values according to the RangeSet-s; returns a copydouble[][]unpackValues()unpack an array of doubles from field sample values according to the RangeSet-s; returns a copy-
Methods inherited from class visad.FieldImpl
__getitem__, __len__, __setitem__, __setitem__, combine, combine, combine, combine, combine, domainEnumeration, domainFactor, domainFactor, domainMultiply, domainMultiply, domainMultiply, domainMultiply, extract, extract, getDomainCoordinateSystem, getDomainSet, getDomainUnits, getLength, setSample, setSample, setSample, setSamples
-
Methods inherited from class visad.FunctionImpl
__getitem__, __getitem__, evaluate, evaluate, evaluate, evaluate, getDomainDimension, resample
-
Methods inherited from class visad.DataImpl
__add__, __add__, __div__, __div__, __mod__, __mod__, __mul__, __mul__, __neg__, __pow__, __pow__, __radd__, __rdiv__, __rmod__, __rmul__, __rpow__, __rsub__, __sub__, __sub__, abs, abs, acos, acos, acosDegrees, acosDegrees, add, add, asin, asin, asinDegrees, asinDegrees, atan, atan, atan2, atan2, atan2Degrees, atan2Degrees, atanDegrees, atanDegrees, binary, ceil, ceil, changeMathType, computeRanges, computeRanges, cos, cos, cosDegrees, cosDegrees, dataClone, divide, divide, exp, exp, floor, floor, getType, local, log, log, longString, max, max, min, min, multiply, multiply, negate, negate, notifyReferences, pow, pow, remainder, remainder, rint, rint, round, round, sin, sin, sinDegrees, sinDegrees, sqrt, sqrt, subtract, subtract, tan, tan, tanDegrees, tanDegrees, unary
-
Methods inherited from class visad.ThingImpl
addReference, removeReference
-
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface visad.Field
domainEnumeration, domainFactor, domainMultiply, domainMultiply, getDomainSet, getLength, setSample, setSample
-
Methods inherited from interface visad.Function
evaluate, evaluate, evaluate, evaluate, getDomainCoordinateSystem, getDomainDimension, getDomainUnits, resample
-
Methods inherited from interface visad.Data
abs, abs, acos, acos, acosDegrees, acosDegrees, add, add, asin, asin, asinDegrees, asinDegrees, atan, atan, atan2, atan2, atan2Degrees, atan2Degrees, atanDegrees, atanDegrees, binary, ceil, ceil, changeMathType, computeRanges, computeRanges, cos, cos, cosDegrees, cosDegrees, dataClone, divide, divide, exp, exp, floor, floor, getType, local, log, log, longString, max, max, min, min, multiply, multiply, negate, negate, pow, pow, remainder, remainder, rint, rint, round, round, sin, sin, sinDegrees, sinDegrees, sqrt, sqrt, subtract, subtract, tan, tan, tanDegrees, tanDegrees, unary
-
Methods inherited from interface visad.Thing
addReference, removeReference
-
-
-
-
Constructor Detail
-
FlatField
public FlatField(FunctionType type) throws VisADException
Constructs a FlatField from a function type. The domain Set is the default Set of the function domain.- Parameters:
type- The type of the function.- Throws:
VisADException- Couldn't create necessary VisAD object.
-
FlatField
public FlatField(FunctionType type, Set domain_set) throws VisADException
Constructs a FlatField from a function type and a (non-default) domain Set.- Parameters:
type- The type of the function.domain_set- The sampling set of the domain. May benull, in which case the sampling set is the default Set of the function domain.- Throws:
VisADException- Couldn't create necessary VisAD object.
-
FlatField
public FlatField(FunctionType type, Set domain_set, CoordinateSystem range_coord_sys, Set[] range_sets, Unit[] units) throws VisADException
Constructs a FlatField from a function type, a sampling set of the domain, a coordinate system for the range, sampling sets for the range components, and units for the range components.- Parameters:
type- The type of the function.domain_set- The sampling set of the domain. May benull, in which case the sampling set is set to the default sampling set of the function domain (i.e.type.getDomain().getDefaultSet()).range_coord_sys- Optional coordinate system for the range. May benull. If non-null, then the range of the function shall be a RealTuple (i.e.type.getRange() instanceof RealTupleshall be true) and the reference coordinate system of the range coordinate system shall be the same as the reference coordiinate system of the function range (i.e.range_coord_sys().getReference().equals( ((RealTuple)type.getRange()).getReference())shall be true).range_sets- The sampling sets of the (flat) range components. May benull, in which case the default sampling sets of the range component RealType-s are used (i.e.((RealType)type.getFlatRange().getComponent(i)) .getDefaultSet()for alliin the flat range). If non-null, then theith flat range component values are stored in bytes ifrange_sets[i].getLength() < 256, stored in shorts ifrange_sets[i].getLength() < 65536, etc.units- The units of the (flat) range components. May benull, in which case the default units of the flat range RealType-s are used.- Throws:
VisADException- Couldn't create necessary VisAD object.
-
FlatField
public FlatField(FunctionType type, Set domain_set, CoordinateSystem[] range_coord_syses, Set[] range_sets, Unit[] units) throws VisADException
Constructs a FlatField from a function type, a sampling set of the domain, coordinate systems for the range components, sampling sets for the range components, and units for the range components.- Parameters:
type- The type of the function.domain_set- The sampling set of the domain. May be null, in which case the sampling set is set to the default sampling set of the function domain (i.e.type.getDomain().getDefaultSet()).range_coord_syses- Optional coordinate systems for the range components. May benull. If theith component of the range is a RealTuple, thenrange_coord_syses[i]may be non-nulland, if so, is the coordinate system for that component and shall have the same reference coordinate system as the corresponding component in the range of the function type.range_sets- The sampling sets of the (flat) range components. May benull, in which case the default sampling sets of the range component RealType-s are used (i.e.((RealType)type.getFlatRange().getComponent(i)) .getDefaultSet()for alliin the flat range). If non-null, then theith flat range component values are stored in bytes ifrange_sets[i].getLength() < 256, stored in shorts ifrange_sets[i].getLength() < 65536, etc.units- The units of the (flat) range components. May benull, in which case the default units of the flat range RealType-s are used.- Throws:
VisADException- Couldn't create necessary VisAD object.
-
FlatField
public FlatField(FunctionType type, Set domain_set, CoordinateSystem range_coord_sys, CoordinateSystem[] range_coord_syses, Set[] range_sets, Unit[] units) throws VisADException
Constructs a FlatField from a function type, a sampling set of the domain, a coordinate system for the range, coordinate systems for the range components, sampling sets for the range components, and units for the range components. This is the most general constructor.- Parameters:
type- The type of the function.domain_set- The sampling set of the domain. May be null, in which case the sampling set is set to the default sampling set of the function domain (i.e.type.getDomain().getDefaultSet()).range_coord_sys- Optional coordinate system for the range. May benull. If non-null, then the range of the function shall be a RealTuple (i.e.type.getRange() instanceof RealTupleshall be true) and the reference coordinate system of the range coordinate system shall be the same as the reference coordiinate system of the function range (i.e.range_coord_sys().getReference().equals( ((RealTuple)type.getRange()).getReference())shall be true).range_coord_syses- Optional coordinate systems for the range components. May benull. If theith component of the range is a RealTuple, thenrange_coord_syses[i]may be non-nulland, if so, is the coordinate system for that component and shall have the same reference coordinate system as the corresponding component in the range of the function type.range_sets- The sampling sets of the (flat) range components. May benull, in which case the default sampling sets of the range component RealType-s are used (i.e.((RealType)type.getFlatRange().getComponent(i)) .getDefaultSet()for alliin the flat range). If non-null, then theith flat range component values are stored in bytes ifrange_sets[i].getLength() < 256, stored in shorts ifrange_sets[i].getLength() < 65536, etc.units- The units of the (flat) range components. May benull, in which case the default units of the flat range RealType-s are used.- Throws:
SetException- ifrange_setsis non-nulland either one of its elements isnullor an element's dimension is not one.VisADException- Couldn't create necessary VisAD object.
-
-
Method Detail
-
getRangeCoordinateSystem
public CoordinateSystem[] getRangeCoordinateSystem() throws TypeException
Returns the range CoordinateSystem assuming that the range type is a RealTupleType (and throws a TypeException if its not). This may differ from default CoordinateSystem of range RealTupleType, but must be convertable; the index has length = 1 (since all samples have the same Units).- Specified by:
getRangeCoordinateSystemin interfaceField- Overrides:
getRangeCoordinateSystemin classFieldImpl- Returns:
- The CoordinateSystem of the RealTuple range.
Will not be
nulland will be of length 1. - Throws:
TypeException- The type of the range is neither RealType nor RealTupleType.
-
getRangeSets
public Set[] getRangeSets()
Returns the sampling set of each flat component.- Specified by:
getRangeSetsin interfaceFlatFieldIface- Returns:
- The sampling set of each component in the flat range.
-
getRangeCoordinateSystem
public CoordinateSystem[] getRangeCoordinateSystem(int i) throws TypeException
Returns the CoordinateSystem of a component of the range. The MathType of the range shall be a TupleType.- Specified by:
getRangeCoordinateSystemin interfaceField- Overrides:
getRangeCoordinateSystemin classFieldImpl- Parameters:
i- The index of the component. The value shall be greater than or equal to zero and less that the number of components in the TupleType of the range.- Returns:
- The CoordinateSystem of the
i-th component. Won't benulland will be of length 1. The single element might benull. - Throws:
TypeException- The type of the range is either RealType or RealTupleType.
-
getRangeUnits
public Unit[][] getRangeUnits()
return array of Units associated with each RealType component of range; these may differ from default Units of range RealTypes, but must be convertable; the second index has length = 1 (since all samples have the same Units)- Specified by:
getRangeUnitsin interfaceField- Overrides:
getRangeUnitsin classFieldImpl
-
getRangeErrors
public ErrorEstimate[] getRangeErrors()
return array of ErrorEstimates associated with each RealType component of range; each ErrorEstimate is a mean error for all samples of a range RealType component- Specified by:
getRangeErrorsin interfaceFlatFieldIface
-
setRangeErrors
public void setRangeErrors(ErrorEstimate[] errors) throws FieldException
Sets the ErrorEstimates associated with each RealType component of the range.errors[i]is theErrorEstimatefor thei-thRealTypecomponent.- Specified by:
setRangeErrorsin interfaceFlatFieldIface- Parameters:
errors- The error estimates for the range values.- Throws:
FieldException- iferrorsis non-nullanderrors.length != getRangeDimension().
-
setSamples
public void setSamples(Data[] range, boolean copy) throws VisADException, java.rmi.RemoteException
set the range values of the function; the order of range values must be the same as the order of domain indices in the DomainSet; copy argument included for consistency with Field, but ignored- Specified by:
setSamplesin interfaceField- Overrides:
setSamplesin classFieldImpl- Parameters:
range- The range valuescopy- should the range values be copied- Throws:
VisADExceptionjava.rmi.RemoteException
-
setSamples
public void setSamples(double[][] range) throws VisADException, java.rmi.RemoteExceptionset range array as range values of this FlatField; the array is dimensioned double[number_of_range_components][number_of_range_samples]; the order of range values must be the same as the order of domain indices in the DomainSet- Specified by:
setSamplesin interfaceField- Overrides:
setSamplesin classFieldImpl- Throws:
VisADExceptionjava.rmi.RemoteException
-
setSamples
public void setSamples(float[][] range) throws VisADException, java.rmi.RemoteExceptionset range array as range values of this FlatField; the array is dimensioned float[number_of_range_components][number_of_range_samples]; the order of range values must be the same as the order of domain indices in the DomainSet- Specified by:
setSamplesin interfaceField- Overrides:
setSamplesin classFieldImpl- Throws:
VisADExceptionjava.rmi.RemoteException
-
setSamples
public void setSamples(double[][] range, boolean copy) throws VisADException, java.rmi.RemoteExceptionset range array as range values of this FlatField; the array is dimensioned double[number_of_range_components][number_of_range_samples]; the order of range values must be the same as the order of domain indices in the DomainSet; copy array if copy flag is true- Specified by:
setSamplesin interfaceFlatFieldIface- Throws:
VisADExceptionjava.rmi.RemoteException
-
setSamples
public void setSamples(float[][] range, boolean copy) throws VisADException, java.rmi.RemoteExceptionset range array as range values of this FlatField; the array is dimensioned float[number_of_range_components][number_of_range_samples]; the order of range values must be the same as the order of domain indices in the DomainSet; copy array if copy flag is true- Specified by:
setSamplesin interfaceFlatFieldIface- Throws:
VisADExceptionjava.rmi.RemoteException
-
setSamples
public void setSamples(double[][] range, ErrorEstimate[] errors, boolean copy) throws VisADException, java.rmi.RemoteExceptionset the range values of the function including ErrorEstimate-s; the order of range values must be the same as the order of domain indices in the DomainSet- Specified by:
setSamplesin interfaceFlatFieldIface- Throws:
VisADExceptionjava.rmi.RemoteException
-
setSamples
public void setSamples(int start, double[][] range) throws VisADException, java.rmi.RemoteExceptionupdate a subset of a FlatField's range samples, where start is the index of the first sample to update and range[0].length is the number of samples to update; the array is dimensioned double[number_of_range_components][number_of_range_samples]- Specified by:
setSamplesin interfaceFlatFieldIface- Throws:
VisADExceptionjava.rmi.RemoteException
-
setSamples
public void setSamples(int[] indices, double[][] range) throws VisADException, java.rmi.RemoteException- Throws:
VisADExceptionjava.rmi.RemoteException
-
setSamples
public void setSamples(float[][] range, ErrorEstimate[] errors, boolean copy) throws VisADException, java.rmi.RemoteExceptionset the range values of the function including ErrorEstimate-s; the order of range values must be the same as the order of domain indices in the DomainSet- Specified by:
setSamplesin interfaceFlatFieldIface- Throws:
VisADExceptionjava.rmi.RemoteException
-
grabBytes
public byte[][] grabBytes()
- Specified by:
grabBytesin interfaceFlatFieldIface
-
unpackValues
public double[][] unpackValues() throws VisADExceptionunpack an array of doubles from field sample values according to the RangeSet-s; returns a copy- Throws:
VisADException
-
unpackFloats
public float[][] unpackFloats() throws VisADExceptionunpack an array of floats from field sample values according to the RangeSet-s; returns a copy- Throws:
VisADException
-
getFloats
public float[][] getFloats() throws VisADExceptionReturns the range values in their default units as floats.- Specified by:
getFloatsin interfaceField- Overrides:
getFloatsin classFieldImpl- Returns:
- The range values in their default units
as determined by the
MathTypeof the range. Element[i][j]is thejth sample value of theith component of the range. - Throws:
VisADException- if a VisAD object couldn't be created.
-
getFloats
public float[][] getFloats(boolean copy) throws VisADExceptionReturns the range values in their default units as floats.- Specified by:
getFloatsin interfaceField- Overrides:
getFloatsin classFieldImpl- Parameters:
copy- Whether or not the returned array might be the actual range array. Iftrue, then the returned array will not be the actual range array.- Returns:
- The range values in their default units
as determined by the
MathTypeof the range. Element[i][j]is thejth sample value of theith component of the range. - Throws:
VisADException- if a VisAD object couldn't be created.
-
getValues
public double[][] getValues() throws VisADExceptionReturns the range values in their default units as doubles.- Specified by:
getValuesin interfaceField- Overrides:
getValuesin classFieldImpl- Returns:
- The range values in their default units
as determined by the
MathTypeof the range. Element[i][j]is thejth sample value of theith component of the range. - Throws:
VisADException- if a VisAD object couldn't be created.
-
getValues
public double[][] getValues(boolean copy) throws VisADExceptionReturns the range values in their default units as doubles.- Specified by:
getValuesin interfaceField- Overrides:
getValuesin classFieldImpl- Parameters:
copy- Whether or not the returned array might be the actual range array. Iftrue, then the returned array will not be the actual range array.- Returns:
- The range values in their default units
as determined by the
MathTypeof the range. Element[i][j]is thejth sample value of theith component of the range. - Throws:
VisADException- if a VisAD object couldn't be created.
-
getStringValues
public java.lang.String[][] getStringValues() throws VisADException, java.rmi.RemoteExceptionGet String values for Text components- Specified by:
getStringValuesin interfaceField- Overrides:
getStringValuesin classFieldImpl- Returns:
- null (there are none for FlatFields)
- Throws:
VisADException- but doesn't happenjava.rmi.RemoteException- but doesn't happen
-
getValues
public double[] getValues(int s_index) throws VisADExceptionGet values for 'Flat' components in default range Unit-s.- Specified by:
getValuesin interfaceFlatFieldIface- Returns:
- The range values in their default units
as determined by the
MathTypeof the range. Element[i]is the value of theith component of the flattened range. - Throws:
VisADException- if a VisAD object couldn't be created.
-
getDefaultRangeUnits
public Unit[] getDefaultRangeUnits()
Get default range Unit-s for 'Flat' components.- Specified by:
getDefaultRangeUnitsin interfaceField- Overrides:
getDefaultRangeUnitsin classFieldImpl- Returns:
- array of the default Units for each of the RealTypes components in the flattened range.
-
getSample
public Data getSample(int index) throws VisADException, java.rmi.RemoteException
Get the range value at the index-th sample. FlatField does not override evaluate, but the correctness of FlatField.evaluate depends on overriding getSample- Specified by:
getSamplein interfaceField- Overrides:
getSamplein classFieldImpl- Parameters:
index- index of requested range sample- Returns:
- Data object (Real, RealTuple, or Tuple) corresponding to the range at the index-th sample.
- Throws:
VisADException- problem getting datajava.rmi.RemoteException- problem getting data from remote object
-
getSample
public Data getSample(int index, boolean metadataOnly) throws VisADException, java.rmi.RemoteException
A stub routine which simply invokesgetSampleto overrideFieldImpl.getSample- Overrides:
getSamplein classFieldImpl- Parameters:
index- index of requested range samplemetadataOnly- true if only the metadata is needed, false if both metadata and data are desired.- Throws:
VisADException- if a VisAD object couldn't be created.java.rmi.RemoteException- if the Remote object couldn't be created.
-
setSample
public void setSample(int index, Data range, boolean copy) throws VisADException, java.rmi.RemoteExceptionSet the range value at the index-th sample- Specified by:
setSamplein interfaceField- Overrides:
setSamplein classFieldImpl- Parameters:
index- index to setrange- range value to setcopy- flag to copy values - meaningless for FlatField- Throws:
VisADException- if range's MathType is incompatible or some other error.java.rmi.RemoteException- if the Remote object couldn't be created.
-
setSample
public void setSample(int index, Data range) throws VisADException, java.rmi.RemoteExceptionSet the range value at the index-th sample- Specified by:
setSamplein interfaceField- Overrides:
setSamplein classFieldImpl- Parameters:
index- index to setrange- range value to set- Throws:
VisADException- if range's MathType is incompatible or some other error.java.rmi.RemoteException- if the Remote object couldn't be created.
-
isMissing
public boolean isMissing()
Test whether range values are missing
-
clearMissing
public void clearMissing()
Mark this FlatField as non-missing- Specified by:
clearMissingin interfaceFlatFieldIface
-
binary
public Data binary(Data data, int op, MathType new_type, int sampling_mode, int error_mode) throws VisADException, java.rmi.RemoteException
Return new Field with value 'this op data'. test for various relations between types of this and data; note return type may not be FlatField, in case data is a Field and this matches its range- Specified by:
binaryin interfaceData- Overrides:
binaryin classFieldImpl- Parameters:
data- object to operate onop- operation to perform (e.g. ADD, SUB, MULT)new_type- MathType of new objectsampling_mode- sampling mode to use (e.g., NEAREST_NEIGHBOR, WEIGHTED_AVERAGE)error_mode- error estimate mode (e.g., NO_ERROR, DEPENDENT, independent)- Returns:
- new Field corresponding to the requested operation
- Throws:
VisADException- couldn't create new VisAD objectjava.rmi.RemoteException- couldn't create new Remote object
-
unary
public Data unary(int op, MathType new_type, int sampling_mode, int error_mode) throws VisADException
Return new FlatField with value 'this op'.- Specified by:
unaryin interfaceData- Overrides:
unaryin classFieldImpl- Parameters:
op- operation to perform (e.g., NOP, ABS, COS)new_type- MathType of new objectsampling_mode- sampling mode to use (e.g., NEAREST_NEIGHBOR, WEIGHTED_AVERAGE)error_mode- error estimate mode (e.g., NO_ERROR, DEPENDENT, independent)- Returns:
- new FlatField corresponding to the requested operation
- Throws:
VisADException- couldn't create new VisAD objectjava.rmi.RemoteException- couldn't create new Remote object
-
extract
public Field extract(int component) throws VisADException, java.rmi.RemoteException
extract field from this[].component; this is OK, when we get around to it- Specified by:
extractin interfaceField- Overrides:
extractin classFieldImpl- Throws:
VisADExceptionjava.rmi.RemoteException
-
extract
public Field extract(int component, boolean copy) throws VisADException, java.rmi.RemoteException
extract field from this[].component; this is OK, when we get around to it- Throws:
VisADExceptionjava.rmi.RemoteException
-
derivative
public Data derivative(RealTuple location, RealType[] d_partial_s, MathType[] derivType_s, int error_mode) throws VisADException, java.rmi.RemoteException
Description copied from interface:Functionreturn the tuple of derivatives of this Function with respect to the RealTypes in d_partial_s; the RealTypes in d_partial_s may occur in this Function's domain RealTupleType, or, if the domain has a CoordinateSystem, in its Reference RealTupleType; set result MathTypes of tuple components to derivType_s; propogate errors according to error_mode- Specified by:
derivativein interfaceFunction- Overrides:
derivativein classFieldImpl- Throws:
VisADExceptionjava.rmi.RemoteException
-
derivative
public Data derivative(int error_mode) throws VisADException, java.rmi.RemoteException
Description copied from interface:Functionreturn the tuple of derivatives of this Function with respect to all RealType components of its domain RealTuple; propogate errors according to error_mode- Specified by:
derivativein interfaceFunction- Overrides:
derivativein classFieldImpl- Throws:
VisADExceptionjava.rmi.RemoteException
-
derivative
public Data derivative(MathType[] derivType_s, int error_mode) throws VisADException, java.rmi.RemoteException
Description copied from interface:Functionreturn the tuple of derivatives of this Function with respect to all RealType components of its domain RealTuple; set result MathTypes of tuple components to derivType_s; propogate errors according to error_mode- Specified by:
derivativein interfaceFunction- Overrides:
derivativein classFieldImpl- Throws:
VisADExceptionjava.rmi.RemoteException
-
derivative
public Function derivative(RealType d_partial, int error_mode) throws VisADException, java.rmi.RemoteException
Description copied from interface:Functionreturn the derivative of this Function with respect to d_partial; d_partial may occur in this Function's domain RealTupleType, or, if the domain has a CoordinateSystem, in its Reference RealTupleType; propogate errors according to error_mode- Specified by:
derivativein interfaceFunction- Overrides:
derivativein classFieldImpl- Throws:
VisADExceptionjava.rmi.RemoteException
-
derivative
public Function derivative(RealType d_partial, MathType derivType, int error_mode) throws VisADException, java.rmi.RemoteException
Description copied from interface:Functionreturn the derivative of this Function with respect to d_partial; set result MathType to derivType; d_partial may occur in this Function's domain RealTupleType, or, if the domain has a CoordinateSystem, in its Reference RealTupleType; propogate errors according to error_mode- Specified by:
derivativein interfaceFunction- Overrides:
derivativein classFieldImpl- Throws:
VisADExceptionjava.rmi.RemoteException
-
resample
public Field resample(Set set, int sampling_mode, int error_mode) throws VisADException, java.rmi.RemoteException
Resamples the range to domain samples of a given set. Resampling is either by nearest neighbor or mulit-linear interpolation. NOTE: This code is very similar to FieldImpl.resample(Set,int,int).- Specified by:
resamplein interfaceFunction- Overrides:
resamplein classFieldImpl- Parameters:
set- The set of points at which to resample this field.sampling_mode- Resampling mode: Data.NEAREST_NEIGHBOR or Data.WEIGHTED_AVERAGEerror_mode- Error estimation mode: Data.DEPENDENT, Data.INDEPENDENT, or Data.NO_ERRORS.- Returns:
- Field of resampled data. RangeSet objects in result are set to DoubleSet. NOTE: May return this (i.e., not a copy).
- Throws:
VisADException- unable to resample functionjava.rmi.RemoteException- Java RMI exception
-
resampleDouble
public Field resampleDouble(Set set, int sampling_mode, int error_mode) throws VisADException, java.rmi.RemoteException
Resamples the range to domain samples of a given double set. Resampling is either by nearest neighbor or mulit-linear interpolation. NOTE: This code is very similar to FieldImpl.resample(Set,int,int).- Overrides:
resampleDoublein classFieldImpl- Parameters:
set- The set of points at which to resample this field.sampling_mode- Resampling mode: Data.NEAREST_NEIGHBOR or Data.WEIGHTED_AVERAGEerror_mode- Error estimation mode: Data.DEPENDENT, Data.INDEPENDENT, or Data.NO_ERRORS.- Returns:
- Field of resampled data. RangeSet objects in result are set to DoubleSet. NOTE: May return this (i.e., not a copy).
- Throws:
VisADException- unable to resample functionjava.rmi.RemoteException- Java RMI exception
-
convertToField
public Field convertToField() throws VisADException, java.rmi.RemoteException
convert this FlatField to a (non-Flat) FieldImpl- Specified by:
convertToFieldin interfaceFlatFieldIface- Throws:
VisADExceptionjava.rmi.RemoteException
-
computeRanges
public DataShadow computeRanges(ShadowType type, DataShadow shadow) throws VisADException
Description copied from interface:DataRecursive version of computeRanges(), called down through Data object tree.- Specified by:
computeRangesin interfaceData- Overrides:
computeRangesin classFieldImpl- Parameters:
type- ShadowType generated for MathType of thisshadow- DataShadow instance whose contained double[][] array and animation sampling Set are modified according to RealType values in this, and used as return value- Returns:
- DataShadow instance containing double[][] array of RealType ranges, and an animation sampling Set
- Throws:
VisADException- a VisAD error occurred
-
adjustSamplingError
public Data adjustSamplingError(Data error, int error_mode) throws VisADException, java.rmi.RemoteException
return a FlatField that clones this, except its ErrorEstimate-s are adjusted for sampling errors in error- Specified by:
adjustSamplingErrorin interfaceData- Overrides:
adjustSamplingErrorin classFieldImplerror_mode- may be Data.INDEPENDENT, Data.DEPENDENT or Data.NO_ERRORS;- Returns:
- clone of this, except with ErrorEstimates set according to values in error
- Throws:
VisADException- a VisAD error occurredjava.rmi.RemoteException- an RMI error occurred
-
isFlatField
public boolean isFlatField()
Description copied from interface:Fieldreturn true if this a FlatField or a RemoteField adapting a FlatField- Specified by:
isFlatFieldin interfaceField- Overrides:
isFlatFieldin classFieldImpl
-
clone
public java.lang.Object clone()
Clones this instance. Immutable fields are shallow copied. Range values, however, are deep copied.Note that it is possible to simultaneously modify the domain-set of both this instance and the clone by modifying the values in the array returned by invoking
getSamples(false)on the domain-set of either this instance or the clone. Don't do this unless you enjoy debugging.- Overrides:
clonein classFieldImpl- Returns:
- A clone of this instance.
- Throws:
java.lang.RuntimeException- if aVisADExceptionoccurs.
-
toString
public java.lang.String toString()
-
longString
public java.lang.String longString(java.lang.String pre) throws VisADException- Specified by:
longStringin interfaceData- Overrides:
longStringin classFieldImpl- Parameters:
pre- String added to start of each line- Returns:
- a longer String than returned by toString(), indented by pre (a string of blanks)
- Throws:
VisADException
-
getRangeDimension
public int getRangeDimension()
Gets the number of components in the "flat" range.- Specified by:
getRangeDimensionin interfaceFlatFieldIface- Returns:
- The number of components in the "flat" range.
-
makeField
public static FlatField makeField(FunctionType type, int length, boolean irregular) throws VisADException, java.rmi.RemoteException
construct a FlatField of given type; used for testing- Throws:
VisADExceptionjava.rmi.RemoteException
-
fillField
public static void fillField(FlatField image, double step, double half) throws VisADException, java.rmi.RemoteException
- Throws:
VisADExceptionjava.rmi.RemoteException
-
makeField1
public static FlatField makeField1(FunctionType type, double first1, double last1, int length1, double first2, double last2, int length2) throws VisADException, java.rmi.RemoteException
construct a FlatField with a 2-D domain and a 1-D range; used for testing- Throws:
VisADExceptionjava.rmi.RemoteException
-
makeField2
public static FlatField makeField2(FunctionType type, double first1, double last1, int length1, double first2, double last2, int length2) throws VisADException, java.rmi.RemoteException
construct a FlatField with a 2-D domain and a 2-D range; used for testing- Throws:
VisADExceptionjava.rmi.RemoteException
-
main
public static void main(java.lang.String[] args) throws VisADException, java.rmi.RemoteExceptionrun 'java visad.FlatField' to test the FlatField class- Throws:
VisADExceptionjava.rmi.RemoteException
-
-
DMelt 3.0 © DataMelt by jWork.ORG