Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Boundaries and Ecosystem

Boundaries and Ecosystem

Overview

geo_toolz owns the xarray geoprocessing operator layer: preprocessing, inference wrapping, and evaluation. It delegates compute to numpy/scipy/sklearn, framework-specific inference to user-installed backends, and domain modeling to downstream packages.


Ownership Map

ConcernOwnerNotes
Coordinate validation, harmonizationgeo_toolzvalidation submodule
Spatial/temporal subsettinggeo_toolzsubset submodule
Regridding (scipy-based)geo_toolzNo ESMF dependency
Land/ocean/country masksgeo_toolzVia regionmask
Climatology, anomalies, detrendinggeo_toolzdetrend submodule
Spectral analysis (PSD, cross-spectrum)geo_toolzVia diagnostix
Evaluation metrics (RMSE, PSD score, etc.)geo_toolzVia xskillscore + custom
Kinematics (oceanography, remote sensing)geo_toolzkinematics submodule
Operator/Sequential/Graph abstractiongeo_toolzcore submodule
Model wrapping (ModelOp)geo_toolzFramework-agnostic via duck typing
sklearn xarray bridgexarray_sklearnOptional companion; SklearnOp can delegate
Patch-wise tilingxrpatcherOptional companion
Data assimilation (EnKF, 4DVar)ekalmX / vardaxConsumes geo_toolz for pre/post-processing
GP modelspyrox_gpIndependent; may consume geo_toolz features
Ocean/atmosphere forward modelssomax / diffraxIndependent
Structured linear algebragaussxIndependent

Decision Table

ScenarioRecommendation
Preprocess satellite data for MLSequential([ValidateCoords(), Regrid(...), RemoveClimatology(...)])
Run a trained sklearn model on xarraySklearnModelOp(model, sample_dim="time") in a Sequential
Run a JAX model on xarrayJaxModelOp(model, sample_dim="time", jit=True)
Evaluate predictions vs referenceRMSE(...), PSDScore(...) — or Graph for multi-metric
Multi-input pipeline (preprocess + evaluate)Graph(inputs=..., outputs=...)
Patch-wise inference on large gridsxrpatcher + Sequential per patch
Hydra-configurable pipelinehydra_zen.builds(Sequential, [...])
Conservative regridding (ESMF)Use xesmf directly — not in geo_toolz scope
Distributed/dask processingUse xarray+dask directly — deferred in geo_toolz

Ecosystem Interactions

External PackageIntegration PointPattern
xarrayInterface layer for all operatorsDataset → Dataset everywhere
scipyRegridding, interpolation, spectralCompute backend for L0 functions
sklearnPreprocessing transforms, modelsVia SklearnOp / SklearnModelOp
regionmaskLand/ocean/country masksmasks submodule wraps regionmask
diagnostixDiagnostics on plain arraystransforms wraps its spectra
xskillscoreVerification metricsmetrics submodule wraps xskillscore
hydra-zenConfig generation from operatorsget_config() + builds()
xarray_sklearnFull sklearn bridge with NaN policiesOptional, SklearnOp can delegate
xrpatcherPatch-wise tiling for large gridsOptional, operators applied per patch
ekalmXDA pre/post-processinggeo_toolz upstream (preprocess) and downstream (evaluate)

Scope

In Scope

Out of Scope


Testing Strategy

Fixtures

# conftest.py

@pytest.fixture
def ds_global():
    """Global 1° dataset: (time=100, lat=180, lon=360), with coords and attrs."""

@pytest.fixture
def ds_regional():
    """Mediterranean subset: (time=50, lat=40, lon=75)."""

@pytest.fixture
def ds_unstructured():
    """Scattered observations: (obs=5000) with lon, lat, time as 1D coords."""

@pytest.fixture
def ds_with_nans(ds_global):
    """ds_global with ~15% NaN (land mask pattern)."""

Test Categories

Test Priorities

  1. Operator contract — every operator returns the right type, preserves attrs, has valid get_config()

  2. Numerical correctness — L0 functions match scipy/xskillscore reference implementations

  3. Pipeline integration — realistic multi-step pipelines run end-to-end

  4. Round-trip — AddClimatology(clim)(RemoveClimatology(clim)(ds)) recovers original


Roadmap

v0.1 — Foundation (target: 4-6 weeks)

v0.2 — Analysis Depth + Inference (target: +4 weeks)

v0.3 — Domain Operators (target: +4 weeks)

v0.4+ — Continuous Expansion

Open Questions

  1. xarray accessor? A ds.geo.validate() accessor would be convenient but adds coupling. Defer to v0.4+ or include from v0.1?

  2. Dask awareness in v0.1? Should operators check for dask-backed arrays and call .compute() / .persist() at appropriate points? Or leave dask entirely to the user? The safest v0.1 approach is to document that operators work on in-memory arrays and dask support comes later.

  3. Unit handling. Some kinematics operations (streamfunction, geostrophic velocities) benefit from pint-xarray unit tracking. Should this be opt-in via a flag, or always-on for kinematics operators?

  4. Grid as an Operator? The Grid / SpaceTimeGrid dataclasses in discretize could themselves be operators that generate empty coordinate scaffolds. Is CreateGrid(lon_bnds, lat_bnds, resolution) useful, or is the dataclass sufficient?

  5. Graph serialization. The Graph can serialize its topology (which operators connect to which) via get_config(). But if someone wants to save a full graph to YAML and reload it (including the operator configs), that requires a class registry to map class names back to classes. Should geo_toolz include a lightweight registry (register_operator / get_operator_by_name), or leave that to Hydra-zen which already handles it?