コード例 #1
0
def fake_multiscene2():
    """Like fake_multiscene, but with real areas (one stacked)."""
    from satpy.dataset.dataid import WavelengthRange
    from satpy.tests.utils import make_dataid
    common_attrs = {
        "start_time": datetime.datetime(1900, 1, 1, 0, 0),
        "end_time": datetime.datetime(1900, 1, 1, 0, 1)
    }
    wl = {
        "C08": WavelengthRange(5.7, 6.2, 6.7),
        "C10": WavelengthRange(6.8, 7.3, 7.8),
        "C14": WavelengthRange(10, 11, 12)
    }
    content = {
        make_dataid(name=x, wavelength=wl.get(x)):
        numpy.arange(5 * 5).reshape(5, 5)
        for x in ("C08", "C10", "C14", "C14_flash_extent_density")
    }
    sc1 = satpy.tests.utils.make_fake_scene(content.copy(),
                                            common_attrs=common_attrs)
    sc2 = satpy.tests.utils.make_fake_scene(content.copy(),
                                            common_attrs=common_attrs)
    sc3 = satpy.tests.utils.make_fake_scene(
        {k: numpy.concatenate([v, v], 0)
         for (k, v) in content.items()},
        area=pyresample.geometry.StackedAreaDefinition(
            sc1["C14"].attrs["area"], sc2["C14"].attrs["area"]),
        common_attrs=common_attrs)
    return satpy.MultiScene([sc1, sc2, sc3])
コード例 #2
0
    def test_set_attrs(self):
        """Test setting scene attributes."""
        seviri2pps.BANDNAMES = ['VIS006', 'IR_108']
        vis006 = mock.MagicMock(
            attrs={'wavelength': WavelengthRange(0.56, 0.635, 0.71)})
        ir108 = mock.MagicMock(
            attrs={
                'platform_name': 'myplatform',
                'wavelength': WavelengthRange(9.8, 10.8, 11.8),
                'orbital_parameters': {
                    'orb_a': 1,
                    'orb_b': 2
                },
                'georef_offset_corrected': True
            })
        scene_dict = {'VIS006': vis006, 'IR_108': ir108}
        scene = mock.MagicMock(attrs={})
        scene.__getitem__.side_effect = scene_dict.__getitem__

        seviri2pps.set_attrs(scene)
        self.assertEqual(scene['VIS006'].attrs['name'], 'image0')
        self.assertEqual(scene['VIS006'].attrs['id_tag'], 'ch_r06')
        self.assertEqual(scene['IR_108'].attrs['name'], 'image1')
        self.assertEqual(scene['IR_108'].attrs['id_tag'], 'ch_tb11')
        self.assertNotIn('orb_a', scene.attrs)
        self.assertNotIn('orbital_parameters', scene.attrs)
        self.assertNotIn('georef_offset_corrected', scene.attrs)
コード例 #3
0
def test_wavelength_range_cf_roundtrip():
    """Test the wavelength range object roundtrip to cf."""
    from satpy.dataset.dataid import WavelengthRange

    wr = WavelengthRange(1, 2, 3)

    assert WavelengthRange.from_cf(wr.to_cf()) == wr
    assert WavelengthRange.from_cf([str(item) for item in wr]) == wr
