Class FieldImpl
- java.lang.Object
-
- visad.ThingImpl
-
- visad.DataImpl
-
- visad.FunctionImpl
-
- visad.FieldImpl
-
- Direct Known Subclasses:
- FileField, FlatField, ImageSequenceImpl
public class FieldImpl extends FunctionImpl implements Field
FieldImpl is the VisAD class for finite samplings of functions from R^n to a range type, where n>0. The DomainSet, DomainUnits and DomainCoordinateSystem variables of FieldImpl are immutable.A FieldImpl domain type may be either a RealType (for a function with domain = R) or a RealTupleType (for a function with domain = R^n for n > 0).
- 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 FieldImpl(FunctionType type)construct a FieldImpl from type; use default Set of FunctionType domain; initial values are missingFieldImpl(FunctionType type, Set set)Constructs from the type of function and a set of domain points.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description Data__getitem__(int index)A wrapper aroundgetSamplefor JPython.int__len__()A wrapper aroundgetLengthfor JPython.void__setitem__(int index, Data data)A wrapper aroundsetSamplefor JPython.void__setitem__(int index, double data)A wrapper aroundsetSamplefor JPython.DataadjustSamplingError(Data error, int error_mode)return a Field 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'; test for various relations between types of this and datajava.lang.Objectclone()Clones this instance.static Fieldcombine(Field[] fields)Resample all elements of the fields array to the domain set of fields[0], then return a Field whose range samples are Tuples merging the corresponding range samples from each element of fields; if the range of fields[i] is a Tuple without a RangeCoordinateSystem, then each Tuple component of a range sample of fields[i] becomes a Tuple component of a range sample of the result - otherwise a range sample of fields[i] becomes a Tuple component of a range sample of the result; this assumes all elements of the fields array have the same domain dimension; use default sampling_mode (Data.NEAREST_NEIGHBOR) and default error_mode (Data.NO_ERRORS)static Fieldcombine(Field[] fields, boolean flatten)Resample all elements of the fields array to the domain set of fields[0], then return a Field whose range samples are Tuples merging the corresponding range samples from each element of fields.static Fieldcombine(Field[] fields, int sampling_mode, int error_mode)resample all elements of the fields array to the domain set of fields[0], then return a Field whose range samples are Tuples merging the corresponding range samples from each element of fields; if the range of fields[i] is a Tuple without a RangeCoordinateSystem, then each Tuple component of a range sample of fields[i] becomes a Tuple component of a range sample of the result - otherwise a range sample of fields[i] becomes a Tuple component of a range sample of the result; this assumes all elements of the fields array have the same domain dimensionstatic Fieldcombine(Field[] fields, int sampling_mode, int error_mode, boolean flatten)Resample all elements of the fields array to the domain set of fields[0], then return a Field whose range samples are Tuples merging the corresponding range samples from each element of fields.static Fieldcombine(Field[] fields, int sampling_mode, int error_mode, boolean flatten, boolean copy)Resample all elements of the fields array to the domain set of fields[0], then return a Field whose range samples are Tuples merging the corresponding range samples from each element of fields.DataShadowcomputeRanges(ShadowType type, DataShadow shadow)Recursive version of computeRanges(), called down through Data object tree.Dataderivative(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_modejava.util.EnumerationdomainEnumeration()Here's how to use this: for (Enumeration e = field.domainEnumeration() ; e.hasMoreElements(); ) { RealTuple domain_sample = (RealTuple) e.nextElement(); Data range = field.evaluate(domain_sample); }FielddomainFactor(RealType factor)Factors this instance into a (nested) field-of-fields.FielddomainFactor(RealType factor, boolean copy)Factors this instance into a (nested) field-of-fields.FielddomainMultiply()Combine domains of two outermost nested Fields into a single domain and Field.FielddomainMultiply(CoordinateSystem resultCS)Combine domains of two outermost nested Fields into a single domain and Field.FielddomainMultiply(int collapse_depth)Combine domains ofcollapse_depthif possible.FielddomainMultiply(int collapse_depth, CoordinateSystem resultCS)Combine domains ofcollapse_depthif possible.booleanequals(java.lang.Object obj)Fieldextract(int component)extract field from this[].componentFieldextract(MathType type)extract Field from this.component using the MathType of one of the range componenetsFieldextract(java.lang.String name)extract Field from this.component using the name of one of the range componenetsUnit[]getDefaultRangeUnits()get default range Unit-s for 'Flat' componentsCoordinateSystemgetDomainCoordinateSystem()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()invokes getFloats(true)float[][]getFloats(boolean copy)get range values for 'Flat' components in their default range Units (as defined by the range of this FieldImpl's FunctionType); the return array is dimensioned float[number_of_range_components][number_of_range_samples]; copy is ignored for FieldImplintgetLength()get number of samplesCoordinateSystem[]getRangeCoordinateSystem()Get range CoordinateSystem for 'RealTuple' range; second index enumerates samples.CoordinateSystem[]getRangeCoordinateSystem(int component)get range CoordinateSystem for 'RealTuple' components; second index enumerates samplesUnit[][]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 enumerates samples since Units may differ between samplesDatagetSample(int index)Get the range value at the index-th sample.DatagetSample(int index, boolean metadataOnly)Get the metadata for the range value at the index-th sample.java.lang.String[][]getStringValues()get range values for Text components; the return array is dimensioned double[number_of_range_components][number_of_range_samples]double[][]getValues()invokes getValues(true)double[][]getValues(boolean copy)get range values for 'Flat' components in their default range Units (as defined by the range of this FieldImpl's FunctionType); the return array is dimensioned double[number_of_range_components][number_of_range_samples]; copy is ignored for FieldImplbooleanisFlatField()return true if this a FlatField or a RemoteField adapting a FlatFieldbooleanisMissing()test whether Field value is missingjava.lang.StringlongString(java.lang.String pre)Fieldresample(Set set, int sampling_mode, int error_mode)Resample range values of this Field to domain samples in set either byt nearest neighbor or multi-linear interpolation.FieldresampleDouble(Set set, int sampling_mode, int error_mode)Resample range values of this Field to domain samples in set either byt nearest neighbor or multi-linear interpolation.voidsetSample(int index, Data range)Set the range value at the index-th sample; makes a local copyvoidsetSample(int index, Data range, boolean copy)Set the range value at the index-th samplevoidsetSample(int index, Data range, boolean copy, boolean checkRangeType)Set the range value at the index-th samplevoidsetSample(RealTuple domain, Data range)set the range value at the sample nearest to domainvoidsetSample(RealTuple domain, Data range, boolean copy)set the range value at the sample nearest to domainvoidsetSamples(Data[] range, boolean copy)Set the range samples of the function; the order of range samples must be the same as the order of domain indices in the DomainSet; copy range objects if copy is true;voidsetSamples(Data[] range, boolean copy, boolean checkAllRangeTypes)Set the range samples of the function; the order of range samples must be the same as the order of domain indices in the DomainSet; copy range objects if copy is true; should use same MathType object in each Data object in range arrayvoidsetSamples(double[][] range)set range array as range values of this FieldImpl; this must have a Flat range; 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)set range array as range values of this FieldImpl; this must have a Flat range; 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 DomainSetDataunary(int op, MathType new_type, int sampling_mode, int error_mode)return new Field with value 'op this'-
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, main, 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, toString, 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.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, 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
-
FieldImpl
public FieldImpl(FunctionType type) throws VisADException
construct a FieldImpl from type; use default Set of FunctionType domain; initial values are missing- Throws:
VisADException
-
FieldImpl
public FieldImpl(FunctionType type, Set set) throws VisADException
Constructs from the type of function and a set of domain points.- Parameters:
type- The type of function.set- The set of domain points. Defines the units and any coordinate system transformation for the domain of the funciton. May benull, in which case the default domain set (FunctionType.getDomain()) is used. May not beFloatSetorDoubleSet. If non-null, then must be compatible with the domain of the FunctionType.- Throws:
CoordinateSystemException- if theCoordinateSystemof the domain set isnullbut theCoordinateSystemof the domain of the FunctionType} is not; or if bothCoordinateSystems are non-nulland do not have the same referenceRealTupleType.VisADException- if a VisAD failure occurs.
-
-
Method Detail
-
setSamples
public void setSamples(Data[] range, boolean copy) throws VisADException, java.rmi.RemoteException
Set the range samples of the function; the order of range samples must be the same as the order of domain indices in the DomainSet; copy range objects if copy is true;- Specified by:
setSamplesin interfaceField- Parameters:
range- The range valuescopy- should the range values be copied- Throws:
VisADExceptionjava.rmi.RemoteException
-
setSamples
public void setSamples(Data[] range, boolean copy, boolean checkAllRangeTypes) throws VisADException, java.rmi.RemoteException
Set the range samples of the function; the order of range samples must be the same as the order of domain indices in the DomainSet; copy range objects if copy is true; should use same MathType object in each Data object in range array- Parameters:
range- The range valuescopy- should the range values be copiedcheckAllRangeTypes- If true then ensure that the MathType of each element in the range matches the type of this field. If false then only check the first range element. This is the "trust the calling method" flag. If you pass in false and there are elements in the range whose type does not match the type of this field then this may result in hard-to-track-down bugs.- Throws:
VisADExceptionjava.rmi.RemoteException
-
getDomainSet
public Set getDomainSet()
Returns 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- Returns:
- The actual domain-set of this instance.
-
getDomainUnits
public Unit[] getDomainUnits()
Returns 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 classFunctionImpl- 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 classFunctionImpl- Returns:
- CoordinateSystem of the domain
-
getStringValues
public java.lang.String[][] getStringValues() throws VisADException, java.rmi.RemoteExceptionget range values for Text components; the return array is dimensioned double[number_of_range_components][number_of_range_samples]- Specified by:
getStringValuesin interfaceField- Throws:
VisADExceptionjava.rmi.RemoteException
-
getFloats
public float[][] getFloats() throws VisADException, java.rmi.RemoteExceptionDescription copied from interface:Fieldinvokes getFloats(true)- Specified by:
getFloatsin interfaceField- Throws:
VisADExceptionjava.rmi.RemoteException
-
getFloats
public float[][] getFloats(boolean copy) throws VisADException, java.rmi.RemoteExceptionget range values for 'Flat' components in their default range Units (as defined by the range of this FieldImpl's FunctionType); the return array is dimensioned float[number_of_range_components][number_of_range_samples]; copy is ignored for FieldImpl- Specified by:
getFloatsin interfaceField- Throws:
VisADExceptionjava.rmi.RemoteException
-
getValues
public double[][] getValues() throws VisADException, java.rmi.RemoteExceptionDescription copied from interface:Fieldinvokes getValues(true)- Specified by:
getValuesin interfaceField- Throws:
VisADExceptionjava.rmi.RemoteException
-
getValues
public double[][] getValues(boolean copy) throws VisADException, java.rmi.RemoteExceptionget range values for 'Flat' components in their default range Units (as defined by the range of this FieldImpl's FunctionType); the return array is dimensioned double[number_of_range_components][number_of_range_samples]; copy is ignored for FieldImpl- Specified by:
getValuesin interfaceField- Throws:
VisADExceptionjava.rmi.RemoteException
-
setSamples
public void setSamples(double[][] range) throws VisADException, java.rmi.RemoteExceptionset range array as range values of this FieldImpl; this must have a Flat range; 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- Throws:
VisADExceptionjava.rmi.RemoteException
-
setSamples
public void setSamples(float[][] range) throws VisADException, java.rmi.RemoteExceptionset range array as range values of this FieldImpl; this must have a Flat range; 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- Throws:
VisADExceptionjava.rmi.RemoteException
-
getRangeUnits
public Unit[][] getRangeUnits() throws VisADException, java.rmi.RemoteException
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 enumerates samples since Units may differ between samples- Specified by:
getRangeUnitsin interfaceField- Throws:
VisADExceptionjava.rmi.RemoteException
-
getRangeCoordinateSystem
public CoordinateSystem[] getRangeCoordinateSystem() throws VisADException, java.rmi.RemoteException
Get range CoordinateSystem for 'RealTuple' range; second index enumerates samples.- Specified by:
getRangeCoordinateSystemin interfaceField- Returns:
- range CoordinateSystem assuming range type is a RealTupleType (throws a TypeException if its not); this may differ from default CoordinateSystem of range RealTupleType, but must be convertable; the index enumerates samples since Units may differ between samples
- Throws:
VisADExceptionjava.rmi.RemoteException
-
getRangeCoordinateSystem
public CoordinateSystem[] getRangeCoordinateSystem(int component) throws VisADException, java.rmi.RemoteException
get range CoordinateSystem for 'RealTuple' components; second index enumerates samples- Specified by:
getRangeCoordinateSystemin interfaceField- Throws:
VisADExceptionjava.rmi.RemoteException
-
getDefaultRangeUnits
public Unit[] getDefaultRangeUnits()
get default range Unit-s for 'Flat' components- Specified by:
getDefaultRangeUnitsin interfaceField
-
getSample
public Data getSample(int index) throws VisADException, java.rmi.RemoteException
Get the range value at the index-th sample. The actual range value is returned -- not a copy.
This implementation uses
getSample(int, boolean).- Specified by:
getSamplein interfaceField- Parameters:
index- index of requested range sample- Returns:
- range value at sample index
- Throws:
VisADExceptionjava.rmi.RemoteException
-
getSample
public Data getSample(int index, boolean metadataOnly) throws VisADException, java.rmi.RemoteException
Get the metadata for the range value at the index-th sample. If the range value is also requested, then the actual range value is returned -- not a copy.- Parameters:
index- index of requested range samplemetadataOnly- true if only the metadata is needed, false if both metadata and data are desired.- Throws:
VisADExceptionjava.rmi.RemoteException
-
setSample
public void setSample(RealTuple domain, Data range, boolean copy) throws VisADException, java.rmi.RemoteException
set the range value at the sample nearest to domain- Specified by:
setSamplein interfaceField- Throws:
VisADExceptionjava.rmi.RemoteException
-
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- Throws:
VisADExceptionjava.rmi.RemoteException
-
setSample
public void setSample(int index, Data range) throws VisADException, java.rmi.RemoteExceptionSet the range value at the index-th sample; makes a local copy- Specified by:
setSamplein interfaceField- Parameters:
index- index in domainrange- sample at that index- Throws:
VisADExceptionjava.rmi.RemoteException
-
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- Parameters:
index- index in domainrange- sample at that indexcopy- true to make a copy- Throws:
VisADExceptionjava.rmi.RemoteException
-
setSample
public void setSample(int index, Data range, boolean copy, boolean checkRangeType) throws VisADException, java.rmi.RemoteExceptionSet the range value at the index-th sample- Parameters:
index- index in domainrange- sample at that indexcopy- true to make a copycheckRangeType- setting to false will not check to make sure that the sample MathType is the same as this FieldImpl's range. This saves on time at the expense of accuracy. Use this only if you like shooting yourself in the foot.- Throws:
VisADExceptionjava.rmi.RemoteException
-
isMissing
public boolean isMissing()
test whether Field value is missing
-
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- 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 typesnew_type- MathType of the resultsampling_mode- may be Data.NEAREST_NEIGHBOR or Data.WEIGHTED_AVERAGEerror_mode- may be Data.INDEPENDENT, Data.DEPENDENT or Data.NO_ERRORS;- Returns:
- result, with MathType = new_type
- 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, java.rmi.RemoteException
return new Field with value 'op this'- 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 typesnew_type- MathType of the resultsampling_mode- may be Data.NEAREST_NEIGHBOR or Data.WEIGHTED_AVERAGEerror_mode- may be Data.INDEPENDENT, Data.DEPENDENT or Data.NO_ERRORS;- Returns:
- result, with MathType = new_type
- Throws:
VisADException- a VisAD error occurredjava.rmi.RemoteException- an RMI error occurred
-
combine
public static Field combine(Field[] fields) throws VisADException, java.rmi.RemoteException
Resample all elements of the fields array to the domain set of fields[0], then return a Field whose range samples are Tuples merging the corresponding range samples from each element of fields; if the range of fields[i] is a Tuple without a RangeCoordinateSystem, then each Tuple component of a range sample of fields[i] becomes a Tuple component of a range sample of the result - otherwise a range sample of fields[i] becomes a Tuple component of a range sample of the result; this assumes all elements of the fields array have the same domain dimension; use default sampling_mode (Data.NEAREST_NEIGHBOR) and default error_mode (Data.NO_ERRORS)- Parameters:
fields- fields to combine- Returns:
- combined fields
- Throws:
VisADExceptionjava.rmi.RemoteException
-
combine
public static Field combine(Field[] fields, boolean flatten) throws VisADException, java.rmi.RemoteException
Resample all elements of the fields array to the domain set of fields[0], then return a Field whose range samples are Tuples merging the corresponding range samples from each element of fields. Ifflattenis true and if the range of fields[i] is a Tuple without a RangeCoordinateSystem, then each Tuple component of a range sample of fields[i] becomes a Tuple component of a range sample of the result - otherwise a range sample of fields[i] becomes a Tuple component of a range sample of the result; this assumes all elements of the fields array have the same domain dimension; use default sampling_mode (Data.NEAREST_NEIGHBOR) and default error_mode (Data.NO_ERRORS)- Parameters:
fields- fields to combineflatten- true to flatten range tuples with no CoordinateSystem- Returns:
- combined fields
- Throws:
VisADExceptionjava.rmi.RemoteException
-
combine
public static Field combine(Field[] fields, int sampling_mode, int error_mode) throws VisADException, java.rmi.RemoteException
resample all elements of the fields array to the domain set of fields[0], then return a Field whose range samples are Tuples merging the corresponding range samples from each element of fields; if the range of fields[i] is a Tuple without a RangeCoordinateSystem, then each Tuple component of a range sample of fields[i] becomes a Tuple component of a range sample of the result - otherwise a range sample of fields[i] becomes a Tuple component of a range sample of the result; this assumes all elements of the fields array have the same domain dimension- Throws:
VisADExceptionjava.rmi.RemoteException
-
combine
public static Field combine(Field[] fields, int sampling_mode, int error_mode, boolean flatten) throws VisADException, java.rmi.RemoteException
Resample all elements of the fields array to the domain set of fields[0], then return a Field whose range samples are Tuples merging the corresponding range samples from each element of fields. Ifflattenis true and if the range of fields[i] is a Tuple without a RangeCoordinateSystem, then each Tuple component of a range sample of fields[i] becomes a Tuple component of a range sample of the result - otherwise a range sample of fields[i] becomes a Tuple component of a range sample of the result; this assumes all elements of the fields array have the same domain dimension.- Parameters:
fields- fields to combinesampling_mode- sampling mode to use (e.g., Data.NEAREST_NEIGHBOR)error_mode- error mode to use (e.g., Data.NO_ERRORS)flatten- true to flatten range tuples with no CoordinateSystem- Returns:
- combined fields
- Throws:
VisADExceptionjava.rmi.RemoteException
-
combine
public static Field combine(Field[] fields, int sampling_mode, int error_mode, boolean flatten, boolean copy) throws VisADException, java.rmi.RemoteException
Resample all elements of the fields array to the domain set of fields[0], then return a Field whose range samples are Tuples merging the corresponding range samples from each element of fields. Ifflattenis true and if the range of fields[i] is a Tuple without a RangeCoordinateSystem, then each Tuple component of a range sample of fields[i] becomes a Tuple component of a range sample of the result - otherwise a range sample of fields[i] becomes a Tuple component of a range sample of the result; this assumes all elements of the fields array have the same domain dimension.- Parameters:
fields- fields to combinesampling_mode- sampling mode to use (e.g., Data.NEAREST_NEIGHBOR)error_mode- error mode to use (e.g., Data.NO_ERRORS)flatten- true to flatten range tuples with no CoordinateSystemcopy- true to copy the values from the original fields- Returns:
- combined fields
- Throws:
VisADExceptionjava.rmi.RemoteException
-
extract
public Field extract(MathType type) throws VisADException, java.rmi.RemoteException
extract Field from this.component using the MathType of one of the range componenets- Throws:
VisADExceptionjava.rmi.RemoteException
-
extract
public Field extract(java.lang.String name) throws VisADException, java.rmi.RemoteException
extract Field from this.component using the name of one of the range componenets- Throws:
VisADExceptionjava.rmi.RemoteException
-
extract
public Field extract(int component) throws VisADException, java.rmi.RemoteException
extract field from this[].component- Specified by:
extractin interfaceField- Throws:
VisADExceptionjava.rmi.RemoteException
-
domainFactor
public Field domainFactor(RealType factor) throws DomainException, VisADException, java.rmi.RemoteException
Factors 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- 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
-
domainFactor
public Field domainFactor(RealType factor, boolean copy) throws DomainException, VisADException, java.rmi.RemoteException
Factors 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 copied if- Parameters:
factor- The type of the domain for the outer field.copy- true to make copies of the data objects- 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.
-
domainMultiply
public Field domainMultiply() throws VisADException, java.rmi.RemoteException
Combine domains of two outermost nested Fields into a single domain and Field. If the domains each haveCoordinateSystem-s the new domain will have aCartesianProductCoordinateSystemof Set-s CoordinateSystems- Specified by:
domainMultiplyin interfaceField- Throws:
VisADException- unable to collapse domainsjava.rmi.RemoteException- unable to collapse domains of remote data
-
domainMultiply
public Field domainMultiply(CoordinateSystem resultCS) throws VisADException, java.rmi.RemoteException
Combine domains of two outermost nested Fields into a single domain and Field. The suppliedresultCSwould be used for the new domain- Parameters:
resultCS- CoordinateSystem to use for the new domain set- Throws:
VisADException- unable to collapse domainsjava.rmi.RemoteException- unable to collapse domains of remote data
-
domainMultiply
public Field domainMultiply(int collapse_depth) throws VisADException, java.rmi.RemoteException
Combine domains ofcollapse_depthif possible.- Specified by:
domainMultiplyin interfaceField- Parameters:
collapse_depth- depth to collapse to- Throws:
VisADException- unable to collapse domainsjava.rmi.RemoteException- unable to collapse domains of remote data
-
domainMultiply
public Field domainMultiply(int collapse_depth, CoordinateSystem resultCS) throws VisADException, java.rmi.RemoteException
Combine domains ofcollapse_depthif possible. UseresultCSas the CoordinateSystem for the new domain.- Parameters:
collapse_depth- depth to collapse toresultCS- CoordinateSystem to use for the new domain set- Throws:
VisADException- unable to collapse domainsjava.rmi.RemoteException- unable to collapse domains of remote data
-
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- Specified by:
derivativein classFunctionImpl- 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- Specified by:
derivativein classFunctionImpl- 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- Specified by:
derivativein classFunctionImpl- 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- Specified by:
derivativein classFunctionImpl- 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- Specified by:
derivativein classFunctionImpl- Throws:
VisADExceptionjava.rmi.RemoteException
-
resample
public Field resample(Set set, int sampling_mode, int error_mode) throws VisADException, java.rmi.RemoteException
Resample range values of this Field to domain samples in set either byt nearest neighbor or multi-linear interpolation. NOTE: this code is very similar to resample in FlatField.java- Specified by:
resamplein interfaceFunction- Specified by:
resamplein classFunctionImpl- Parameters:
set- finite sampling values for the function.sampling_mode- type of interpolation to perform (e.g., Data.WEIGHTED_AVERAGE, Data.NEAREST_NEIGHBOR)error_mode- type of error estimation to perform (e.g., Data.INDEPENDENT, Data.DEPENDENT, Data.NO_ERRORS)- Returns:
- Data object corresponding to the function value at that domain, using the sampling_mode and error_modes specified. 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
Resample range values of this Field to domain samples in set either byt nearest neighbor or multi-linear interpolation. NOTE: this code is very similar to resample in FlatField.java- Parameters:
set- finite sampling values for the function.sampling_mode- type of interpolation to perform (e.g., Data.WEIGHTED_AVERAGE, Data.NEAREST_NEIGHBOR)error_mode- type of error estimation to perform (e.g., Data.INDEPENDENT, Data.DEPENDENT, Data.NO_ERRORS)- Returns:
- Data object corresponding to the function value at that domain, using the sampling_mode and error_modes specified. 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, java.rmi.RemoteException
Description copied from interface:DataRecursive version of computeRanges(), called down through Data object tree.- Specified by:
computeRangesin interfaceData- 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 occurredjava.rmi.RemoteException- an RMI error occurred
-
adjustSamplingError
public Data adjustSamplingError(Data error, int error_mode) throws VisADException, java.rmi.RemoteException
return a Field that clones this, except its ErrorEstimate-s are adjusted for sampling errors in error- Specified by:
adjustSamplingErrorin interfaceData- Overrides:
adjustSamplingErrorin classDataImplerror_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
-
__len__
public int __len__() throws VisADException, java.rmi.RemoteExceptionA wrapper aroundgetLengthfor JPython.- Throws:
VisADExceptionjava.rmi.RemoteException
-
__getitem__
public Data __getitem__(int index) throws VisADException, java.rmi.RemoteException
A wrapper aroundgetSamplefor JPython.- Throws:
VisADExceptionjava.rmi.RemoteException
-
__setitem__
public void __setitem__(int index, Data data) throws VisADException, java.rmi.RemoteExceptionA wrapper aroundsetSamplefor JPython.- Throws:
VisADExceptionjava.rmi.RemoteException
-
__setitem__
public void __setitem__(int index, double data) throws VisADException, java.rmi.RemoteExceptionA wrapper aroundsetSamplefor JPython.- Throws:
VisADExceptionjava.rmi.RemoteException
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedExceptionClones this instance. The
MathType, domainSet, andCoordinateSystemare shallow copied. Each range value, however, has itsclone()method invoked.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.
-
longString
public java.lang.String longString(java.lang.String pre) throws VisADException, java.rmi.RemoteException- Specified by:
longStringin interfaceData- Overrides:
longStringin classDataImpl- 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:
VisADExceptionjava.rmi.RemoteException
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
domainEnumeration
public java.util.Enumeration domainEnumeration() throws VisADException, java.rmi.RemoteExceptionHere's how to use this: for (Enumeration e = field.domainEnumeration() ; e.hasMoreElements(); ) { RealTuple domain_sample = (RealTuple) e.nextElement(); Data range = field.evaluate(domain_sample); }- Specified by:
domainEnumerationin interfaceField- Throws:
VisADExceptionjava.rmi.RemoteException
-
-
DMelt 3.0 © DataMelt by jWork.ORG