From b624ccd6ceffcf7d0c4f629a434d370ebcc3c289 Mon Sep 17 00:00:00 2001 From: Romain Hugonnet Date: Tue, 21 Jan 2025 16:51:25 +1300 Subject: [PATCH] Fix SciPy warnings and errors --- tests/test_coreg/test_biascorr.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_coreg/test_biascorr.py b/tests/test_coreg/test_biascorr.py index bd8e6247..e2660235 100644 --- a/tests/test_coreg/test_biascorr.py +++ b/tests/test_coreg/test_biascorr.py @@ -321,7 +321,7 @@ def test_biascorr__bin_2d(self, fit_args, bin_sizes, bin_statistic) -> None: scipy.optimize.curve_fit, ], ) # type: ignore - @pytest.mark.parametrize("bin_sizes", (10, {"elevation": np.arange(0, 1000, 100)})) # type: ignore + @pytest.mark.parametrize("bin_sizes", (100, {"elevation": np.arange(0, 1000, 100)})) # type: ignore @pytest.mark.parametrize("bin_statistic", [np.median, np.nanmean]) # type: ignore def test_biascorr__bin_and_fit_1d(self, fit_args, fit_func, fit_optimizer, bin_sizes, bin_statistic) -> None: """Test the _fit_func and apply_func methods of BiasCorr for the bin_and_fit case (called by all subclasses).""" @@ -377,6 +377,10 @@ def test_biascorr__bin_and_fit_1d(self, fit_args, fit_func, fit_optimizer, bin_s def test_biascorr__bin_and_fit_2d(self, fit_args, fit_func, fit_optimizer, bin_sizes, bin_statistic) -> None: """Test the _fit_func and apply_func methods of BiasCorr for the bin_and_fit case (called by all subclasses).""" + # Curve fit can be unhappy in certain circumstances for numerical estimation of covariance + # We don't care for this test + warnings.filterwarnings("ignore", message="Covariance of the parameters could not be estimated*") + # Create a bias correction object bcorr = biascorr.BiasCorr( fit_or_bin="bin_and_fit",