Describe the bug
viewshed() returns a DataArray whose .name and dtype depend on which backend ran, even when the input is identical. For an input DataArray named elevation:
- numpy:
.name is None, dtype float64
- cupy (RTX):
.name is hardcoded to "viewshed", dtype float32
- cupy +
max_distance: .name is None, dtype float64
- dask+numpy / dask+cupy (in-memory tier):
.name is the dask graph token (e.g. array-ffa3..., concatenate-be6...), and dtype is float32 when the GPU tier ran, else float64
There are two distinct problems:
- The output name is not set consistently. The CPU path leaves it
None, the RTX path hardcodes "viewshed", and the dask paths leak the internal dask graph token because the output DataArray is built without an explicit name=.
- The output dtype is
float32 on the GPU/RTX exact path but float64 everywhere else.
Sibling modules (slope, curvature, hillshade) already take a name= parameter, pass it through to the output, and keep dtype consistent across numpy and cupy. viewshed() does neither.
Expected behavior
For the same input, viewshed() should return a DataArray with the same .name and the same dtype no matter which backend ran. Matching the sibling modules: add a name= parameter (default None), set the output name from it on every backend, and return float64 on all backends.
Additional context
Found by the /deep-sweep metadata propagation sweep on the viewshed module. Severity MEDIUM (Cat 5, backend-inconsistent metadata). attrs, coords, and dims are preserved correctly on every backend; only .name and output dtype drift.
Describe the bug
viewshed()returns a DataArray whose.nameand dtype depend on which backend ran, even when the input is identical. For an input DataArray namedelevation:.nameisNone, dtypefloat64.nameis hardcoded to"viewshed", dtypefloat32max_distance:.nameisNone, dtypefloat64.nameis the dask graph token (e.g.array-ffa3...,concatenate-be6...), and dtype isfloat32when the GPU tier ran, elsefloat64There are two distinct problems:
None, the RTX path hardcodes"viewshed", and the dask paths leak the internal dask graph token because the output DataArray is built without an explicitname=.float32on the GPU/RTX exact path butfloat64everywhere else.Sibling modules (slope, curvature, hillshade) already take a
name=parameter, pass it through to the output, and keep dtype consistent across numpy and cupy.viewshed()does neither.Expected behavior
For the same input,
viewshed()should return a DataArray with the same.nameand the same dtype no matter which backend ran. Matching the sibling modules: add aname=parameter (defaultNone), set the output name from it on every backend, and returnfloat64on all backends.Additional context
Found by the /deep-sweep metadata propagation sweep on the viewshed module. Severity MEDIUM (Cat 5, backend-inconsistent metadata). attrs, coords, and dims are preserved correctly on every backend; only
.nameand output dtype drift.