User-guide page: safe GeoTIFF IO usage (#2345 PR 1)#2386
Conversation
New docs page walks a caller through the GeoTIFF entry points, the SUPPORTED_FEATURES tier vocabulary, the codec subset inside the stable contract, the COG layout produced by cog=True, the fail-closed errors the reader and writer raise, and the env vars / kwargs that bound remote reads. Cross-links to the existing reference, release contract, release gate, and attrs contract pages. Part of #2345 PR 1. Closes #2379.
brendancol
left a comment
There was a problem hiding this comment.
PR Review: User-guide page: safe GeoTIFF IO usage (#2345 PR 1)
Docs-only PR. The new page is accurate against _attrs.py, _errors.py, and open_geotiff at the current commit. The review focused on cross-reference correctness, factual claims, and Sphinx role usage.
Blockers (must fix before merge)
None.
Suggestions (should fix, not blocking)
-
docs/source/user_guide/geotiff_safe_io.rst:195and:227:VRTUnsupportedErroris written as inline code instead of a:class:cross-ref because it is not re-exported fromxrspatial.geotiff. The class is already in_errors.__all__, so adding it to thefrom ._errors import (...)line inxrspatial/geotiff/__init__.pyand the package__all__would let both mentions switch to:class:\~xrspatial.geotiff.VRTUnsupportedError`` and match the rest of the table. Keeps the user-facing error names on one import path. If you want this PR to stay strictly docs-only, file a follow-up. -
docs/source/user_guide/geotiff_safe_io.rst:269(Byte budget): "The module default" leaves the reader without a concrete number. The default is set inxrspatial/geotiff/_sources.pynear_resolve_max_cloud_bytes. Naming it (or at least pointing at the helper the way the page does for env vars) helps a caller decide whether they need to touch the env var at all. -
docs/source/user_guide/geotiff_safe_io.rst:38-43(open_geotiff row): says "A path or a binary file-like is the only required argument" but the file-like path is restricted to the eager numpy reader. Dask, GPU, VRT, and remote-URL paths require a string. Theopen_geotiffdocstring spells this out undersource. One sentence on this page would save a reader from passing aBytesIOwithchunks=Nand getting a confusing failure.
Nits (optional improvements)
-
docs/source/user_guide/geotiff_safe_io.rst:34: "Single dispatch for reading" reads a bit clipped. "The read entry point" matches the docstring tone better. -
docs/source/user_guide/geotiff_safe_io.rst:182: the sentence says every error below subclassesValueError, which is true. The carve-out forUnsupportedGeoTIFFFeatureError(not aGeoTIFFAmbiguousMetadataError) lives down at the bottom of the table at line 233. Mentioning theGeoTIFFAmbiguousMetadataErrorvs direct-ValueErrorsplit once at the top would save the second read. -
docs/source/user_guide/geotiff_safe_io.rst:127(Recommended codecs): thenonebullet says "no compression" without the TIFF spec name. Worth notingnoneis the codec keyword the writer accepts; the TIFF spec calls thisCOMPRESSION_NONE. Optional. -
The page uses both "Cloud-Optimised" and "Cloud-Optimized" spellings. The existing reference page uses "Cloud-Optimised"; keep this one consistent with that.
What looks good
- Tier vocabulary section maps cleanly to the four strings in
SUPPORTED_FEATURESat_attrs.py:264. The runtime check example is correct. - Stable COG contract bullets match
_attrs.py:209-237. - The "outside the stable contract" combinations match the experimental / advanced tier strings in
SUPPORTED_FEATURES: GPU read/write, BigTIFF COG, HTTP COG, file-like withcog=True, sidecar overviews, and rotated transforms all line up. - Error table covers every public class in
xrspatial.geotiff._errorsand the opt-in flags match the constructors ofopen_geotiffandto_geotiff. - Env var names match the strings in
_sources.pyand_runtime.py. - Cross-reference targets (
reference.geotiff,reference.geotiff_release_contract,reference.geotiff_release_gate,user_guide.attrs_contract) all exist in the docs tree. - The page does not claim full GDAL / VRT / GPU parity, per the acceptance criterion on #2379.
Checklist
- Cross-reference targets exist
- Tier strings match
SUPPORTED_FEATURESat HEAD - Error class names match
xrspatial.geotiff._errors - Env var names match
_sources.py/_runtime.py - No code or API changes (docs-only)
- Wired into the user guide TOC
- Sphinx CI confirms a clean build (waiting on CI)
- [N/A] Backend parity / NaN handling / dask correctness (docs-only PR)
- [N/A] README feature matrix (no new functions)
Apply the suggestions and nits from the PR #2386 review. - Note that the binary file-like read form is restricted to the eager numpy reader; dask, GPU, VRT, and remote-URL paths require a string. - Name the default max_cloud_bytes value (256 MiB) and point at MAX_CLOUD_BYTES_DEFAULT so callers can find it. - Hoist the GeoTIFFAmbiguousMetadataError vs direct-ValueError split to the top of the error section so the carve-out for UnsupportedGeoTIFFFeatureError reads as introduction, not footnote. - Add the TIFF spec name COMPRESSION_NONE next to the ``none`` codec bullet. - Switch "Cloud-Optimised" to "Cloud-optimized" to match docs/source/reference/release_gate_geotiff.rst. - Reword the open_geotiff blurb away from "single dispatch" to "the read entry point". The VRTUnsupportedError re-export suggestion is deferred -- that's a code change and #2379 is docs-only.
The intro said the first eight entries subclass GeoTIFFAmbiguousMetadataError. The table actually lists nine such entries; UnsupportedGeoTIFFFeatureError is the only direct ValueError subclass. Reword to "every entry except UnsupportedGeoTIFFFeatureError" so the count cannot drift.
brendancol
left a comment
There was a problem hiding this comment.
PR Review (follow-up): User-guide page: safe GeoTIFF IO usage
Re-review after the fix-up commits at 3576b588 and e9089e68.
Blockers
None.
Suggestions
None outstanding. The original suggestions were applied:
- File-like restriction now stated on the
open_geotiffrow. - Default
max_cloud_bytesnamed as 256 MiB with a pointer to
MAX_CLOUD_BYTES_DEFAULT. GeoTIFFAmbiguousMetadataErrorvs direct-ValueErrorsplit hoisted
to the top of the error section.- Off-by-one in "first eight entries" corrected to "every entry except
UnsupportedGeoTIFFFeatureError" so the count cannot drift. COMPRESSION_NONEnoted next to thenonecodec.- "Cloud-Optimised" switched to "Cloud-optimized" to match
release_gate_geotiff.rst. - "Single dispatch for reading" reworded to "the read entry point".
Deferred:
- Re-exporting
VRTUnsupportedErrorfromxrspatial.geotiffso the
two inline references can become:class:cross-refs. The fix is a
one-line change toxrspatial/geotiff/__init__.py, but #2379 is
scoped docs-only. Worth a follow-up issue rather than expanding
this PR.
Nits
None.
What looks good
- All cross-references still resolve.
rst2htmlreports no structural errors (Sphinx roles flagged as
"unknown" are expected outside Sphinx).- The page does not claim full GDAL / VRT / GPU parity.
- Tier strings still match
SUPPORTED_FEATURESat HEAD.
Checklist
- All actionable items from the first review either applied or
deferred with a reason. - No structural RST errors.
- Cross-references still valid.
- Sphinx CI confirms a clean build (waiting on CI).
CI statusThree required pytest jobs failed on this PR:
All five failures are in This is pre-existing on
The remaining checks (3.12 fast lane, ubuntu 3.14 alternate matrix entry, label, RTD docs) are passing. Suggest landing the VRT test fix in a separate PR; this docs page does not affect runtime behaviour. |
Closes #2379. Part of epic #2345 PR 1.
Summary
Adds
docs/source/user_guide/geotiff_safe_io.rst, a user-facing page thatanswers "is this safe to rely on?" for
xrspatial.geotiffwithout makingthe caller read source code or
SUPPORTED_FEATURESdirectly. Wires thefile into
docs/source/user_guide/index.rst.The page covers:
open_geotiff,to_geotiff,read_vrt,write_vrt,write_geotiff_gpu) and what each one expects.SUPPORTED_FEATUREStier vocabulary: stable / advanced /experimental / internal-only, with a runtime check example.
packbits, zstd) and what disqualifies a file (experimental codecs,
internal-only
jpeg, non-stable read/write paths).cog=True, the layout it produces, and thecombinations that fall outside the stable contract (GPU, BigTIFF COG,
HTTP COG, file-like destinations, rotated transforms, sidecar
overviews, experimental codecs).
opt-in (where one exists).
max_cloud_byteskwarg,XRSPATIAL_GEOTIFF_MAX_CLOUD_BYTES,XRSPATIAL_GEOTIFF_ALLOW_PRIVATE_HOSTS,HTTP connect / read timeouts, strict mode, mmap cache size.
gate audit checklist, and the attrs contract.
The page does not claim full GDAL / VRT / GPU parity anywhere.
Test plan
rst2htmlreports no structural errors on the new file (Sphinxroles flagged as "unknown" are expected outside Sphinx).
reference.geotiff,reference.geotiff_release_contract,reference.geotiff_release_gate,user_guide.attrs_contract) exist in the docs tree.SUPPORTED_FEATUREStier strings on the page matchxrspatial/geotiff/_attrs.pyat the current commit.