Summary
The test-coverage sweep found several untested branches in xrspatial/multispectral.py. The index functions have solid backend and NaN coverage, but a few specific code paths are never exercised by the suite.
Untested paths
-
true_color NaN handling. The function builds an alpha channel from np.logical_or(np.isnan(r), r <= nodata). The existing tests feed it random_data (integers in [-100, 100], no NaN), so the NaN branch of the alpha mask is never hit on any of the four backends.
-
true_color all-equal input. When the input has zero range, _normalize_data_cpu guards a divide-by-zero with if range_val != 0. That guard's false branch is never tested.
-
true_color non-default nodata / c / th. All tests call true_color with default parameters only.
-
evi validation guards. evi raises ValueError for non-numeric c1/c2, soil_factor outside [-1, 1], and gain < 0. None of these error paths have a test.
-
savi soil_factor out-of-range. savi raises ValueError when soil_factor is outside [-1, 1]. Not tested.
Proposed fix
Add test-only coverage for the above. No source changes. CUDA is available on the sweep host, so the true_color NaN tests run against cupy and dask+cupy as well as numpy and dask+numpy.
Found by /sweep-test-coverage.
Summary
The test-coverage sweep found several untested branches in
xrspatial/multispectral.py. The index functions have solid backend and NaN coverage, but a few specific code paths are never exercised by the suite.Untested paths
true_colorNaN handling. The function builds an alpha channel fromnp.logical_or(np.isnan(r), r <= nodata). The existing tests feed itrandom_data(integers in [-100, 100], no NaN), so the NaN branch of the alpha mask is never hit on any of the four backends.true_colorall-equal input. When the input has zero range,_normalize_data_cpuguards a divide-by-zero withif range_val != 0. That guard's false branch is never tested.true_colornon-defaultnodata/c/th. All tests calltrue_colorwith default parameters only.evivalidation guards.eviraisesValueErrorfor non-numericc1/c2,soil_factoroutside [-1, 1], andgain < 0. None of these error paths have a test.savisoil_factorout-of-range.saviraisesValueErrorwhensoil_factoris outside [-1, 1]. Not tested.Proposed fix
Add test-only coverage for the above. No source changes. CUDA is available on the sweep host, so the
true_colorNaN tests run against cupy and dask+cupy as well as numpy and dask+numpy.Found by /sweep-test-coverage.