sunpy: EUI jp2 images cannot be mapped

Describe the bug

Attempting to parse an EUI jp2 file from https://www.sidc.be/EUI/data/releases/202204_release_5.0/L3/ results in an error. Traceback below.

To Reproduce

Download https://www.sidc.be/EUI/data/releases/202204_release_5.0/L3/2022/02/07/solo_L3_eui-fsi174-image_20220207T050550186_V01.jp2 or any other jp2 file Then run:

from sunpy.map import Map
Map("solo_L3_eui-fsi174-image_20220207T050550186_V01.jp2")

What happened?

>>> Map("solo_L3_eui-fsi174-image_20220207T050550186_V01.jp2")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/dist-packages/sunpy/map/map_factory.py", line 331, in __call__
    new_map = self._check_registered_widgets(data, meta, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/sunpy/map/map_factory.py", line 381, in _check_registered_widgets
    return WidgetType(data, meta, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/sunpy/map/sources/solo.py", line 37, in __init__
    self.plot_settings['cmap'] = self._get_cmap_name()
  File "/usr/local/lib/python3.8/dist-packages/sunpy/map/mapbase.py", line 1396, in _get_cmap_name
    str(int(self.wavelength.to('angstrom').value)))
  File "/usr/local/lib/python3.8/dist-packages/astropy/units/quantity.py", line 848, in to
    value = self._to_value(unit, equivalencies)
  File "/usr/local/lib/python3.8/dist-packages/astropy/units/quantity.py", line 802, in _to_value
    return self.unit.to(unit, self.view(np.ndarray),
  File "/usr/local/lib/python3.8/dist-packages/astropy/units/core.py", line 1135, in to
    return self._get_converter(Unit(other),
  File "/usr/local/lib/python3.8/dist-packages/astropy/units/core.py", line 1066, in _get_converter
    raise exc
  File "/usr/local/lib/python3.8/dist-packages/astropy/units/core.py", line 1051, in _get_converter
    return self._apply_equivalencies(
  File "/usr/local/lib/python3.8/dist-packages/astropy/units/core.py", line 1027, in _apply_equivalencies
    raise UnitConversionError(
astropy.units.core.UnitConversionError: '' (dimensionless) and 'Angstrom' (length) are not convertible

Expected behavior

Map is returned.

Screenshots

No response

System Details

==============================
sunpy Installation Information
==============================

General
#######
OS: Ubuntu (20.04, Linux 5.10.76-linuxkit)
Arch: 64bit, (x86_64)
sunpy: 4.0.0
Installation path: /usr/local/lib/python3.8/dist-packages/sunpy-4.0.0.dist-info

Required Dependencies
#####################
astropy: 5.0.1
numpy: 1.22.2
packaging: 21.3
parfive: 1.5.1

Optional Dependencies
#####################
asdf: Missing asdf>=2.8.0; extra == "asdf"
asdf-astropy: Missing asdf-astropy>=0.1.1; extra == "asdf"
beautifulsoup4: 4.10.0
cdflib: Missing cdflib!=0.4.0,>=0.3.19; extra == "timeseries"
dask: Missing dask[array]>=2.0.0; extra == "dask"
drms: 0.6.2
glymur: 0.9.7.post1
h5netcdf: Missing h5netcdf>=0.8.1; extra == "timeseries"
h5py: Missing h5py>=3.1.0; extra == "timeseries"
matplotlib: 3.5.1
mpl-animators: 1.0.1
pandas: 1.4.1
python-dateutil: 2.8.2
reproject: 0.8
scikit-image: 0.18.3
scipy: 1.8.0
sqlalchemy: Missing sqlalchemy>=1.3.4; extra == "database"
tqdm: 4.63.0
zeep: 4.1.0

Installation method

pip

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 30 (28 by maintainers)

Most upvoted comments

Yes, in that document it says that all values in the ‘WAVELNTH’ keyword are given in Anstroms, so we should override the .waveunit property on the EUI map class (and any other solar orbiter classes if/when we add them in the future)