コード例 #4
0
ファイル: test_dataset.py プロジェクト: pepephillips/satpy
 def test_seviri_hrv_has_priority_over_vis008(self):
     """Check that the HRV channel has priority over VIS008 when querying 0.8µm."""
     dids = [DataID(self.default_id_keys_config, name='HRV',
                    wavelength=WavelengthRange(min=0.5, central=0.7, max=0.9, unit='µm'), resolution=1000.134348869,
                    calibration="reflectance", modifiers=()),
             DataID(self.default_id_keys_config, name='HRV',
                    wavelength=WavelengthRange(min=0.5, central=0.7, max=0.9, unit='µm'), resolution=1000.134348869,
                    calibration="radiance", modifiers=()),
             DataID(self.default_id_keys_config, name='HRV',
                    wavelength=WavelengthRange(min=0.5, central=0.7, max=0.9, unit='µm'), resolution=1000.134348869,
                    calibration="counts", modifiers=()),
             DataID(self.default_id_keys_config, name='VIS006',
                    wavelength=WavelengthRange(min=0.56, central=0.635, max=0.71, unit='µm'),
                    resolution=3000.403165817, calibration="reflectance", modifiers=()),
             DataID(self.default_id_keys_config, name='VIS006',
                    wavelength=WavelengthRange(min=0.56, central=0.635, max=0.71, unit='µm'),
                    resolution=3000.403165817, calibration="radiance", modifiers=()),
             DataID(self.default_id_keys_config, name='VIS006',
                    wavelength=WavelengthRange(min=0.56, central=0.635, max=0.71, unit='µm'),
                    resolution=3000.403165817, calibration="counts", modifiers=()),
             DataID(self.default_id_keys_config, name='VIS008',
                    wavelength=WavelengthRange(min=0.74, central=0.81, max=0.88, unit='µm'),
                    resolution=3000.403165817, calibration="reflectance", modifiers=()),
             DataID(self.default_id_keys_config, name='VIS008',
                    wavelength=WavelengthRange(min=0.74, central=0.81, max=0.88, unit='µm'),
                    resolution=3000.403165817, calibration="radiance", modifiers=()),
             DataID(self.default_id_keys_config, name='VIS008',
                    wavelength=WavelengthRange(min=0.74, central=0.81, max=0.88, unit='µm'),
                    resolution=3000.403165817, calibration="counts", modifiers=())]
     dq = DataQuery(wavelength=0.8)
     res, distances = dq.sort_dataids(dids)
     assert res[0].name == "HRV"
コード例 #5
0
ファイル: _crefl_utils.py プロジェクト: mherbertson/satpy
class _VIIRSCoefficients(_Coefficients):
    # Values from crefl 1.7.1
    LUTS = [
        # aH2O
        np.array([
            0.000406601, 0.0015933, 0, 1.78644e-05, 0.00296457, 0.000617252,
            0.000996563, 0.00222253, 0.00094005, 0.000563288, 0, 0, 0, 0, 0, 0
        ]),
        # bH2O
        np.array([
            0.812659, 0.832931, 1., 0.8677850, 0.806816, 0.944958, 0.78812,
            0.791204, 0.900564, 0.942907, 0, 0, 0, 0, 0, 0
        ]),
        # aO3
        np.array([
            0.0433461, 0.0, 0.0178299, 0.0853012, 0, 0, 0, 0.0813531, 0, 0,
            0.0663, 0.0836, 0.0485, 0.0395, 0.0119, 0.00263
        ]),
        # taur0
        np.array([
            0.04350, 0.01582, 0.16176, 0.09740, 0.00369, 0.00132, 0.00033,
            0.05373, 0.01561, 0.00129, 0.1131, 0.0994, 0.0446, 0.0416, 0.0286,
            0.0155
        ]),
    ]
    # resolution -> wavelength -> coefficient index
    # resolution -> band name -> coefficient index
    COEFF_INDEX_MAP = {
        1000: {
            WavelengthRange(0.662, 0.6720, 0.682): 0,  # M05
            "M05": 0,
            WavelengthRange(0.846, 0.8650, 0.885): 1,  # M07
            "M07": 1,
            WavelengthRange(0.478, 0.4880, 0.498): 2,  # M03
            "M03": 2,
            WavelengthRange(0.545, 0.5550, 0.565): 3,  # M04
            "M04": 3,
            WavelengthRange(1.230, 1.2400, 1.250): 4,  # M08
            "M08": 4,
            WavelengthRange(1.580, 1.6100, 1.640): 5,  # M10
            "M10": 5,
            WavelengthRange(2.225, 2.2500, 2.275): 6,  # M11
            "M11": 6,
        },
        500: {
            WavelengthRange(0.600, 0.6400, 0.680): 7,  # I01
            "I01": 7,
            WavelengthRange(0.845, 0.8650, 0.884): 8,  # I02
            "I02": 8,
            WavelengthRange(1.580, 1.6100, 1.640): 9,  # I03
            "I03": 9,
        },
    }
