Class EarthPartition

java.lang.Object
noaa.coastwatch.util.EarthPartition
All Implemented Interfaces:
Encodable

public class EarthPartition extends Object implements Encodable
The EarthPartition class sets up a partitioning of earth data such that no individual partition has physical size exceeding a user-specified tolerance. The physical size along each dimension is measured in terms of the earth transform distance() metric. After construction, child partitions may be retrieved and manipulated.
Since:
3.1.0
Author:
Peter Hollemans
  • Constructor Details

    • EarthPartition

      public EarthPartition(EarthTransform trans, DataLocation min, DataLocation max, double maxSize, int[] maxDims)
      Constructs an earth partitioning from the specified earth transform, extents, and size tolerance. The partition is assumed to be the root, in which case a check is performed for an earth wrapping swath.
      Parameters:
      trans - the earth transform to use.
      min - the starting data location for partitioning.
      max - the ending data location for partitioning.
      maxSize - the maximum partition size in any dimension in terms of the EarthTransform.distance(noaa.coastwatch.util.DataLocation, noaa.coastwatch.util.DataLocation) metric.
      maxDims - the maximum partition size in any dimension in terms of data locations.
    • EarthPartition

      protected EarthPartition(EarthTransform trans, DataLocation min, DataLocation max, double maxSize, int[] maxDims, boolean isRoot)
      Constructs an earth partitioning from the specified earth transform, extents, and size tolerance.
      Parameters:
      trans - the earth transform to use.
      min - the starting data location for partitioning.
      max - the ending data location for partitioning.
      maxSize - the maximum partition size in any dimension in terms of the EarthTransform.distance(noaa.coastwatch.util.DataLocation, noaa.coastwatch.util.DataLocation) metric.
      maxDims - the maximum partition size in any dimension in terms of data locations.
      isRoot - the root flag, true if this partition is the root of a tree or false if not.
    • EarthPartition

      public EarthPartition(Object obj)
      Constructs an earth partitioning from the specified encoding. The encoding must be a valid encoding of a partitioning as created by getEncoding.
      Parameters:
      obj - the object encoding.
      See Also:
  • Method Details

    • getData

      public Object getData()
      Gets the partition data.
    • setData

      public void setData(Object data)
      Sets the partition data.
    • getMin

      public DataLocation getMin()
      Gets the partition minimum bounds.
    • getMax

      public DataLocation getMax()
      Gets the partition maximum bounds.
    • useEncoding

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

      public int partitions()
      Gets the number of child partitions.
    • getEncoding

      public Object getEncoding()
      Creates an encoding of the partition information. The encoding may later be used to recreate the partitioning without using the original earth transform data.
      Specified by:
      getEncoding in interface Encodable
      Returns:
      obj 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
      • a List of Object specifying partition data
      See Also:
    • getPartitions

      public EarthPartition[] getPartitions()
      Gets all child partitions as an array.
      Returns:
      the child partition array.
    • contains

      public boolean contains(DataLocation loc)
      Determines if the partition contains the specified data coordinate.
      Parameters:
      loc - the data location to check.
      Returns:
      true if the partition contains the data location, or false otherwise.
    • findPartition

      public EarthPartition findPartition(DataLocation loc)
      Gets the partition containing the specified data location.
      Parameters:
      loc - the data location for searching.
      Returns:
      the earth partition containing the data location, or null if one cannot be found.