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: 154 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.0rc1 is available on PyPI; this repository contains the next release candidate (1.0.0rc3). The compatibility promise covers two surfaces — the pytest workflow (fixtures and markers) and the import geocase public API. 154 bundled cases, 5.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]"

Install the latest published release from PyPI:

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.0rc3

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.0rc3
File Size Uploaded
geocase-1.0.0rc3.tar.gz 1.0 MB Details

Built distribution (wheel)

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

Total release size: 2.3 MB

Release files / geocase-1.0.0rc3.tar.gz

Download URL geocase-1.0.0rc3.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
c6c4d35fde307b58bf9339193c020b69ca012e80b300c8ac2f3ceadd2d227c07
BLAKE2b-256 checksum
How to use checksums
21b26cd720011a69b18b1b338c7dbcc51151cc94b6006c88b9b185d13be2a4eb
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 30, 2026.

Transparency log

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

Download URL geocase-1.0.0rc3-py3-none-any.whl
Size 1.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
0a1564cb749d31aa7bc1dceae589a3435ec263ef33381c7acf592bc161db0edb
BLAKE2b-256 checksum
How to use checksums
74b2f82a93eec68d25bbf6a5da6434620f0f2e6f2366944b6512ee541045921b
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 30, 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