Class LocationEstimator

java.lang.Object
noaa.coastwatch.util.LocationEstimator

public class LocationEstimator extends Object
The LocationEstimator class uses a reference and target earth transform to estimate the data location of a target point given a reference point. The following diagram shows the two reference frames, with an arrow showing the direction of estimation:
   *----*----*      *----*----*
   |        /----------\      |
   |       L |      |   o     |
   |       o |      |         |   target = f(ref)
   | target  |      |  ref    |
   | point   |      |  point  |
   *----*----*      *----*----*
 
An earth partition is used to divide the reference into equal size partitions, upon which a set of polynomials is calculated to estimate locations. Currently the location estimator class is limited to 2D earth transforms. The location lookup operation has two modes: accurate and fast. In accurate mode, partitions with insufficient data coverage from the target transform are queried by performing the data location transform explicitly. In fast mode, partitions with insufficient coverage return an invalid data location for any query point. WARNING: This class is not thread-safe.
Since:
3.1.2
Author:
Peter Hollemans
See Also:
  • Field Details

    • FAST

      public static final int FAST
      The fast location query mode.
      See Also:
    • ACCURATE

      public static final int ACCURATE
      The accurate location query mode.
      See Also:
    • MAX_INTERVALS

      public static final int MAX_INTERVALS
      The maximum number of data sampling intervals within one partition.
      See Also:
  • Constructor Details

    • LocationEstimator

      public LocationEstimator(EarthTransform refTrans, int[] refDims, EarthTransform targetTrans, int[] targetDims, AffineTransform targetNav, double size) throws UnsupportedOperationException
      Creates a location estimator based on the specified Earth transforms. By default, the query mode is set to ACCURATE.
      Parameters:
      refTrans - the reference earth transform. This is the transform against which data location queries will be made.
      refDims - the reference dimensions. Queries are limited to locations within these dimensions.
      targetTrans - the target earth transform. This is the transform for which queries will return a data location.
      targetDims - the target dimensions. Target points outside these dimensions are considered out of bounds.
      targetNav - the target navigation transform. If not null, this transformation is used to correct coordinate locations in the target transform prior to calculating the polynomial estimators.
      size - the estimation polynomial size in kilometers.
      Throws:
      UnsupportedOperationException - if the dimension rank is not supported.
  • Method Details

    • setQueryMode

      public void setQueryMode(int mode)
      Sets the location query mode, FAST or ACCURATE.
    • getLocation

      public DataLocation getLocation(DataLocation refLoc, DataLocation targetLoc)
      Gets the target location for the specified reference location.
      Parameters:
      refLoc - the reference location.
      targetLoc - the target location or null. If null, an object is created and returned. If non-null, the object is simply modified.
      Returns:
      the target location. The target location may be invalid if an error occurred in calculation or if the specified reference location has no valid target location.
    • getLocation

      public DataLocation getLocation(DataLocation refLoc)
      Gets the target location for the specified reference location.
      Parameters:
      refLoc - the reference location.
      Returns:
      the target location. The target location may be invalid if an error occurred in calculation or if the specified reference location has no valid target location.