visad.data
Class FileFlatField
- java.lang.Object
-
- visad.ThingImpl
-
- visad.DataImpl
-
- visad.FunctionImpl
-
- visad.FieldImpl
-
- visad.FlatField
-
- visad.data.FileFlatField
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Data, Field, FlatFieldIface, Function, Thing
public class FileFlatField extends FlatField
- 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 FileFlatField(FileAccessor accessor, CacheStrategy strategy)
-
Method Summary
All 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, int sampling_mode, int error_mode)Pointwise binary operation between this and data.Databinary(Data data, int op, MathType new_type, int sampling_mode, int error_mode)Return new Field with value 'this op data'.java.lang.Objectclone()Clones this instance.DataShadowcomputeRanges(ShadowType type, DataShadow shadow)Recursive version of computeRanges(), called down through Data object tree.FielddomainFactor(RealType factor)Factors this instance into a (nested) field-of-fields.Fieldextract(int component)extract field from this[].component; this is OK, when we get around to itUnit[]getDefaultRangeUnits()Get default range Unit-s for 'Flat' components.CoordinateSystemgetDomainCoordinateSystem()Get the CoordinateSystem associated with the domain RealTupleSetgetDomainSet()Returns the domain-set of this instance.Unit[]getDomainUnits()Returns the units of the values in the domain set.float[][]getFloats(boolean copy)Returns the range values in their default units as floats.intgetLength()get number of samplesCoordinateSystem[]getRangeCoordinateSystem()Returns the range CoordinateSystem assuming that the range type is a RealTupleType (and throws a TypeException if its not).CoordinateSystem[]getRangeCoordinateSystem(int component)Returns the CoordinateSystem of a component of the range.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.double[][]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 index)Get values for 'Flat' components in default range Unit-s.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)Fieldresample(Set set, int sampling_mode, int error_mode)Resamples the range to domain samples of a given set.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 samplevoidsetSample(RealTuple domain, Data range)set the range value at the sample nearest to domainjava.lang.StringtoString()Dataunary(int op, int sampling_mode, int error_mode)Pointwise unary operation applied to this.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.FlatField
clearMissing, convertToField, derivative, derivative, derivative, derivative, derivative, equals, extract, fillField, getFloats, getRangeDimension, getRangeErrors, getRangeSets, getSample, getStringValues, grabBytes, main, makeField, makeField1, makeField2, resampleDouble, setRangeErrors, setSamples, setSamples, setSamples, setSamples, setSamples, setSamples, setSamples, setSamples, setSamples
-
Methods inherited from class visad.FieldImpl
__getitem__, __len__, __setitem__, __setitem__, combine, combine, combine, combine, combine, domainEnumeration, domainFactor, domainMultiply, domainMultiply, domainMultiply, domainMultiply, extract, extract, 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, 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
-
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, domainMultiply, domainMultiply, setSample
-
Methods inherited from interface visad.Function
evaluate, evaluate, evaluate, evaluate, getDomainDimension, 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, 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
-
Methods inherited from interface visad.Thing
addReference, removeReference
-
-
-
-
Constructor Detail
-
FileFlatField
public FileFlatField(FileAccessor accessor, CacheStrategy strategy) throws VisADException
- Throws:
VisADException
-
-
Method Detail
-
getSample
public Data getSample(int index) throws VisADException, java.rmi.RemoteException
Description copied from class:FlatFieldGet 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 classFlatField- 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
-
getLength
public int getLength()
Description copied from class:FieldImplget number of samples
-
getDomainUnits
public Unit[] getDomainUnits()
Description copied from class:FieldImplReturns the units of the values in the domain set. The units may differ from the default units of the underlying MathType of the domain, but will be convertible with them.- Specified by:
getDomainUnitsin interfaceFunction- Overrides:
getDomainUnitsin classFieldImpl- Returns:
- The units of the values in the domain set.
-
getDomainCoordinateSystem
public CoordinateSystem getDomainCoordinateSystem()
Description copied from class:FunctionImplGet the CoordinateSystem associated with the domain RealTuple- Specified by:
getDomainCoordinateSystemin interfaceFunction- Overrides:
getDomainCoordinateSystemin classFieldImpl- Returns:
- CoordinateSystem of the domain
-
getRangeCoordinateSystem
public CoordinateSystem[] getRangeCoordinateSystem() throws TypeException
Description copied from class:FlatFieldReturns 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 classFlatField- 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.
-
getRangeCoordinateSystem
public CoordinateSystem[] getRangeCoordinateSystem(int component) throws TypeException
Description copied from class:FlatFieldReturns the CoordinateSystem of a component of the range. The MathType of the range shall be a TupleType.- Specified by:
getRangeCoordinateSystemin interfaceField- Overrides:
getRangeCoordinateSystemin classFlatField- Parameters:
component- 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()
Description copied from class:FlatFieldreturn 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 classFlatField
-
getDefaultRangeUnits
public Unit[] getDefaultRangeUnits()
Description copied from class:FlatFieldGet default range Unit-s for 'Flat' components.- Specified by:
getDefaultRangeUnitsin interfaceField- Overrides:
getDefaultRangeUnitsin classFlatField- Returns:
- array of the default Units for each of the RealTypes components in the flattened range.
-
getValues
public double[][] getValues() throws VisADExceptionDescription copied from class:FlatFieldReturns the range values in their default units as doubles.- Specified by:
getValuesin interfaceField- Overrides:
getValuesin classFlatField- 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 VisADExceptionDescription copied from class:FlatFieldReturns the range values in their default units as doubles.- Specified by:
getValuesin interfaceField- Overrides:
getValuesin classFlatField- 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(int index) throws VisADExceptionDescription copied from class:FlatFieldGet values for 'Flat' components in default range Unit-s.- Specified by:
getValuesin interfaceFlatFieldIface- Overrides:
getValuesin classFlatField- 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.
-
getFloats
public float[][] getFloats(boolean copy) throws VisADExceptionDescription copied from class:FlatFieldReturns the range values in their default units as floats.- Specified by:
getFloatsin interfaceField- Overrides:
getFloatsin classFlatField- 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.
-
getDomainSet
public Set getDomainSet()
Description copied from class:FieldImplReturns the domain-set of this instance. The actual set is returned: it is not a copy or a clone.
Note that it is possible to simultaneously modify the domain-set of both this instance and of a 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.- Specified by:
getDomainSetin interfaceField- Overrides:
getDomainSetin classFieldImpl- Returns:
- The actual domain-set of this instance.
-
setSample
public void setSample(int index, Data range) throws VisADException, java.rmi.RemoteExceptionDescription copied from class:FlatFieldSet the range value at the index-th sample- Specified by:
setSamplein interfaceField- Overrides:
setSamplein classFlatField- 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.
-
setSample
public void setSample(RealTuple domain, Data range) throws VisADException, java.rmi.RemoteException
Description copied from interface:Fieldset the range value at the sample nearest to domain- Specified by:
setSamplein interfaceField- Overrides:
setSamplein classFieldImpl- Throws:
VisADExceptionjava.rmi.RemoteException
-
setSample
public void setSample(int index, Data range, boolean copy) throws VisADException, java.rmi.RemoteExceptionDescription copied from class:FlatFieldSet the range value at the index-th sample- Specified by:
setSamplein interfaceField- Overrides:
setSamplein classFlatField- 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.
-
isMissing
public boolean isMissing()
Description copied from class:FlatFieldTest whether range values are missing
-
binary
public Data binary(Data data, int op, int sampling_mode, int error_mode) throws VisADException, java.rmi.RemoteException
Description copied from class:DataImplPointwise binary operation between this and data. Applies to Reals, Tuples (recursively to components), and to Field ranges (Field domains implicitly resampled if necessary). Does not apply to Field domains or Sets (regarded as domains of Fields wthout ranges). Data.ADD is only op defined for Text, interpreted as concatenate. MathTypes of this and data must match, or one may match the range of the other if it is a FunctionType.- Specified by:
binaryin interfaceData- Overrides:
binaryin classDataImpl- Parameters:
data- other Data operand for binary operationop- may be Data.ADD, Data.SUBTRACT, etc; these include all binary operations defined for Java primitive data typessampling_mode- may be Data.NEAREST_NEIGHBOR or Data.WEIGHTED_AVERAGEerror_mode- may be Data.INDEPENDENT, Data.DEPENDENT or Data.NO_ERRORS;- Returns:
- result, which takes the MathType of this unless the default Units of that MathType conflict with Units of the result, in which case a generic MathType with appropriate Units is constructed
- Throws:
VisADException- a VisAD error occurredjava.rmi.RemoteException- an RMI error occurred
-
binary
public Data binary(Data data, int op, MathType new_type, int sampling_mode, int error_mode) throws VisADException, java.rmi.RemoteException
Description copied from class:FlatFieldReturn 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 classFlatField- 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, int sampling_mode, int error_mode) throws VisADException, java.rmi.RemoteException
Description copied from class:DataImplPointwise unary operation applied to this. Applies to Reals, Tuples (recursively to components), and to Field ranges (Field domains implicitly resampled if necessary). Does not apply to Field domains, Sets (regarded as domains of Fields wthout ranges) or Text.- Specified by:
unaryin interfaceData- Overrides:
unaryin classDataImpl- Parameters:
op- may be Data.ABS, Data.ACOS, etc; these include all unary operations defined for Java primitive data typessampling_mode- may be Data.NEAREST_NEIGHBOR or Data.WEIGHTED_AVERAGEerror_mode- may be Data.INDEPENDENT, Data.DEPENDENT or Data.NO_ERRORS;- Returns:
- result of operation, which takes the MathType of this unless the default Units of that MathType conflict with Units of the result, in which case a generic MathType with appropriate Units is constructed
- Throws:
VisADException- a VisAD error occurredjava.rmi.RemoteException- an RMI error occurred
-
unary
public Data unary(int op, MathType new_type, int sampling_mode, int error_mode) throws VisADException
Description copied from class:FlatFieldReturn new FlatField with value 'this op'.- Specified by:
unaryin interfaceData- Overrides:
unaryin classFlatField- 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 object
-
unpackValues
public double[][] unpackValues() throws VisADExceptionunpack an array of doubles from field sample values according to the RangeSet-s; returns a copy- Overrides:
unpackValuesin classFlatField- Throws:
VisADException
-
unpackFloats
public float[][] unpackFloats() throws VisADExceptionunpack an array of floats from field sample values according to the RangeSet-s; returns a copy- Overrides:
unpackFloatsin classFlatField- Throws:
VisADException
-
extract
public Field extract(int component) throws VisADException, java.rmi.RemoteException
Description copied from class:FlatFieldextract field from this[].component; this is OK, when we get around to it- Specified by:
extractin interfaceField- Overrides:
extractin classFlatField- Throws:
VisADExceptionjava.rmi.RemoteException
-
domainFactor
public Field domainFactor(RealType factor) throws VisADException, java.rmi.RemoteException
Description copied from class:FieldImplFactors this instance into a (nested) field-of-fields. The type of the domain of the outer field will be the type specified. The type of the domains of the inner fields will be the remainder of the original domain after the outer domain is factored out. Range data is not copied for FieldImpls, but will be for FlatFields.- Specified by:
domainFactorin interfaceField- Overrides:
domainFactorin classFieldImpl- Parameters:
factor- The type of the domain for the outer field.- Returns:
- The field-of-fields realization of this instance.
- Throws:
DomainException- The domain of this instance cannot be factored as requested.VisADException- VisAD failure.java.rmi.RemoteException- Java RMI failure.- See Also:
for copy information
-
resample
public Field resample(Set set, int sampling_mode, int error_mode) throws VisADException, java.rmi.RemoteException
Description copied from class:FlatFieldResamples 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 classFlatField- 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
-
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 classFlatField- 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
Description copied from class:FlatFieldreturn a FlatField that clones this, except its ErrorEstimate-s are adjusted for sampling errors in error- Specified by:
adjustSamplingErrorin interfaceData- Overrides:
adjustSamplingErrorin classFlatFielderror_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 classFlatField
-
clone
public java.lang.Object clone()
Clones this instance. This implementation violates the generalclone()contract in that the returned object will compare unequal to this instance. As such, this method should probably not be invoked.
-
toString
public java.lang.String toString()
-
longString
public java.lang.String longString(java.lang.String pre)
- Specified by:
longStringin interfaceData- Overrides:
longStringin classFlatField- Parameters:
pre- String added to start of each line- Returns:
- a longer String than returned by toString(), indented by pre (a string of blanks)
-
-
DMelt 3.0 © DataMelt by jWork.ORG