Skip to content

geotiff: read_vrt default lenient mode hides source read failures as zero-filled holes #1734

@brendancol

Description

@brendancol

Describe the bug

xrspatial/geotiff/_vrt.py:647 wraps the per-source read_to_array call in a try/except that, by default, warns once and continues:

except (OSError, ValueError, struct.error,) + _CODEC_DECODE_EXCEPTIONS as e:
    if _geotiff_strict_mode():
        raise
    warnings.warn(...)
    continue

A continuing read returns a mosaic with holes. For integer VRTs the hole is the dtype zero, which downstream functions cannot distinguish from real data unless the band has a nodata value set.

Expected behavior

Either invert the default to strict (lenient becomes opt-in via XRSPATIAL_GEOTIFF_STRICT=0), or surface a stronger signal than a warning, for example a metadata['vrt_holes'] entry on the returned DataArray that records which sources failed and where.

Additional context

The current opt-in is XRSPATIAL_GEOTIFF_STRICT=1. Documented behavior should match what a new user will hit on a corrupt mosaic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions