Package noaa.coastwatch.util.chunk
Class ChunkingScheme
java.lang.Object
noaa.coastwatch.util.chunk.ChunkingScheme
- All Implemented Interfaces:
Iterable<ChunkPosition>
The
ChunkingScheme
class describes an overall set of chunks
that fill an n-dimensional space and allows for iteration over the set.
Chunks are all of equal size, except for some chunks at the edges of the
space which may be truncated due to the global dimensions.- Since:
- 3.4.0
- Author:
- Peter Hollemans
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
getChunkCount
(int index) Gets the number of chunks along a dimension.int[]
Gets the size of chunks in this scheme.int[]
getDims()
Gets the global dimensions of the chunking scheme.getPosition
(int[] coords) Gets the chunk position for a specified set of coordinates.int
Gets the total count of chunks in this scheme.boolean
Determines if a chunk position is native to this chunking scheme.iterator()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ChunkingScheme
public ChunkingScheme(int[] dims, int[] chunkSize) Creates a new chunking scheme.- Parameters:
dims
- the global dimensions of the n-dimensional chunk space.chunkSize
- the size of each chunk in the space (some chunks may be truncated).
-
-
Method Details
-
isNativePosition
Determines if a chunk position is native to this chunking scheme.- Parameters:
pos
- the position to check.- Returns:
- true if the position is one in this chunking scheme or false if not.
- Since:
- 3.5.0
-
getDims
public int[] getDims()Gets the global dimensions of the chunking scheme.- Returns:
- the global dimensions.
-
getChunkSize
public int[] getChunkSize()Gets the size of chunks in this scheme.- Returns:
- the chunk size.
-
iterator
- Specified by:
iterator
in interfaceIterable<ChunkPosition>
-
getTotalChunks
public int getTotalChunks()Gets the total count of chunks in this scheme.- Returns:
- the total number of chunks.
- Since:
- 3.5.0
-
getChunkCount
public int getChunkCount(int index) Gets the number of chunks along a dimension.- Parameters:
index
- the index of the dimension to get the chunk count.- Returns:
- the total number of chunks along the specified dimension, including any truncated chunks.
- Since:
- 3.5.0
-
getPosition
Gets the chunk position for a specified set of coordinates.- Parameters:
coords
- the coordinates contained by the chunk.- Returns:
- pos the chunk position that contains the specified coordinates.
- Since:
- 3.5.0
-