Skip to content

Commit 0ddfb30

Browse files
committed
Fix reduce_data argument forwarding
1 parent f5bd750 commit 0ddfb30

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

AUTHORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,4 @@ The following people have made contributions to this project:
112112
- [Xuanhan Lai (sgxl)](https://github.com/sgxl)
113113
- [Nalin Parihar(Nalin7parihar](https://github.com/Nalin7parihar)
114114
- [Francesc Lucas Carbó (cesclc)](https://github.com/cesclc)
115+
- [Kamil Monicz (Zaczero)](https://github.com/Zaczero)

satpy/resample/kdtree.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ def precompute(self, mask=None, radius_of_influence=50000, epsilon=0,
229229
target_geo_def=self.target_geo_def,
230230
radius_of_influence=radius_of_influence,
231231
neighbours=32,
232-
epsilon=epsilon)
232+
epsilon=epsilon,
233+
reduce_data=reduce_data)
233234

234235
self.resampler = XArrayBilinearResampler(**kwargs)
235236
try:

satpy/tests/test_resample.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,21 @@ def test_reduce_first_dim_rechunk_second_dim_good(self):
337337
class TestBilinearResampler(unittest.TestCase):
338338
"""Test the bilinear resampler."""
339339

340+
@mock.patch("pyresample.bilinear.XArrayBilinearResampler")
341+
def test_precompute_forwards_reduce_data(self, xr_resampler):
342+
"""Test that precompute forwards reduce_data to pyresample bilinear."""
343+
from satpy.resample.kdtree import BilinearResampler
344+
345+
_, source_area, _, _, target_area = get_test_data()
346+
resampler = BilinearResampler(source_area, target_area)
347+
resampler.precompute()
348+
assert xr_resampler.call_args.kwargs["reduce_data"] is True
349+
350+
xr_resampler.reset_mock()
351+
resampler = BilinearResampler(source_area, target_area)
352+
resampler.precompute(reduce_data=False)
353+
assert xr_resampler.call_args.kwargs["reduce_data"] is False
354+
340355
@mock.patch("satpy.resample.kdtree._move_existing_caches")
341356
@mock.patch("satpy.resample.kdtree.BilinearResampler._create_cache_filename")
342357
@mock.patch("pyresample.bilinear.XArrayBilinearResampler")

0 commit comments

Comments
 (0)