コード例 #6
0
ファイル: _crefl_utils.py プロジェクト: mherbertson/satpy
class _ABICoefficients(_Coefficients):
    RG_FUDGE = .55  # This number is what Ralph says "looks good" for ABI/AHI
    LUTS = [
        # aH2O
        np.array([
            2.4111e-003, 7.8454e-003 * RG_FUDGE, 7.9258e-3, 9.3392e-003,
            2.53e-2
        ]),
        # aO2 (bH2O for other instruments)
        np.array(
            [1.2360e-003, 3.7296e-003, 177.7161e-006, 10.4899e-003, 1.63e-2]),
        # aO3
        np.array([
            4.2869e-003, 25.6509e-003 * RG_FUDGE, 802.4319e-006, 0.0000e+000,
            2e-5
        ]),
        # taur0
        np.array([
            184.7200e-003, 52.3490e-003, 15.8450e-003, 1.3074e-003,
            311.2900e-006
        ]),
    ]
    # resolution -> wavelength -> coefficient index
    # resolution -> band name -> coefficient index
    COEFF_INDEX_MAP = {
        2000: {
            WavelengthRange(0.450, 0.470, 0.490):
            0,  # C01
            "C01":
            0,
            WavelengthRange(0.590, 0.640, 0.690):
            1,  # C02
            "C02":
            1,
            WavelengthRange(0.8455, 0.865, 0.8845):
            2,  # C03
            "C03":
            2,
            # WavelengthRange((1.3705, 1.378, 1.3855)): None,  # C04 - No coefficients yet
            # "C04": None,
            WavelengthRange(1.580, 1.610, 1.640):
            3,  # C05
            "C05":
            3,
            WavelengthRange(2.225, 2.250, 2.275):
            4,  # C06
            "C06":
            4
        },
    }
コード例 #7
0
def fake_multiscene4():
    """Like fake_multiscene2, but with varying areas (none stacked)."""
    from satpy.dataset.dataid import WavelengthRange
    from satpy.tests.utils import make_dataid
    common_attrs = {}
    wl = {
        "C08": WavelengthRange(5.7, 6.2, 6.7),
        "C10": WavelengthRange(6.8, 7.3, 7.8),
        "C14": WavelengthRange(10, 11, 12)
    }
    content = {
        make_dataid(name=x, wavelength=wl.get(x)):
        numpy.arange(5 * 5).reshape(5, 5)
        for x in ("C08", "C10", "C14")
    }
    content[make_dataid(
        name="flash_extent_density")] = numpy.arange(5 * 5).reshape(5, 5) + 1
    areas = [
        pyresample.create_area_def("test-area", {
            "proj": "eqc",
            "lat_ts": 0,
            "lat_0": 0,
            "lon_0": 0,
            "x_0": 0,
            "y_0": 0,
            "ellps": "sphere",
            "units": "m",
            "no_defs": None,
            "type": "crs"
        },
                                   units="m",
                                   shape=(5, 5),
                                   resolution=1000,
                                   center=(10 * i, 20 * i)) for i in range(3)
    ]

    aids = [0, 0, 0, 0, 0, 0, 1, 1, 1, 2]
    scenes = [
        satpy.tests.utils.make_fake_scene(content.copy(),
                                          common_attrs=common_attrs,
                                          area=areas[i]) for i in aids
    ]
    for (i, sc) in enumerate(scenes):
        for da in sc.values():
            da.attrs["start_time"] = datetime.datetime(1900, 1, 1, 0, i)
            da.attrs["end_time"] = datetime.datetime(1900, 1, 1, 0, i + 1)
    return satpy.MultiScene(scenes)
コード例 #8
0
    def _dataset_for_prefix_testing(self):
        data_visir = [[1, 2], [3, 4]]
        y_visir = [1, 2]
        x_visir = [1, 2]
        lat = 33.0 * np.array([[1, 2], [3, 4]])
        lon = -13.0 * np.array([[1, 2], [3, 4]])
        vis006 = xr.DataArray(data_visir,
                              dims=('y', 'x'),
                              coords={
                                  'y': y_visir,
                                  'x': x_visir
                              },
                              attrs={
                                  'name':
                                  '1',
                                  'id_tag':
                                  'ch_r06',
                                  'coordinates':
                                  'lat lon',
                                  'resolution':
                                  1000,
                                  'calibration':
                                  'reflectance',
                                  'wavelength':
                                  WavelengthRange(min=0.58,
                                                  central=0.63,
                                                  max=0.68,
                                                  unit='µm')
                              })
        lat = xr.DataArray(lat,
                           dims=('y', 'x'),
                           coords={
                               'y': y_visir,
                               'x': x_visir
                           },
                           attrs={
                               'name': 'lat',
                               'standard_name': 'latitude',
                               'modifiers': np.array([])
                           })
        lon = xr.DataArray(lon,
                           dims=('y', 'x'),
                           coords={
                               'y': y_visir,
                               'x': x_visir
                           },
                           attrs={
                               'name': 'lon',
                               'standard_name': 'longitude',
                               'modifiers': np.array([])
                           })
        scene = Scene()
        scene.attrs['sensor'] = ['avhrr-1', 'avhrr-2', 'avhrr-3']
        scene['1'] = vis006
        scene['lat'] = lat
        scene['lon'] = lon

        return scene
