Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

GeoCase

Two pixels out of a hundred are NoData, and your mean elevation is off by 200 metres.

Here is the code. It looks fine, it passes review, and it is wrong:

def mean_elevation(array):
    return float(array.mean())

Point it at a GeoCase case that ships with the package:

import pytest


@pytest.mark.geocase_case("geotiff_nodata_small")
def test_mean_elevation_ignores_nodata(geocase_case):
    array, _profile, nodata = geocase_case.read(1)
    valid = array[array != nodata]
    assert mean_elevation(array) == pytest.approx(float(valid.mean()), rel=0.01)
E   assert -152.8628387451172 == 48.07874298095703 ± 0.480787

The file carries an explicit -9999 NoData sentinel in 2 of its 100 pixels. array.mean() averages the sentinel in and reports −152.9 m for terrain whose real mean is 48.1 m. Nothing raises and nothing warns — the number is simply wrong, and it stays wrong all the way into the report. The only thing that catches it is a test file that actually has NoData in it.

That is what GeoCase is: 135 curated vector, raster and NetCDF files, each one built around a failure mode that survives code review. NoData averaged into a statistic; geometry crossing the antimeridian and coming back as a ring around the globe; a CRS mismatch between two layers that overlay perfectly on screen; EPSG axis order flipping latitude and longitude.

The realistic alternative is not "no tests" — it is the test_data/sample.tif someone exported once and the numpy arrays each test improvises. Those pass because they were chosen by the same person who wrote the code, so they encode the same assumptions. GeoCase cases were not, and they ship as a versioned dependency instead of a folder nobody remembers the provenance of. (They also give a coding assistant something to reach for instead of inventing a fixture that agrees with the bug.)

Status: 1.0, not yet published to PyPI — install from source for now. The compatibility promise covers two surfaces — the pytest workflow (fixtures and markers) and the import geocase public API. 135 bundled cases, 2.1 MB. Remote dataset transport is deferred to v1.1; see the changelog.

Quick Start

1) Install

For local development in this repo:

pip install -e ".[dev]"

When a package release is published, install from the package index:

pip install "geocase[all]"

A conda-forge feedstock does not exist yet. When one does, installing from it will not carry the extras, since bundling GDAL would make the conda package far heavier than the PyPI equivalent:

conda install -c conda-forge geocase

GeoCase depends on geofacts at runtime — a zero-dependency table of geospatial product facts (radiometric constants, CRS conventions) that the raster presets are machine-checked against. Everything else is optional and gated behind extras.

2) Write a test with GeoCase markers

import pytest


@pytest.mark.geocase_case("dateline_crossing_polygon")
def test_vector_case_loads(geocase_case) -> None:
    gdf = geocase_case.load()
    assert geocase_case.id == "dateline_crossing_polygon"
    assert gdf.crs is not None


@pytest.mark.geocase_select(category="raster")
def test_all_raster_cases_have_pixels(geocase) -> None:
    data, _, _ = geocase.read(1)
    assert data.size > 0

3) Run tests

pytest -v

Run only GeoCase-marked tests:

pytest -m "geocase_case or geocase_suite or geocase_select" -v

CI Jobs

This repository uses GitHub Actions, defined in .github/workflows/.

ci.yml runs on pushes to main and on pull requests:

  • catalog — catalog integrity checks (build_case_index.py smoke check, validate_catalog.py, fixture and checksum gates, generated-page freshness)
  • tests — the whole tests/ directory on Python 3.11 and 3.14, reporting coverage (not gated)
  • lint — ruff format --check and ruff check over src and tests
  • typecheck — mypy src
  • docs — mkdocs build --strict

release.yml runs only on vX.Y.Z tags; see Releasing.

Local equivalents:

python scripts/build_case_index.py --check
python scripts/validate_catalog.py

python -m pytest tests -q
ruff format --check src tests && ruff check src tests

Core Concepts

  • @pytest.mark.geocase_case(...): select explicit case IDs.
  • @pytest.mark.geocase_suite(...): use named suites.
  • @pytest.mark.geocase_select(...): select by metadata (category, format, geometry_type, tags, risk_types_any, etc.).
  • geocase: auto-parameterized fixture (one invocation per resolved case).
  • geocase_case: convenience fixture for exactly one resolved case.
  • CLI tooling is optional; the primary workflow is plain pytest.

If a GeoCase marker is missing, resolves no cases, refers to an unknown suite, or geocase_case resolves more than one case, the plugin now raises a focused pytest.UsageError that explains what to fix.

Learn More

Metadata

Release files for geocase 1.0.0rc2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for geocase 1.0.0rc2
File Size Uploaded
geocase-1.0.0rc2.tar.gz 425.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for geocase 1.0.0rc2
File Interpreter ABI Platform
geocase-1.0.0rc2-py3-none-any.whl Python 3 none any Details

Total release size: 1.1 MB

Release files / geocase-1.0.0rc2.tar.gz

Download URL geocase-1.0.0rc2.tar.gz
Size 425.3 kB
Tags Source
SHA-256 checksum
How to use checksums
47662f82812d28ab979d747eb5975b7f373ccdf6fcd0f3282562f8ea6baecd9d
BLAKE2b-256 checksum
How to use checksums
56a52759089590b9a56ccbf096c9703c148c1e382b094e1fcc332a551d1e3e5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.

Transparency log

Release files / geocase-1.0.0rc2-py3-none-any.whl

Download URL geocase-1.0.0rc2-py3-none-any.whl
Size 644.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4830a6b9c6f39673cf8258827e9fe2e2475fe3a7dafe674c96d9ceb8def49452
BLAKE2b-256 checksum
How to use checksums
5b3618c5e2b41670d426710bcae0dd4bc7011ed2021029f398845b02cdd8b5cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page