Summary
xrspatial.geotiff.write_vrt annotates its nodata kwarg as float | None:
def write_vrt(vrt_path: str, source_files: list[str], *,
relative: bool = True,
crs_wkt: str | None = None,
nodata: float | None = None) -> str:
(xrspatial/geotiff/__init__.py:3421)
The sibling writers to_geotiff and write_geotiff_gpu leave nodata untyped and document it as accepting "float, int, or None". Integer sentinels (e.g. nodata=65535 for a uint16 raster, nodata=-9999 for an int32 raster) are common and pass through the rest of the I/O surface, but on write_vrt they violate the declared type and trip strict type checkers / IDEs.
Within _vrt.py, the underlying write_vrt (xrspatial/geotiff/_vrt.py:595) has the same float-only annotation and is rendered into a generic <NoDataValue>{nodata}</NoDataValue> XML element with str() formatting, so an int value is rendered without complaint at runtime.
Proposed fix
Widen the nodata type annotation on both the public wrapper (xrspatial/geotiff/__init__.py:3424) and the internal implementation (xrspatial/geotiff/_vrt.py:598). Either match the to_geotiff/write_geotiff_gpu style (drop the annotation, document the type in the docstring) or annotate as float | int | None. Update the docstring in both places to read "float, int, or None" so the surface lines up with the other writers.
Found during the geotiff API consistency sweep (Cat 3, MEDIUM).
Summary
xrspatial.geotiff.write_vrtannotates itsnodatakwarg asfloat | None:(
xrspatial/geotiff/__init__.py:3421)The sibling writers
to_geotiffandwrite_geotiff_gpuleavenodatauntyped and document it as accepting "float, int, or None". Integer sentinels (e.g.nodata=65535for a uint16 raster,nodata=-9999for an int32 raster) are common and pass through the rest of the I/O surface, but onwrite_vrtthey violate the declared type and trip strict type checkers / IDEs.Within
_vrt.py, the underlyingwrite_vrt(xrspatial/geotiff/_vrt.py:595) has the same float-only annotation and is rendered into a generic<NoDataValue>{nodata}</NoDataValue>XML element withstr()formatting, so an int value is rendered without complaint at runtime.Proposed fix
Widen the
nodatatype annotation on both the public wrapper (xrspatial/geotiff/__init__.py:3424) and the internal implementation (xrspatial/geotiff/_vrt.py:598). Either match theto_geotiff/write_geotiff_gpustyle (drop the annotation, document the type in the docstring) or annotate asfloat | int | None. Update the docstring in both places to read "float, int, or None" so the surface lines up with the other writers.Found during the geotiff API consistency sweep (Cat 3, MEDIUM).