From f70d0e26c86273c8b5058ea4db96b9230cdadcb4 Mon Sep 17 00:00:00 2001 From: Nirkan Date: Mon, 9 Feb 2026 22:12:46 +0100 Subject: [PATCH 1/4] Eliminate natural_breaks Warning from test output. --- xrspatial/tests/test_classify.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xrspatial/tests/test_classify.py b/xrspatial/tests/test_classify.py index 5368239a..1b8e96f5 100644 --- a/xrspatial/tests/test_classify.py +++ b/xrspatial/tests/test_classify.py @@ -208,7 +208,8 @@ def test_natural_breaks_not_enough_unique_values(): agg = input_data() n_uniques = np.isfinite(agg.data).sum() k = n_uniques + 1 - result_natural_breaks = natural_breaks(agg, k=k) + with pytest.warns(Warning): + result_natural_breaks = natural_breaks(agg, k=k) n_uniques_result = np.isfinite(result_natural_breaks.data).sum() np.testing.assert_allclose(n_uniques_result, n_uniques) From 0934f23de73ba9df37bbeb5420d39f0c55f44953 Mon Sep 17 00:00:00 2001 From: Nirkan Date: Mon, 9 Feb 2026 22:20:11 +0100 Subject: [PATCH 2/4] fix test_hotspots_zero_global_std kernel warning. --- xrspatial/tests/test_focal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xrspatial/tests/test_focal.py b/xrspatial/tests/test_focal.py index 1c05d083..49aad383 100644 --- a/xrspatial/tests/test_focal.py +++ b/xrspatial/tests/test_focal.py @@ -457,7 +457,7 @@ def data_hotspots(): def test_hotspots_zero_global_std(): data = np.zeros((10, 20)) agg = create_test_raster(data) - kernel = np.zeros((3, 3)) + kernel = np.ones((3, 3)) msg = "Standard deviation of the input raster values is 0." with pytest.raises(ZeroDivisionError, match=msg): hotspots(agg, kernel) From 614b6329f9829aece9b5b8badccff12d7c9cb977 Mon Sep 17 00:00:00 2001 From: Nirkan Date: Tue, 10 Feb 2026 16:53:03 +0100 Subject: [PATCH 3/4] filter non-crossable location warnings. --- xrspatial/tests/test_pathfinding.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xrspatial/tests/test_pathfinding.py b/xrspatial/tests/test_pathfinding.py index 5858d0c2..0f718e12 100644 --- a/xrspatial/tests/test_pathfinding.py +++ b/xrspatial/tests/test_pathfinding.py @@ -74,6 +74,8 @@ def test_a_star_search_no_barriers(input_data): assert np.nanmin(path_agg) == 0 +@pytest.mark.filterwarnings("ignore:Start at a non crossable location:Warning") +@pytest.mark.filterwarnings("ignore:End at a non crossable location:Warning") def test_a_star_search_with_barriers(input_data): agg = input_data barriers = [1] @@ -92,6 +94,8 @@ def test_a_star_search_with_barriers(input_data): general_output_checks(agg, path_agg, expected_results) +@pytest.mark.filterwarnings("ignore:Start at a non crossable location:Warning") +@pytest.mark.filterwarnings("ignore:End at a non crossable location:Warning") def test_a_star_search_snap(input_data_with_nans): agg, start, goal = input_data_with_nans From 0c10d6b0ce8c3df43cdb71620c10cab32aa41261 Mon Sep 17 00:00:00 2001 From: Nirkan Date: Tue, 10 Feb 2026 16:54:26 +0100 Subject: [PATCH 4/4] filter All-NaN slice and divide warnings from dask blocks. --- xrspatial/tests/test_zonal.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xrspatial/tests/test_zonal.py b/xrspatial/tests/test_zonal.py index e2bd1f84..326d4077 100644 --- a/xrspatial/tests/test_zonal.py +++ b/xrspatial/tests/test_zonal.py @@ -447,7 +447,8 @@ def test_default_stats_dataarray( assert_input_data_unmodified(data_zones, copied_data_zones) assert_input_data_unmodified(data_values_2d, copied_data_values_2d) - +@pytest.mark.filterwarnings("ignore:All-NaN slice encountered:RuntimeWarning") +@pytest.mark.filterwarnings("ignore:invalid value encountered in divide:RuntimeWarning") @pytest.mark.parametrize("backend", ['numpy', 'dask+numpy', 'cupy']) def test_zone_ids_stats(backend, data_zones, data_values_2d, result_zone_ids_stats, result_zone_ids_stats_no_majority):