Class VariableEstimator

java.lang.Object
noaa.coastwatch.util.VariableEstimator
All Implemented Interfaces:
Encodable, ValueSource

public class VariableEstimator extends Object implements Encodable, ValueSource
The VariableEstimator class provides an approximation of smoothly changing variable data using quadratic polynomials. Currently only 1D and 2D data variables are supported. The estimator uses an EarthPartition object and derives the polynomials individually on each partition. If the polynomials cannot be derived for a given partition (due to small partition size or missing data values), a Double.NaN value is returned by getValue(noaa.coastwatch.util.DataLocation) for any location in the affected partition.
Since:
3.1.0
Author:
Peter Hollemans
  • Constructor Details

    • VariableEstimator

      public VariableEstimator(DataVariable var, VariableEstimator est)
      Constructs a variable estimator for the specified variable using the same earth transform and partitioning as the specified variable estimator.
      Parameters:
      var - the data variable for estimation.
      est - the variable estimator to use for earth partitioning information.
    • VariableEstimator

      public VariableEstimator(DataVariable var, Filter filter, VariableEstimator est)
      Constructs a variable estimator for the specified variable and filter using the same earth transform and partitioning as the specified variable estimator.
      Parameters:
      var - the data variable for estimation.
      filter - the data filtering function. The filter is called with the data value array for each partition prior to creating the estimator object.
      est - the variable estimator to use for earth partitioning information.
    • VariableEstimator

      public VariableEstimator(DataVariable var, EarthTransform trans, double maxSize, int[] maxDims) throws UnsupportedOperationException
      Constructs a variable estimator for the specified variable and earth transform.
      Parameters:
      var - the data variable for estimation.
      trans - the earth transform to use for partitioning.
      maxSize - the maximum polynomial partition size in kilometers.
      maxDims - the maximum partition size in any dimension in terms of data locations.
      Throws:
      UnsupportedOperationException - if the variable rank is not supported.
      See Also:
    • VariableEstimator

      public VariableEstimator(DataVariable var, Filter filter, EarthTransform trans, double maxSize, int[] maxDims) throws UnsupportedOperationException
      Constructs a variable estimator for the specified variable, filter, and earth transform.
      Parameters:
      var - the data variable for estimation.
      filter - the data filtering function. The filter is called with the data value array for each partition prior to creating the estimator object.
      trans - the earth transform to use for partitioning.
      maxSize - the maximum polynomial partition size in kilometers.
      maxDims - the maximum partition size in any dimension in terms of data locations.
      Throws:
      UnsupportedOperationException - if the variable rank is not supported.
      See Also:
    • VariableEstimator

      public VariableEstimator(Object obj)
      Constructs a variable estimator from the specified encoding. The encoding must be a valid encoding of the estimator as created by getEncoding.
      Parameters:
      obj - the object encoding.
      See Also:
    • VariableEstimator

      public VariableEstimator(Object obj, VariableEstimator est)
      Constructs a variable estimator from the specified encoding and the same earth transform and partitioning as the specified variable estimator.
      Parameters:
      obj - the variable estimator encoding.
      est - the variable estimator to use for earth partitioning information.
  • Method Details

    • getValue

      public double getValue(DataLocation loc)
      Gets an estimated variable value. The value is calculated using the polynomial approximation function.
      Specified by:
      getValue in interface ValueSource
      Parameters:
      loc - the data value location.
      Returns:
      the estimated value, or Double.NaN if no value could be estimated.
    • getEncoding

      public Object getEncoding()
      Gets an encoded representation of this variable estimator. The encoding may later be used to recreate the estimator without using the original variable data.
      Specified by:
      getEncoding in interface Encodable
      Returns:
      the object encoding. The encoding object is an Object[3] array containing:
      • a BitSet object used for encoding partition structure information
      • a List of double[] coordinates specifying partition boundaries as min and max (2 arrays per partition)
      • a List of double[] arrays specifying partition estimator coefficients
      See Also:
    • useEncoding

      public void useEncoding(Object obj)
      Constructs an estimator from the specified encoding. The encoding must be a valid encoding of an estimator as created by getEncoding.
      Specified by:
      useEncoding in interface Encodable
      Parameters:
      obj - the object encoding.
      See Also: