Package org.geotools.imageio.netcdf.slice


package org.geotools.imageio.netcdf.slice
NetCDF slice-query infrastructure used by the GeoTools NetCDF reader to translate catalog-style Query objects into NetCDF dimension selections and, ultimately, into readable 2D slices.

Queries containing time, elevation, and additional dimensions must be translated into ImageIO imageIndex values, each representing a 2D slice of the underlying NetCDF variable. These imageIndex values are then resolved into the corresponding NetCDF multidimensional indices (time, elevation, and other dimensions), allowing the reader to access the correct portion of the NetCDF data.

The code in this package is organized around a staged pipeline:

  1. A GeoTools filter is analyzed and split into:
    • dimension-backed predicates that can be resolved directly against NetCDF axes
    • a residual post-filter that must still be evaluated in memory on produced features
  2. The recognized dimension predicates are translated into DimensionFilter instances for time, elevation, and additional dimensions.
  3. Those dimension filters are resolved to concrete NetCDF axis indices by consulting per-variable lookup structures built from underlying NetCDF coordinate variables.
  4. The matching logical dimension tuples are iterated, converted to NetCDF split indices, mapped to image indexes, and exposed as CoverageSlices.

Filter splitting and translation

See the filter portion of the package for the logic that walks the original GeoTools filter tree using the DimensionFilterSplitter.

NetCDFDimensionBindingResolver centralizes the mapping between feature attributes and NetCDF logical dimensions by answering which attribute corresponds to time, elevation, or a given additional dimension.

Slice query planning and execution

The slice portion of the package turns the split result into actual slice iteration:

  • NetCDFSliceProvider is the CoverageSlicesCatalog.SliceProvider implementation for a single NetCDF variable. It is the main runtime bridge between CoverageSlicesCatalog queries and NetCDF slice access.
  • NetCDFSliceQuery is the preprocessed query representation. It stores the recognized dimension filters and the residual post-filter, and prepares the logical dimension domain to iterate.
  • NetCDFSliceIterator iterates the cartesian product of the selected dimension indices, builds the corresponding features, and applies the residual post-filter when needed.
  • NetCDFImageIndexResolver resolves a global image index into the owning variable and its logical non-spatial dimension indices, allowing the reader to move between flattened image indexes and multidimensional NetCDF coordinates.
  • NetCDFDimensionIndexes builds and exposes lookup structures for temporal, elevation, and additional dimensions. It provides regular-axis and array-backed implementations, exact-match support, and lower/upper bound search methods used by range filters.
  • DimensionFilterIndexResolver takes a DimensionFilter together with one of the lookup types from NetCDFDimensionIndexes and resolves it into the exact set of matching axis indices.

Class interactions

The main interaction flow is:

 Query
   -> NetCDFSliceProvider (query)
   -> NetCDFSliceQuery
   -> DimensionFilterSplitter
   -> SplitFilterResult
   -> NetCDFSliceQuery.toDomain(...)
   -> DimensionFilterIndexResolver
   -> NetCDFDimensionIndexes lookup objects
   -> NetCDFSliceIterator
   -> CoverageSlice / SimpleFeature