DEBUG: 2024-05-22 13:32:11 : satpy.resample] Initializing bucket resampler.
/tcenas/home/andream/anaconda3/envs/devenv/lib/python3.11/site-packages/pyproj/crs/crs.py:1293: UserWarning: You will likely lose important projection information when converting to a PROJ string from another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
proj = self._crs.to_proj4(version=version)
[INFO: 2024-05-22 13:32:11 : pyresample.bucket] Determine bucket resampling indices
[DEBUG: 2024-05-22 13:32:11 : satpy.resample] Resampling DataID(name='flash_accumulation', modifiers=())
Traceback (most recent call last):
File "/tcenas/proj/optcalimg/andream/pycharm_install/pycharm-2022.3.2/plugins/python/helpers/pydev/pydevd.py", line 1496, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tcenas/proj/optcalimg/andream/pycharm_install/pycharm-2022.3.2/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/tcenas/home/andream/PycharmProjects/dev_src/dev_src/li_data/plot_li_data.py", line 31, in <module>
scn_r = scn.resample('mtg_fci_fdss_2km', resampler='bucket_sum')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tcenas/home/andream/code/satpy_latest/satpy/satpy/scene.py", line 977, in resample
self._resampled_scene(new_scn, destination, resampler=resampler,
File "/tcenas/home/andream/code/satpy_latest/satpy/satpy/scene.py", line 893, in _resampled_scene
res = resample_dataset(dataset, destination_area, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tcenas/home/andream/code/satpy_latest/satpy/satpy/resample.py", line 1068, in resample_dataset
new_data = resample(source_area, dataset, destination_area, fill_value=fill_value, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tcenas/home/andream/code/satpy_latest/satpy/satpy/resample.py", line 1031, in resample
res = resampler_instance.resample(data, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tcenas/home/andream/code/satpy_latest/satpy/satpy/resample.py", line 815, in resample
result = self.compute(data_arr, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tcenas/home/andream/code/satpy_latest/satpy/satpy/resample.py", line 921, in compute
res = self.resampler.get_sum(data, skipna=skipna, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: BucketResampler.get_sum() got an unexpected keyword argument 'fill_value'
Additional Information
There are two solutions:
we handle this in satpy and make sure not to pass the fill_value argument
we handle this in pyresample and add support for fill_value, as already done for the other bucket resamplers.
I would likely go for the second option as it is a useful feature for pyresample and keeps a consistent interface in satpy.
Describe the bug The
bucket_sum
resampler fails due to afill_value
argument https://github.com/pytroll/satpy/blob/233f6985c88b7114e7afc43513641f6d7a97e7a9/satpy/resample.py#L1067-L1068 that is then passed as kwarg to pyresample here: https://github.com/pytroll/satpy/blob/233f6985c88b7114e7afc43513641f6d7a97e7a9/satpy/resample.py#L916-L921 and is then not accepted inside pyresample: https://github.com/pytroll/pyresample/blob/4e18999cb76c3404d0f5ec3df04b3350e56f0612/pyresample/bucket/__init__.py#L205To Reproduce
Expected behavior Working resampler
Actual results
Additional Information There are two solutions:
fill_value
argumentfill_value
, as already done for the other bucket resamplers.I would likely go for the second option as it is a useful feature for pyresample and keeps a consistent interface in satpy.