コード例 #9
0
ファイル: test_dataset.py プロジェクト: ringsaturn/satpy
def test_wavelength_range():
    """Test the wavelength range object."""
    from satpy.dataset.dataid import WavelengthRange

    wr = WavelengthRange(1, 2, 3)
    assert 1.2 == wr
    assert .9 != wr
    assert wr == (1, 2, 3)
    assert wr == (1, 2, 3, 'µm')

    # Check containement
    assert 1.2 in wr
    assert .9 not in wr
    assert WavelengthRange(1, 2, 3) in wr
    assert WavelengthRange(1.1, 2.2, 3.3) not in wr
    assert WavelengthRange(1.2, 2, 2.8) in wr
    assert WavelengthRange(10, 20, 30) not in wr
    assert 'bla' not in wr
    assert None not in wr
    wr2 = WavelengthRange(1, 2, 3, 'µm')
    assert wr2 in wr
    wr2 = WavelengthRange(1, 2, 3, 'nm')
    with pytest.raises(NotImplementedError):
        wr2 in wr

    # Check __str__
    assert str(wr) == "2 µm (1-3 µm)"
    assert str(wr2) == "2 nm (1-3 nm)"
コード例 #10
0
    def test_update_coords(self, get_mean_acq_time):
        """Test updating coordinates."""
        get_mean_acq_time.return_value = xr.DataArray([7, 8, 9], dims=('x', ))
        seviri2pps.BANDNAMES = ['VIS006', 'IR_108']
        vis006 = xr.DataArray(data=[1, 2, 3],
                              dims=('x', ),
                              coords={'acq_time': ('x', [0, 0, 0])},
                              attrs={
                                  'area': 'myarea',
                                  'wavelength':
                                  WavelengthRange(0.56, 0.635, 0.71),
                                  'start_time': dt.datetime(2009, 7, 1, 0)
                              })
        ir_108 = xr.DataArray(data=[4, 5, 6],
                              dims=('x', ),
                              coords={'acq_time': ('x', [0, 0, 0])},
                              attrs={
                                  'start_time': dt.datetime(2009, 7, 1, 1),
                                  'wavelength':
                                  WavelengthRange(9.8, 10.8, 11.8)
                              })
        scene_dict = {'VIS006': vis006.copy(), 'IR_108': ir_108.copy()}
        scene = mock.MagicMock(attrs={})
        scene.__getitem__.side_effect = scene_dict.__getitem__

        seviri2pps.update_coords(scene)

        self.assertEqual(scene.attrs['area'], 'myarea')
        for band in seviri2pps.BANDNAMES:
            self.assertEqual(scene[band].attrs['coordinates'], 'lon lat')
            np.testing.assert_array_equal(scene[band].coords['acq_time'].data,
                                          [7, 8, 9])

        np.testing.assert_array_equal(scene['VIS006'].data, vis006.data)
        np.testing.assert_array_equal(scene['IR_108'].data, ir_108.data)

        np.testing.assert_array_equal(
            scene['VIS006'].coords['time'].data,
            np.datetime64(dt.datetime(2009, 7, 1, 0)))
        np.testing.assert_array_equal(
            scene['IR_108'].coords['time'].data,
            np.datetime64(dt.datetime(2009, 7, 1, 1)))
コード例 #11
0
def get_fake_scene():
    scene = Scene()
    start_time = dt.datetime(2020, 1, 1, 12)
    scene['VIS006'] = xr.DataArray(
        [[1, 2], [3, 4]],
        dims=('y', 'x'),
        attrs={
            'calibration': 'reflectance',
            'sun_earth_distance_correction_applied': True,
            'start_time': start_time,
            'wavelength': WavelengthRange(0.56, 0.635, 0.71)
        })
    scene['IR_108'] = xr.DataArray(
        [[5, 6], [7, 8]],
        dims=('y', 'x'),
        attrs={
            'calibration': 'brightness_temperature',
            'start_time': start_time,
            'wavelength': WavelengthRange(9.8, 10.8, 11.8)
        })
    scene.attrs['sensor'] = {'seviri'}
    return scene
