Sub-task of #2321.
VRT capability checks are scattered across read_vrt (in _backends/vrt.py) and the open_geotiff .vrt branch, and some checks fire only once a chunk is actually decoded. That means a malformed VRT can build a dask graph successfully and then blow up inside a chunk function, far from the call site.
Add a single validator that runs against an already-parsed VRTDataset before any read work starts. It should cover:
- CRS compatibility
- dtype compatibility across bands
- band count sanity
- nodata policy
- transform orientation (flips the read path does not honour)
- pixel-size compatibility
SrcRect vs DstRect sanity
- the supported resampling set
Both read_vrt and open_geotiff('foo.vrt') should call the validator so the two entry points produce the same rejections. Raise a typed VRTUnsupportedError (a subclass of the existing geotiff error class in _errors.py) and put the offending source path and field name in the message.
The validator must accept already-parsed structures. Do not re-parse the VRT XML inside it.
Acceptance
- Unsupported VRT features raise at graph build or eager-read setup, not deep in a chunk function.
read_vrt(bad.vrt) and open_geotiff('bad.vrt') produce the same error type and message for the same input.
- One negative test per validator rule.
Sub-task of #2321.
VRT capability checks are scattered across
read_vrt(in_backends/vrt.py) and theopen_geotiff.vrtbranch, and some checks fire only once a chunk is actually decoded. That means a malformed VRT can build a dask graph successfully and then blow up inside a chunk function, far from the call site.Add a single validator that runs against an already-parsed
VRTDatasetbefore any read work starts. It should cover:SrcRectvsDstRectsanityBoth
read_vrtandopen_geotiff('foo.vrt')should call the validator so the two entry points produce the same rejections. Raise a typedVRTUnsupportedError(a subclass of the existing geotiff error class in_errors.py) and put the offending source path and field name in the message.The validator must accept already-parsed structures. Do not re-parse the VRT XML inside it.
Acceptance
read_vrt(bad.vrt)andopen_geotiff('bad.vrt')produce the same error type and message for the same input.