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

native resampler fails for some chunk sizes #2245

Closed
simonrp84 opened this issue Oct 26, 2022 · 0 comments · Fixed by #2291
Closed

native resampler fails for some chunk sizes #2245

simonrp84 opened this issue Oct 26, 2022 · 0 comments · Fixed by #2291

Comments

@simonrp84
Copy link
Member

Describe the bug
When resampling Himawari full disk data with the native resampler while using a user-defined chunk size the resampling operation fails. Thisis because the aggregation factor of the native resampler is not being a factor of the chunk size.

To Reproduce

import os
os.environ['PYTROLL_CHUNK_SIZE'] = '550'

from satpy import Scene
from glob import glob

scn = Scene(glob('/my_himawari_data/*.DAT'), reader='ahi_hsd')
scn.load(['true_color_nocorr', 'B13'])

scn2 = scn.resample(scn['B13'].attrs['area'], resampler='native')

Expected behavior
The scene is resampled onto the B13 area.

Actual results
An error:

  File "/home/users/srproud/Software/satpy/satpy/scene.py", line 955, in resample
    self._resampled_scene(new_scn, destination, resampler=resampler,
  File "/home/users/srproud/Software/satpy/satpy/scene.py", line 871, in _resampled_scene
    res = resample_dataset(dataset, destination_area, **kwargs)
  File "/home/users/srproud/Software/satpy/satpy/resample.py", line 1418, in resample_dataset
    new_data = resample(source_area, dataset, destination_area, fill_value=fill_value, **kwargs)
  File "/home/users/srproud/Software/satpy/satpy/resample.py", line 1381, in resample
    res = resampler_instance.resample(data, **kwargs)
  File "/home/users/srproud/Software/satpy/satpy/resample.py", line 981, in resample
    return super(NativeResampler, self).resample(data,
  File "/home/users/srproud/Software/satpy/satpy/resample.py", line 439, in resample
    return self.compute(data, cache_id=cache_id, **kwargs)
  File "/home/users/srproud/Software/satpy/satpy/resample.py", line 1084, in compute
    d_arr = self._expand_reduce(data.data, repeats)
  File "/home/users/srproud/Software/satpy/satpy/resample.py", line 1051, in _expand_reduce
    return cls._aggregate(d_arr, y_size, x_size)
  File "/home/users/srproud/Software/satpy/satpy/resample.py", line 999, in _aggregate
    raise ValueError("Aggregation requires arrays with "
ValueError: Aggregation requires arrays with shapes and chunks divisible by the factor

This is because the aggregation factor for the B03 channel (4) is not a factor of the chunk size (550). The problem can be resolved by the user if they change the chunk size, but ideally satpy should be able to sort this out for itself.

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

Successfully merging a pull request may close this issue.

1 participant