コード例 #12
0
ファイル: satpy_cf_nc.py プロジェクト: pepephillips/satpy
 def _assign_ds_info(self, var_name, val):
     """Assign ds_info."""
     ds_info = dict(val.attrs)
     ds_info['file_type'] = self.filetype_info['file_type']
     ds_info['name'] = ds_info['nc_store_name'] = var_name
     if 'original_name' in ds_info:
         ds_info['name'] = ds_info['original_name']
     elif self._numeric_name_prefix and var_name.startswith(self._numeric_name_prefix):
         ds_info['name'] = var_name.replace(self._numeric_name_prefix, '')
     try:
         ds_info['wavelength'] = WavelengthRange.from_cf(ds_info['wavelength'])
     except KeyError:
         pass
     return ds_info
コード例 #13
0
ファイル: satpy_cf_nc.py プロジェクト: andyprata/satpy
 def _dynamic_datasets(self):
     """Add information of dynamic datasets."""
     nc = xr.open_dataset(self.filename, engine=self.engine)
     # get dynamic variables known to this file (that we created)
     for var_name, val in nc.data_vars.items():
         ds_info = dict(val.attrs)
         ds_info['file_type'] = self.filetype_info['file_type']
         ds_info['name'] = var_name
         try:
             ds_info['wavelength'] = WavelengthRange.from_cf(
                 ds_info['wavelength'])
         except KeyError:
             pass
         self.fix_modifier_attr(ds_info)
         yield True, ds_info
コード例 #14
0
    def test_mcmip_get_dataset(self, xr_):
        """Test getting channel from MCMIP file."""
        from datetime import datetime

        from pyresample.geometry import AreaDefinition

        from satpy import Scene
        from satpy.dataset.dataid import WavelengthRange
        xr_.open_dataset.return_value = _create_mcmip_dataset()

        fn = "OR_ABI-L2-MCMIPF-M6_G16_s20192600241149_e20192600243534_c20192600245360.nc"
        scn = Scene(reader='abi_l2_nc', filenames=[fn])
        scn.load(['C14'])

        exp_data = np.array([[2 * 0.3052037, np.nan],
                             [32768 * 0.3052037, 32767 * 0.3052037]])

        exp_attrs = {
            'instrument_ID': None,
            'modifiers': (),
            'name': 'C14',
            'orbital_slot': None,
            'reader': 'abi_l2_nc',
            'platform_name': 'GOES-16',
            'platform_shortname': 'G16',
            'production_site': None,
            'satellite_altitude': 35786020.,
            'satellite_latitude': 0.0,
            'satellite_longitude': -89.5,
            'scan_mode': 'M6',
            'scene_id': None,
            'sensor': 'abi',
            'timeline_ID': None,
            'start_time': datetime(2017, 9, 20, 17, 30, 40, 800000),
            'end_time': datetime(2017, 9, 20, 17, 41, 17, 500000),
            'calibration': 'brightness_temperature',
            'ancillary_variables': [],
            'wavelength': WavelengthRange(10.8, 11.2, 11.6, unit='µm'),
            'units': 'm'
        }

        res = scn['C14']
        np.testing.assert_allclose(res.data, exp_data, equal_nan=True)
        assert isinstance(res.attrs['area'], AreaDefinition)
        # don't complicate the comparison below
        for key in ('area', '_satpy_id'):
            del res.attrs[key]
        assert dict(res.attrs) == exp_attrs
