Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bucket sum resampler: TypeError: get_sum() got an unexpected keyword argument 'fill_value' #1746

Closed
gerritholl opened this issue Jun 30, 2021 · 1 comment · Fixed by pytroll/pyresample#602

Comments

@gerritholl
Copy link
Collaborator

Describe the bug

The bucket_sum resampler fails with a TypeError.

To Reproduce

import satpy
from satpy.utils import debug_on; debug_on()
filenames = ["/media/nas/x21308/scratch/prob-glm-abi/" + f for f in [
    "OR_ABI-L1b-RadF-M6C14_G16_s19000010000000_e19000010005000_c20403662359590.nc",
    "OR_GLM-L2-GLMF-M3_G16_s19000010000000_e19000010001000_c20403662359590.nc",
    "OR_GLM-L2-GLMF-M3_G16_s19000010001000_e19000010002000_c20403662359590.nc",
    "OR_GLM-L2-GLMF-M3_G16_s19000010002000_e19000010003000_c20403662359590.nc",
    "OR_GLM-L2-GLMF-M3_G16_s19000010003000_e19000010004000_c20403662359590.nc",
    "OR_GLM-L2-GLMF-M3_G16_s19000010004000_e19000010005000_c20403662359590.nc"]]
sc = satpy.Scene(filenames=filenames, reader=["abi_l1b", "glm_l2"])
sc.load(["flash_extent_density"])
ls = sc.resample("germ", resampler="bucket_sum")

Expected behavior

Probably a resampled scene with fill values, considering that those are dummy files and they don't cover germany.

Actual results

[DEBUG: 2021-06-30 16:55:20 : satpy.readers.yaml_reader] Reading ('/home/gholl/checkouts/satpy/satpy/etc/readers/abi_l1b.yaml', '/media/nas/o16091/00_MITARBEITER/HOLL/Arbeit/checkouts-perforce/dev_Accso_EBP/config/readers/abi_l1b.yaml')
[DEBUG: 2021-06-30 16:55:20 : satpy.readers.yaml_reader] Assigning to abi_l1b: ['/media/nas/x21308/scratch/prob-glm-abi/OR_ABI-L1b-RadF-M6C14_G16_s19000010000000_e19000010005000_c20403662359590.nc']
[DEBUG: 2021-06-30 16:55:21 : satpy.readers.yaml_reader] Reading ('/home/gholl/checkouts/satpy/satpy/etc/readers/glm_l2.yaml',)
[DEBUG: 2021-06-30 16:55:21 : satpy.readers.yaml_reader] Assigning to glm_l2: ['/media/nas/x21308/scratch/prob-glm-abi/OR_GLM-L2-GLMF-M3_G16_s19000010001000_e19000010002000_c20403662359590.nc', '/media/nas/x21308/scratch/prob-glm-abi/OR_GLM-L2-GLMF-M3_G16_s19000010000000_e19000010001000_c20403662359590.nc', '/media/nas/x21308/scratch/prob-glm-abi/OR_GLM-L2-GLMF-M3_G16_s19000010003000_e19000010004000_c20403662359590.nc', '/media/nas/x21308/scratch/prob-glm-abi/OR_GLM-L2-GLMF-M3_G16_s19000010002000_e19000010003000_c20403662359590.nc', '/media/nas/x21308/scratch/prob-glm-abi/OR_GLM-L2-GLMF-M3_G16_s19000010004000_e19000010005000_c20403662359590.nc']
[DEBUG: 2021-06-30 16:55:21 : satpy.composites.config_loader] Looking for composites config file glm.yaml
[DEBUG: 2021-06-30 16:55:21 : satpy.composites.config_loader] Looking for composites config file visir.yaml
[DEBUG: 2021-06-30 16:55:21 : satpy.composites.config_loader] Looking for composites config file abi.yaml
[DEBUG: 2021-06-30 16:55:21 : satpy.readers.glm_l2] Reading in get_dataset flash_extent_density.
[DEBUG: 2021-06-30 16:55:21 : satpy.readers.glm_l2] Reading in get_dataset flash_extent_density.
[DEBUG: 2021-06-30 16:55:21 : satpy.readers.glm_l2] Reading in get_dataset flash_extent_density.
[DEBUG: 2021-06-30 16:55:21 : satpy.readers.glm_l2] Reading in get_dataset flash_extent_density.
[DEBUG: 2021-06-30 16:55:21 : satpy.readers.glm_l2] Reading in get_dataset flash_extent_density.
/data/gholl/miniconda3/envs/py39/lib/python3.9/site-packages/pyproj/crs/crs.py:1216: 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                                                                                                                                                                                                                                               
  return self._crs.to_proj4(version=version)
[DEBUG: 2021-06-30 16:55:21 : satpy.scene] Resampling DataID(name='flash_extent_density', resolution=2000, modifiers=())
[INFO: 2021-06-30 16:55:21 : satpy.scene] Not reducing data before resampling.
[DEBUG: 2021-06-30 16:55:21 : satpy.resample] Initializing bucket resampler.
/data/gholl/miniconda3/envs/py39/lib/python3.9/site-packages/pyproj/crs/crs.py:1216: 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                                                                                                                                                                                                                                               
  return self._crs.to_proj4(version=version)
[INFO: 2021-06-30 16:55:21 : pyresample.bucket] Determine bucket resampling indices
/home/gholl/checkouts/pyresample/pyresample/bucket/__init__.py:129: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.                                                                                                          
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  x_idxs = da.floor((proj_x - adef.area_extent[0]) / x_res).astype(np.int)
/home/gholl/checkouts/pyresample/pyresample/bucket/__init__.py:130: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.                                                                                                          
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  y_idxs = da.floor((adef.area_extent[3] - proj_y) / y_res).astype(np.int)
[DEBUG: 2021-06-30 16:55:21 : satpy.resample] Resampling DataID(name='flash_extent_density', resolution=2000, modifiers=())
Traceback (most recent call last):
  File "/home/gholl/checkouts/protocode/mwe/bucket-sum-failure.py", line 12, in <module>
    ls = sc.resample("germ", resampler="bucket_sum")
  File "/home/gholl/checkouts/satpy/satpy/scene.py", line 812, in resample
    self._resampled_scene(new_scn, destination, resampler=resampler,
  File "/home/gholl/checkouts/satpy/satpy/scene.py", line 773, in _resampled_scene
    res = resample_dataset(dataset, destination_area, **kwargs)
  File "/home/gholl/checkouts/satpy/satpy/resample.py", line 1390, in resample_dataset
    new_data = resample(source_area, dataset, destination_area, fill_value=fill_value, **kwargs)
  File "/home/gholl/checkouts/satpy/satpy/resample.py", line 1353, in resample
    res = resampler_instance.resample(data, **kwargs)
  File "/home/gholl/checkouts/satpy/satpy/resample.py", line 1129, in resample
    result = self.compute(data_arr, **kwargs)
  File "/home/gholl/checkouts/satpy/satpy/resample.py", line 1238, in compute
    res = self.resampler.get_sum(data, **kwargs)
TypeError: get_sum() got an unexpected keyword argument 'fill_value'

Environment Info:

  • Satpy Version: v0.29.0-58-gca8b6d9d
  • PyResample Version: v1.20.0

Additional context
Maybe I shouldn't be using the bucket resampler at all. I haven't tried this on real data yet as I'm still working on my unit tests. Maybe it's triggered by something strange in my data, but other resamplers work and it doesn't sound like an exception that should be happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants