Skip to content

geotiff: read_vrt and open_geotiff(.vrt) default missing_sources to lenient 'warn' #1860

@brendancol

Description

@brendancol

The public read_vrt in xrspatial/geotiff/__init__.py:3798 defaults to missing_sources='warn':

def read_vrt(source: str, *,
             ...
             missing_sources: str = 'warn') -> xr.DataArray:

The internal _vrt.read_vrt it dispatches to defaults to missing_sources='raise' (xrspatial/geotiff/_vrt.py:856) and the module comment at line 256 explicitly tags 'warn' as the lenient opt-in. The two defaults disagree and the public one is the lenient choice.

The same lenient default leaks into open_geotiff(.vrt) at xrspatial/geotiff/__init__.py:714: when the caller does not pass missing_sources, no kwarg is forwarded and the public read_vrt default takes over, so callers who reach VRT reads through open_geotiff get the lenient policy too.

Repro

import xrspatial.geotiff as g
# vrt that references a missing tile
da = g.read_vrt("partial.vrt")          # warns, returns array with NaN holes
da = g.open_geotiff("partial.vrt")      # same: silently degraded output

Fix

Change the public read_vrt default to missing_sources='raise' to match the internal default, and update the docstring. Callers who want the older lenient behavior pass missing_sources='warn' explicitly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiAPI design and consistencybugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions