Describe the bug
xrspatial/geotiff/_attrs.py:228 returns a non-numeric _FillValue verbatim with a comment that this is intentional pass-through. Later, xrspatial/geotiff/_writers/eager.py:654 calls np.isnan(nodata), which raises a TypeError with no reference to the offending attribute.
Reproduction
import numpy as np, xarray as xr, tempfile
from xrspatial.geotiff import to_geotiff
da = xr.DataArray(np.full((4,4), np.nan, dtype=np.float32),
coords={'y': np.arange(4), 'x': np.arange(4)},
dims=('y','x'),
attrs={'_FillValue': 'missing'})
with tempfile.NamedTemporaryFile(suffix='.tif') as f:
to_geotiff(da, f.name)
# TypeError: ufunc 'isnan' not supported for the input types,
# and the inputs could not be safely coerced to any supported
# types according to the casting rule ''safe''
Expected behavior
_resolve_nodata should reject a non-numeric _FillValue (or nodata) at the validation boundary with a clear ValueError naming the attribute, the value, and that nodata must be numeric. The nodatavals branch already filters non-numeric entries; the _FillValue branch should do the same instead of relying on a downstream NumPy ufunc to crash.
Additional context
Found in a code review of the geotiff module alongside #1971 and #1972.
Describe the bug
xrspatial/geotiff/_attrs.py:228returns a non-numeric_FillValueverbatim with a comment that this is intentional pass-through. Later,xrspatial/geotiff/_writers/eager.py:654callsnp.isnan(nodata), which raises aTypeErrorwith no reference to the offending attribute.Reproduction
Expected behavior
_resolve_nodatashould reject a non-numeric_FillValue(ornodata) at the validation boundary with a clearValueErrornaming the attribute, the value, and that nodata must be numeric. Thenodatavalsbranch already filters non-numeric entries; the_FillValuebranch should do the same instead of relying on a downstream NumPy ufunc to crash.Additional context
Found in a code review of the geotiff module alongside #1971 and #1972.