Package noaa.coastwatch.util
Class EarthPartition
java.lang.Object
noaa.coastwatch.util.EarthPartition
- All Implemented Interfaces:
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 Summary
ConstructorsModifierConstructorDescriptionEarthPartition(Object obj) Constructs an earth partitioning from the specified encoding.EarthPartition(EarthTransform trans, DataLocation min, DataLocation max, double maxSize, int[] maxDims) Constructs an earth partitioning from the specified earth transform, extents, and size tolerance.protectedEarthPartition(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. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(DataLocation loc) Determines if the partition contains the specified data coordinate.Gets the partition containing the specified data location.getData()Gets the partition data.Creates an encoding of the partition information.getMax()Gets the partition maximum bounds.getMin()Gets the partition minimum bounds.Gets all child partitions as an array.intGets the number of child partitions.voidSets the partition data.voiduseEncoding(Object obj) Constructs an earth partitioning from the specified encoding.
-
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 theEarthTransform.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 theEarthTransform.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
Constructs an earth partitioning from the specified encoding. The encoding must be a valid encoding of a partitioning as created bygetEncoding.- Parameters:
obj- the object encoding.- See Also:
-
-
Method Details
-
getData
Gets the partition data. -
setData
Sets the partition data. -
getMin
Gets the partition minimum bounds. -
getMax
Gets the partition maximum bounds. -
useEncoding
Constructs an earth partitioning from the specified encoding. The encoding must be a valid encoding of a partitioning as created bygetEncoding.- Specified by:
useEncodingin interfaceEncodable- Parameters:
obj- the object encoding.- See Also:
-
partitions
public int partitions()Gets the number of child partitions. -
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:
getEncodingin interfaceEncodable- Returns:
- obj the object encoding. The encoding object is an
Object[3]array containing:- a
BitSetobject used for encoding partition structure information - a
Listofdouble[]coordinates specifying partition boundaries - a
ListofObjectspecifying partition data
- a
- See Also:
-
getPartitions
Gets all child partitions as an array.- Returns:
- the child partition array.
-
contains
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
Gets the partition containing the specified data location.- Parameters:
loc- the data location for searching.- Returns:
- the earth partition containing the data location, or
nullif one cannot be found.
-