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

Reading the SEVIRI HRV channel with seviri_l1b_native returns a numpy array #1261

Closed
ameraner opened this issue Jul 16, 2020 · 3 comments · Fixed by #1272
Closed

Reading the SEVIRI HRV channel with seviri_l1b_native returns a numpy array #1261

ameraner opened this issue Jul 16, 2020 · 3 comments · Fixed by #1272

Comments

@ameraner
Copy link
Member

Describe the bug
The seviri_l1b_native reader returns a numpy array instead of a dask array for the HRV channel. Apart from the reader not being dask-compliant, another symptom of this is Satpy failing on e.g. loading composites combining HRV and channels with other resolutions.

To Reproduce

from satpy.scene import Scene

scn_sev = Scene(filenames=[sev_filepath], reader='seviri_l1b_native')

scn_sev.load(['HRV'])
print(type(scn_sev['HRV'].data))
# prints: <class 'numpy.ndarray'>

scn_sev.load(['vis_sharpened_ir'])

Expected behavior
A correctly loaded dataset and HRV channel data in a dask array.

Actual results

Traceback (most recent call last):
  File "/tcenas/home/andream/anaconda3/envs/trolldev_latest/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3343, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-1-4de67669f23a>", line 1, in <module>
    scn_sev.load(['vis_sharpened_ir'])
  File "/tcenas/home/andream/code/satpy_latest/satpy/satpy/scene.py", line 975, in load
    keepables = self.generate_composites()
  File "/tcenas/home/andream/code/satpy_latest/satpy/satpy/scene.py", line 888, in generate_composites
    return self._read_composites(nodes)
  File "/tcenas/home/andream/code/satpy_latest/satpy/satpy/scene.py", line 863, in _read_composites
    self._generate_composite(item, keepables)
  File "/tcenas/home/andream/code/satpy_latest/satpy/satpy/scene.py", line 838, in _generate_composite
    **self.attrs)
  File "/tcenas/home/andream/code/satpy_latest/satpy/satpy/composites/__init__.py", line 398, in __call__
    lons, lats = vis.attrs["area"].get_lonlats(chunks=vis.data.chunks)
AttributeError: 'numpy.ndarray' object has no attribute 'chunks'
@ameraner
Copy link
Member Author

One hurdle for dask-ifying the reader is implementing the channel lines interleaving that is necessary to correctly read the native data (see these lines). @mraspaud suggests something like:
data = hstack((data0, data1, data2)).reshape(data0.shape[0], :)

@ameraner
Copy link
Member Author

ameraner commented Jul 23, 2020

FYI, even after #1272 is merged, scn_sev.load(['vis_sharpened_ir']) will still fail due to mismatching chunk sizes. But this is a bug in pyresample and not related to the SEVIRI native reader (see Slack discussion)

@ameraner
Copy link
Member Author

The issue I mention in the last message was fixed in pytroll/pyresample#313

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