Skip to content

test: Add the CRS conformance suite from geotiff-test-data - #181

Merged
kylebarron merged 10 commits into
mainfrom
kyle/crs-conformance-tests
Oct 26, 2026
Merged

kylebarron merged 10 commits into
mainfrom
kyle/crs-conformance-tests

Conversation

@kylebarron

Copy link
Copy Markdown
Member

Note

This PR was written by Claude (Claude Code), not by @kylebarron.

Stage 3 of the GeoKey-to-CRS work: the test harness, with no changes to _crs.py yet. The design is in dev-docs/specs/2026-10-26-geokey-crs-conformance-design.md (also in this PR, with the stage plans) and the corpus landed in developmentseed/geotiff-test-data#84.

Changes

  • Submodule bump to geotiff-test-data 35da663, which carries crs/ (98 GDAL-written fixtures, manifest, CT table).
  • tests/test_crs_conformance.py: one parametrized test per manifest row. Opens the fixture, asserts expected.equals(geotiff.crs, ignore_axis_order=True) against GDAL's PROJJSON, then projects the manifest's test point with both CRSs in this environment's PROJ and compares. Rows the manifest flags are skipped (2). KNOWN_FAILURES lists the 34 rows that fail against today's builder, grouped by cause (rejected CT codes, PROJJSON PROJ rejects, wrong variant, origin/scale keys, units, axes, datum/PM/TOWGS84, ESRI PE String), each xfail(strict=True): a fix that makes a row pass fails the run until the row is removed. REGISTRY_DRIFT holds two EPSG-coded rows that differ only by proj.db version between this venv's PROJ 9.5 and the generator's 9.8; they are non-strict.
  • Vendored CT table at src/async_geotiff/data/geotiff-ct-methods.json for the stage 4 builder, with a test that it equals the submodule copy (verified it ships in the wheel).
  • [tool.pytest.ini_options] testpaths = ["tests"]: the submodule now has its own test suite with its own dependencies, which bare pytest was collecting.
  • tests/test_read.py: the bump also brings geotiff-test-data#74, which made write_cog actually apply predictor 2; uint8_1band_deflate_block128_unaligned_predictor2 now really has it, and async-tiff 0.7.0 decodes the partial last tile column wrongly (first mismatch at row 1, col 260 of the 300-wide image). The two full-read tests for that fixture are strict xfails. This needs an async-tiff issue; I was not able to file it from this session.

Numbers

uv run pytest: 435 passed, 4 skipped, 36 xfailed. Ruff clean.

Two findings from building the harness, recorded in the spec: strict geographic axis order would have failed every row the current builder writes latitude-first (rasterio accepts those), so the comparison ignores geographic axis order like rasterio does; and the manifest's own x, y cannot be used directly here because Equidistant Cylindrical moved 5.9 km between PROJ 9.5 and 9.8, so the test projects with both CRSs instead.

Next: stage 4, the table-driven rewrite of _crs.py, which should empty KNOWN_FAILURES down to the rows that need the async-tiff release with keys 2062/3096 (developmentseed/async-tiff#368) and the GDAL prime-meridian-in-grads row.

🤖 Written by Claude Code

🤖 Generated with Claude Code

kylebarron and others added 7 commits October 26, 2026 11:02
…driven builder

Design for making GeoKey -> CRS parsing match GDAL/PROJ: a shared
conformance corpus and CT table in geotiff-test-data, and a rewrite of
_crs.py that interprets the table with pyproj's typed constructors.
Written before any code so the manifest schema, table schema, equality
definition and known-failures mechanism can be reviewed first.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Also records the async-tiff issue/PR in the spec and switches GeoKey
names to the no-suffix form and axes to a direction list, so the plan
and spec agree.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Found by the corpus review: libgeotiff reads only ProjScaleAtNatOrigin
for CT 7, and PROJ gives Polar Stereographic south/south or north/north
axes by the sign of the latitude.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Also adds the stage 3 plan.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The JSON ships in the wheel under async_geotiff/data for the table-driven
builder. pytest now collects only tests/, since the geotiff-test-data
submodule carries its own suite with its own dependencies.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Every row of the geotiff-test-data CRS manifest is opened and its CRS
compared to GDAL's with pyproj equivalence (ignoring geographic axis
order, as rasterio does), then by projecting the manifest's test point
with both CRSs. 34 rows fail against the current builder and are listed
as strict xfails so the list can only shrink; two EPSG-coded rows differ
only by proj.db version and are non-strict.

The submodule bump also brought the corrected predictor-2 fixture, which
async-tiff 0.7.0 decodes wrongly on partial tiles; the two read tests
for it are strict xfails until async-tiff is fixed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should include specs but not plans. let's gitignore the plan folder

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

This comment was written by Claude (Claude Code), not by @kylebarron.

Done: dev-docs/plans/ is now in .gitignore and both plan files are removed from the branch (they stay on disk locally). The spec remains under dev-docs/specs/.

🤖 Written by Claude Code

Comment thread tests/test_read.py Outdated
Comment on lines +21 to +22
# for; this fixture now really carries predictor 2, and async-tiff 0.7.0
# reverses it wrongly on the partial last tile column (300 wide, 128 tiles).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this fixed in 0.7.2? Or should we create an upstream issue?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

This comment was written by Claude (Claude Code), not by @kylebarron.

It is fixed in 0.7.2: the test passes with async-tiff==0.7.2 and fails with 0.7.0. So instead of the xfail, this PR now bumps the floor to async-tiff>=0.7.2 (lock updated) and the two read tests run normally again. I had filed developmentseed/async-tiff#370 before checking; closed it with that finding.

🤖 Written by Claude Code

kylebarron and others added 3 commits October 26, 2026 13:38
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Specs are committed under dev-docs/specs; plans are working notes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…iles

The corrected predictor-2 fixture from geotiff-test-data decodes
correctly with 0.7.2, so the read tests need no xfail.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

@kylebarron kylebarron left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Comment thread pyproject.toml
dependencies = [
"affine>=2.4.0",
"async-tiff>=0.7.0",
"async-tiff>=0.7.2",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@kylebarron
kylebarron merged commit d433d39 into main Oct 26, 2026
6 checks passed
@kylebarron
kylebarron deleted the kyle/crs-conformance-tests branch October 26, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant