Class ChunkingScheme

java.lang.Object
noaa.coastwatch.util.chunk.ChunkingScheme
All Implemented Interfaces:
Iterable<ChunkPosition>

public class ChunkingScheme extends Object implements 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 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

      public boolean isNativePosition(ChunkPosition pos)
      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

      public Iterator<ChunkPosition> iterator()
      Specified by:
      iterator in interface Iterable<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

      public ChunkPosition getPosition(int[] coords)
      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