Repository: sunpy/sunpy

Issue:
IRIS SJI maps call undefined header in self.wavelength
### Describe the bug

When creating SJI maps by feeding data and header separately into a Map() and then doing a plot, this causes an error because it calls an undefined header.

### To Reproduce

import glob
from [astropy.io](http://astropy.io/) import fits
from [sunpy.map](http://sunpy.map/) import Map

data_file = glob.glob('IRIS/*_SJI_2832_*fits')
data_file.sort()

hdul = [fits.open](http://fits.open/)(data_file[0])
    
header = hdul[0].header
data = hdul[0].data

Map(data[0], header).plot()

### What happened?

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
/tmp/ipykernel_73554/1651218312.py in <module>
      7 data = hdul[0].data
      8 
----> 9 Map(data[0], header).plot()

~/SunEnvironment/lib64/python3.8/site-packages/astropy/units/decorators.py in wrapper(*func_args, **func_kwargs)
    251             # Call the original function with any equivalencies in force.
    252             with add_enabled_equivalencies(self.equivalencies):
--> 253                 return_ = wrapped_function(*func_args, **func_kwargs)
    254 
    255             valid_empty = (inspect.Signature.empty, None)

~/SunEnvironment/lib64/python3.8/site-packages/sunpy/map/mapbase.py in plot(self, annotate, axes, title, autoalign, clip_interval, **imshow_kwargs)
   2406             plot_settings_title = plot_settings.pop('title')
   2407         else:
-> 2408             plot_settings_title = self.latex_name
   2409 
   2410         # Anything left in plot_settings is given to imshow

~/SunEnvironment/lib64/python3.8/site-packages/sunpy/map/mapbase.py in latex_name(self)
    735     def latex_name(self):
    736         """LaTeX formatted description of the Map."""
--> 737         if isinstance(self.measurement, u.Quantity):
    738             return self._base_name().format(measurement=self.measurement._repr_latex_())
    739         else:

~/SunEnvironment/lib64/python3.8/site-packages/sunpy/map/mapbase.py in measurement(self)
    898         defaults to dimensionless units.
    899         """
--> 900         return self.wavelength
    901 
    902     @property

~/SunEnvironment/lib64/python3.8/site-packages/sunpy/map/sources/iris.py in wavelength(self)
     61         Taken from WAVELNTH, or if not present TWAVE1.
     62         """
---> 63         return header.get('wavelnth', header.get('twave1')) * self.waveunit
     64 
     65     @classmethod

NameError: name 'header' is not defined


### Expected behavior

_No response_

### Screenshots

![image](https://user-images.githubusercontent.com/62298880/158391132-38d632bf-7ef4-41ba-b0c0-639a6da7a026.png)


### System Details

sunpy.__version__ : 3.1.3
astropy.__version__: 4.3.1

### Installation method

pip


Discussion:

Resolving patch:
diff --git a/sunpy/map/sources/iris.py b/sunpy/map/sources/iris.py
--- a/sunpy/map/sources/iris.py
+++ b/sunpy/map/sources/iris.py
@@ -26,10 +26,6 @@ class SJIMap(GenericMap):
 
     IRIS was launched into a Sun-synchronous orbit on 27 June 2013.
 
-    .. warning::
-
-        This object can only handle level 1 SJI files.
-
     References
     ----------
     * `IRIS Mission Page <https://iris.lmsal.com>`_
@@ -53,19 +49,27 @@ def waveunit(self):
         """
         Taken from WAVEUNIT, or if not present defaults to Angstrom.
         """
-        return u.Unit(header.get('waveunit', "Angstrom"))
+        return u.Unit(self.meta.get('waveunit', "Angstrom"))
 
     @property
     def wavelength(self):
         """
         Taken from WAVELNTH, or if not present TWAVE1.
         """
-        return header.get('wavelnth', header.get('twave1')) * self.waveunit
+        return self.meta.get('wavelnth', self.meta.get('twave1')) * self.waveunit
+
+    @property
+    def unit(self):
+        unit_str = self.meta.get('bunit', None)
+        if unit_str is None:
+            return
+        # Remove "corrected" so that the unit can be parsed
+        unit_str = unit_str.lower().replace('corrected', '').strip()
+        return self._parse_fits_unit(unit_str)
 
     @classmethod
     def is_datasource_for(cls, data, header, **kwargs):
         """Determines if header corresponds to an IRIS SJI image"""
         tele = str(header.get('TELESCOP', '')).startswith('IRIS')
         obs = str(header.get('INSTRUME', '')).startswith('SJI')
-        level = header.get('lvl_num') == 1
         return tele and obs


Test patch:
diff --git a/sunpy/map/sources/tests/test_iris_source.py b/sunpy/map/sources/tests/test_iris_source.py
--- a/sunpy/map/sources/tests/test_iris_source.py
+++ b/sunpy/map/sources/tests/test_iris_source.py
@@ -43,6 +43,21 @@ def test_observatory(irismap):
     assert irismap.observatory == "IRIS"
 
 
+def test_wavelength(irismap):
+    """Tests the wavelength and waveunit property of the SJIMap"""
+    assert irismap.wavelength == u.Quantity(1400, 'Angstrom')
+
+
+def test_level_number(irismap):
+    """Tests the processing_level property of the SJIMap"""
+    assert irismap.processing_level == 2.0
+
+
+def test_units(irismap):
+    """Tests the unit property of the SJIMap"""
+    assert irismap.unit == u.ct
+
+
 def test_wcs(irismap):
     # Smoke test that WCS is valid and can transform from pixels to world coordinates
     with pytest.warns(SunpyMetadataWarning, match='Missing metadata for observer'):