コード例 #15
0
ファイル: _crefl_utils.py プロジェクト: mherbertson/satpy
class _MODISCoefficients(_Coefficients):
    # Values from crefl 1.7.1
    LUTS = [
        # aH2O
        np.array([
            -5.60723, -5.25251, 0, 0, -6.29824, -7.70944, -3.91877, 0, 0, 0, 0,
            0, 0, 0, 0, 0
        ]),
        # bH2O
        np.array([
            0.820175, 0.725159, 0, 0, 0.865732, 0.966947, 0.745342, 0, 0, 0, 0,
            0, 0, 0, 0, 0
        ]),
        # aO3
        np.array([
            0.0715289, 0, 0.00743232, 0.089691, 0, 0, 0, 0.001, 0.00383,
            0.0225, 0.0663, 0.0836, 0.0485, 0.0395, 0.0119, 0.00263
        ]),
        # taur0
        np.array([
            0.05100, 0.01631, 0.19325, 0.09536, 0.00366, 0.00123, 0.00043,
            0.3139, 0.2375, 0.1596, 0.1131, 0.0994, 0.0446, 0.0416, 0.0286,
            0.0155
        ]),
    ]
    # Map of pixel resolutions -> wavelength -> coefficient index
    # Map of pixel resolutions -> band name -> coefficient index
    COEFF_INDEX_MAP = {
        1000: {
            WavelengthRange(0.620, 0.6450, 0.670): 0,
            "1": 0,
            WavelengthRange(0.841, 0.8585, 0.876): 1,
            "2": 1,
            WavelengthRange(0.459, 0.4690, 0.479): 2,
            "3": 2,
            WavelengthRange(0.545, 0.5550, 0.565): 3,
            "4": 3,
            WavelengthRange(1.230, 1.2400, 1.250): 4,
            "5": 4,
            WavelengthRange(1.628, 1.6400, 1.652): 5,
            "6": 5,
            WavelengthRange(2.105, 2.1300, 2.155): 6,
            "7": 6,
        }
    }
    COEFF_INDEX_MAP[500] = COEFF_INDEX_MAP[1000]
    COEFF_INDEX_MAP[250] = COEFF_INDEX_MAP[1000]
コード例 #16
0
ファイル: test_satpy_cf_nc.py プロジェクト: andyprata/satpy
    def setUp(self):
        """Create a test scene."""
        tstart = datetime(2019, 4, 1, 12, 0)
        tend = datetime(2019, 4, 1, 12, 15)
        data_visir = [[1, 2], [3, 4]]
        y_visir = [1, 2]
        x_visir = [1, 2]
        z_visir = [1, 2, 3, 4, 5, 6, 7]
        qual_data = [[1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 5, 6, 7]]
        time_vis006 = [1, 2]
        lat = 33.0 * np.array([[1, 2], [3, 4]])
        lon = -13.0 * np.array([[1, 2], [3, 4]])
        common_attrs = {
            'start_time': tstart,
            'end_time': tend,
            'platform_name': 'tirosn',
            'orbit_number': 99999
        }
        vis006 = xr.DataArray(data_visir,
                              dims=('y', 'x'),
                              coords={
                                  'y': y_visir,
                                  'x': x_visir,
                                  'acq_time': ('y', time_vis006)
                              },
                              attrs={
                                  'name':
                                  'image0',
                                  'id_tag':
                                  'ch_r06',
                                  'coordinates':
                                  'lat lon',
                                  'resolution':
                                  1000,
                                  'calibration':
                                  'reflectance',
                                  'wavelength':
                                  WavelengthRange(min=0.58,
                                                  central=0.63,
                                                  max=0.68,
                                                  unit='µm')
                              })

        ir_108 = xr.DataArray(data_visir,
                              dims=('y', 'x'),
                              coords={
                                  'y': y_visir,
                                  'x': x_visir,
                                  'acq_time': ('y', time_vis006)
                              },
                              attrs={
                                  'name': 'image1',
                                  'id_tag': 'ch_tb11',
                                  'coordinates': 'lat lon'
                              })
        qual_f = xr.DataArray(qual_data,
                              dims=('y', 'z'),
                              coords={
                                  'y': y_visir,
                                  'z': z_visir,
                                  'acq_time': ('y', time_vis006)
                              },
                              attrs={
                                  'name': 'qual_flags',
                                  'id_tag': 'qual_flags'
                              })
        lat = xr.DataArray(lat,
                           dims=('y', 'x'),
                           coords={
                               'y': y_visir,
                               'x': x_visir
                           },
                           attrs={
                               'name': 'lat',
                               'standard_name': 'latitude',
                               'modifiers': np.array([])
                           })
        lon = xr.DataArray(lon,
                           dims=('y', 'x'),
                           coords={
                               'y': y_visir,
                               'x': x_visir
                           },
                           attrs={
                               'name': 'lon',
                               'standard_name': 'longitude',
                               'modifiers': np.array([])
                           })
        self.scene = Scene()
        self.scene.attrs['sensor'] = ['avhrr-1', 'avhrr-2', 'avhrr-3']
        scene_dict = {
            'image0': vis006,
            'image1': ir_108,
            'lat': lat,
            'lon': lon,
            'qual_flags': qual_f
        }
        for key in scene_dict:
            self.scene[key] = scene_dict[key]
            self.scene[key].attrs.update(common_attrs)