Class DataProjection

All Implemented Interfaces:
Cloneable

public class DataProjection extends EarthTransform2D
The DataProjection class implements earth transform calculations for data coordinates with explicit latitude and longitude data. The only possible operation is translation from data coordinates to geographic coordinates -- the reverse is not implemented.
Since:
3.1.0
Author:
Peter Hollemans
  • Field Details

  • Constructor Details

    • DataProjection

      public DataProjection(DataVariable lat, DataVariable lon)
      Constructs a data projection from the specified latitude and longitude data.
      Parameters:
      lat - a data variable containing latitude data.
      lon - a data variable containing longitude data.
  • Method Details

    • getLat

      public DataVariable getLat()
      Gets the latitude variable used in this projection.
    • getLon

      public DataVariable getLon()
      Gets the longitude variable used in this projection.
    • describe

      public String describe()
      Description copied from class: EarthTransform
      Gets a string describing the earth transform type.
      Specified by:
      describe in class EarthTransform
    • transformImpl

      protected void transformImpl(DataLocation dataLoc, EarthLocation earthLoc)
      Description copied from class: EarthTransform
      Implements the data to geographic transform.
      Specified by:
      transformImpl in class EarthTransform
      See Also:
    • transformImpl

      protected void transformImpl(EarthLocation earthLoc, DataLocation dataLoc)
      Description copied from class: EarthTransform
      Implements the geographic to data transform.
      Specified by:
      transformImpl in class EarthTransform
      See Also:
    • median

      public static double median(List<Double> values)
      Gets the median value in a list of double values. A side effect is that the parameter list is sorted.
      Parameters:
      values - the list of values to return the median.
      Returns:
      the median value or Double.NaN if the list length is zero.
      Since:
      3.8.1
    • closest

      public DataLocation closest(EarthLocation targetEarthLoc, DataLocation targetDataLoc)
      Description copied from class: EarthTransform
      Gets the closest integer data location to a specified geographic location.
      Overrides:
      closest in class EarthTransform
      Parameters:
      targetEarthLoc - the target earth location to locate the closest valid data location.
      targetDataLoc - the data location or null. If null, an object is created and returned. If non-null, the object is simply modified.
      Returns:
      the data location. The data location may be marked invalid if no closest data location can be found within the data location bounds of this transform.
    • closestBySearch

      public DataLocation closestBySearch(EarthLocation targetEarthLoc, DataLocation targetDataLoc)
      Searches for the closest integer data location to a specified geographic location by computing the distance to each earth location in the data and finding the minimum. This routine is meant to be used for testing and comparison purposes only.
      Parameters:
      targetEarthLoc - the target earth location to locate the closest valid data location.
      targetDataLoc - the data location or null. If null, an object is created and returned. If non-null, the object is simply modified.
      Returns:
      the data location.
      Since:
      3.8.1
      See Also:
    • testClosest

      public void testClosest()
    • isInvertible

      public boolean isInvertible()
      Description copied from class: EarthTransform
      Determines if this transform is invertible. All transforms should translate from data location to geographic location. But to be invertible, the transform must also translate from geographic location back to data location. This method returns true unless overridden by the child class.
      Overrides:
      isInvertible in class EarthTransform
      Returns:
      true if this transform is invertible or false if not.
    • equals

      public boolean equals(Object obj)
      Compares the specified object with this data projection for equality. The latitudes and longitudes of the two data projections are compared value by value.
      Overrides:
      equals in class Object
      Parameters:
      obj - the object to be compared for equality.
      Returns:
      true if the data projections are equivalent, or false if not.