Skip to content

VRT missing_sources default before stable release #1843

@brendancol

Description

@brendancol

Current behaviour

read_vrt in _vrt.py defaults missing_sources='warn'. When a backing source can't be read, the call:

  1. emits GeoTIFFFallbackWarning,
  2. appends a record to vrt.holes (surfaced as attrs['vrt_holes'] on the public DataArray), and
  3. continues, leaving the destination region filled with the buffer's fill value (NaN for float, 0 for integer).

missing_sources='raise' and XRSPATIAL_GEOTIFF_STRICT=1 both already raise.

The concern

For an integer raster without a nodata sentinel, the zero-fill hole is indistinguishable from real zero-valued data unless the caller checks attrs['vrt_holes']. Before a stable release, that default is too lenient.

Options

(a) Switch default to 'raise'.

(b) Hybrid 'auto' default.

  • Pro: only raises when the affected band lacks a nodata sentinel (the actually-ambiguous case). Float bands and integer-with-nodata bands keep the lenient path.
  • Con: three-valued policy is harder to document and reason about. Doesn't fully solve the loss-of-provenance problem (the caller still has to inspect vrt_holes to know which source failed).

(c) Keep 'warn'.

  • Pro: no break. The strict env var and vrt_holes attr already give safety-conscious callers an opt-in.
  • Con: defaults are what most callers use. Pre-stable is when defaults should tighten, not stay loose.

Chosen direction: (a)

The module has been hardening toward stable with consistent up-front rejection of malformed input. A silent zero-fill on a Byte raster is the one place lenience still leaks through. The escape hatch already exists and is one kwarg long.

The env var XRSPATIAL_GEOTIFF_STRICT=1 stays orthogonal (force-raise across the whole module).

Scope

This issue covers the internal read_vrt in xrspatial/geotiff/_vrt.py. Aligning the public dispatcher default in __init__.py is a separate follow-up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions