diff --git a/AUTHORS.md b/AUTHORS.md index 5d4cc8a82f..f921ac2c1f 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -112,3 +112,4 @@ The following people have made contributions to this project: - [Xuanhan Lai (sgxl)](https://github.com/sgxl) - [Nalin Parihar(Nalin7parihar](https://github.com/Nalin7parihar) - [Francesc Lucas Carbó (cesclc)](https://github.com/cesclc) +- [Kamil Monicz (Zaczero)](https://github.com/Zaczero) diff --git a/satpy/resample/kdtree.py b/satpy/resample/kdtree.py index 8f6d298e67..880cafa1d5 100644 --- a/satpy/resample/kdtree.py +++ b/satpy/resample/kdtree.py @@ -214,7 +214,7 @@ def __init__(self, source_geo_def, target_geo_def): self.resampler = None def precompute(self, mask=None, radius_of_influence=50000, epsilon=0, - reduce_data=True, cache_dir=False, **kwargs): + reduce_data=True, limit_output=True, cache_dir=False, **kwargs): """Create bilinear coefficients and store them for later use.""" try: from pyresample.bilinear import XArrayBilinearResampler @@ -229,7 +229,9 @@ def precompute(self, mask=None, radius_of_influence=50000, epsilon=0, target_geo_def=self.target_geo_def, radius_of_influence=radius_of_influence, neighbours=32, - epsilon=epsilon) + epsilon=epsilon, + reduce_data=reduce_data, + limit_output=limit_output) self.resampler = XArrayBilinearResampler(**kwargs) try: diff --git a/satpy/tests/test_resample.py b/satpy/tests/test_resample.py index 32784e9696..a936bd4dbf 100644 --- a/satpy/tests/test_resample.py +++ b/satpy/tests/test_resample.py @@ -337,6 +337,27 @@ def test_reduce_first_dim_rechunk_second_dim_good(self): class TestBilinearResampler(unittest.TestCase): """Test the bilinear resampler.""" + @mock.patch("pyresample.bilinear.XArrayBilinearResampler") + def test_precompute_forwards_bilinear_options(self, xr_resampler): + """Test that precompute forwards bilinear options to pyresample.""" + from satpy.resample.kdtree import BilinearResampler + + _, source_area, _, _, target_area = get_test_data() + resampler = BilinearResampler(source_area, target_area) + resampler.precompute() + assert xr_resampler.call_args.kwargs["reduce_data"] is True + assert xr_resampler.call_args.kwargs["limit_output"] is True + + xr_resampler.reset_mock() + resampler = BilinearResampler(source_area, target_area) + resampler.precompute(reduce_data=False) + assert xr_resampler.call_args.kwargs["reduce_data"] is False + + xr_resampler.reset_mock() + resampler = BilinearResampler(source_area, target_area) + resampler.precompute(limit_output=False) + assert xr_resampler.call_args.kwargs["limit_output"] is False + @mock.patch("satpy.resample.kdtree._move_existing_caches") @mock.patch("satpy.resample.kdtree.BilinearResampler._create_cache_filename") @mock.patch("pyresample.bilinear.XArrayBilinearResampler")