Description
Three public functions in xrspatial.reproject validate their input only with isinstance(_, xr.DataArray). Bad input (1-D DataArray, complex dtype, etc.) plunges into helpers and fails with cryptic KeyError / IndexError instead of a clean ValueError from the public API.
| Function |
Site |
Bad input today |
reproject() |
xrspatial/reproject/__init__.py:524-528 |
1-D DataArray -> KeyError in _find_spatial_dims |
merge() |
xrspatial/reproject/__init__.py:1350-1354 |
per-element bad raster -> AttributeError |
geoid_height_raster() |
xrspatial/reproject/_vertical.py:212 |
non-DataArray -> AttributeError on .coords |
Expected behavior
Each public function calls _validate_raster on its DataArray input(s) before any helper accesses .coords / .dims.
Proposed fix
Replace the isinstance guard / dimension probe with _validate_raster(raster, func_name=..., name=..., ndim=(2, 3)). For merge, validate each element of rasters in the iteration loop.
Description
Three public functions in
xrspatial.reprojectvalidate their input only withisinstance(_, xr.DataArray). Bad input (1-D DataArray, complex dtype, etc.) plunges into helpers and fails with crypticKeyError/IndexErrorinstead of a cleanValueErrorfrom the public API.reproject()xrspatial/reproject/__init__.py:524-528_find_spatial_dimsmerge()xrspatial/reproject/__init__.py:1350-1354geoid_height_raster()xrspatial/reproject/_vertical.py:212.coordsExpected behavior
Each public function calls
_validate_rasteron its DataArray input(s) before any helper accesses.coords/.dims.Proposed fix
Replace the
isinstanceguard / dimension probe with_validate_raster(raster, func_name=..., name=..., ndim=(2, 3)). Formerge, validate each element ofrastersin the iteration loop.