Beispiel #1
0
    def test_available_datasets_miss_3a(self):
        """Test that channel 3a is missing from available datasets."""
        with tempfile.TemporaryFile() as tmpfile:
            self._header.tofile(tmpfile)
            tmpfile.seek(22016, 0)
            self._data.tofile(tmpfile)

            fh = AVHRRAAPPL1BFile(tmpfile, self.filename_info,
                                  self.filetype_info)
            configured_datasets = [
                [None, {
                    'name': '1'
                }],
                [None, {
                    'name': '2'
                }],
                [None, {
                    'name': '3a'
                }],
                [None, {
                    'name': '3b'
                }],
                [None, {
                    'name': '4'
                }],
                [None, {
                    'name': '5'
                }],
            ]
            available_datasets = fh.available_datasets(configured_datasets)
            for status, mda in available_datasets:
                if mda['name'] == '3a':
                    assert status is False
                else:
                    assert status is True
Beispiel #2
0
    def test_read(self):
        """Test the reading."""
        with tempfile.TemporaryFile() as tmpfile:
            self._header.tofile(tmpfile)
            tmpfile.seek(22016, 0)
            self._data.tofile(tmpfile)

            fh = AVHRRAAPPL1BFile(tmpfile, self.filename_info, self.filetype_info)
            info = {}
            mins = []
            maxs = []
            for name in ['1', '2', '3a']:
                key = make_dataid(name=name, calibration='reflectance')
                res = fh.get_dataset(key, info)
                assert(res.min() == 0)
                assert(res.max() >= 100)
                mins.append(res.min().values)
                maxs.append(res.max().values)
                if name == '3a':
                    assert(np.all(np.isnan(res[:2, :])))

            for name in ['3b', '4', '5']:
                key = make_dataid(name=name, calibration='reflectance')
                res = fh.get_dataset(key, info)
                mins.append(res.min().values)
                maxs.append(res.max().values)
                if name == '3b':
                    assert(np.all(np.isnan(res[2:, :])))

            np.testing.assert_allclose(mins, [0., 0., 0., 204.10106939, 103.23477235, 106.42609758])
            np.testing.assert_allclose(maxs, [108.40391775, 107.68545158, 106.80061233,
                                              337.71416096, 355.15898219, 350.87182166])
Beispiel #3
0
 def test_bright_channel2_has_reflectance_greater_than_100(self):
     """Test that a bright channel 2 has reflectances greater that 100."""
     from satpy.readers.aapp_l1b import AVHRRAAPPL1BFile
     from satpy.tests.utils import make_dataid
     file_handler = AVHRRAAPPL1BFile(self.filename, dict(), None)
     data = file_handler.get_dataset(make_dataid(name='2', calibration='reflectance'), dict())
     np.testing.assert_array_less(100, data.values)
Beispiel #4
0
    def test_loading_missing_channels_returns_none(self):
        """Test that loading a missing channel raises a keyerror."""
        with tempfile.TemporaryFile() as tmpfile:
            self._header.tofile(tmpfile)
            tmpfile.seek(22016, 0)
            self._data.tofile(tmpfile)

            fh = AVHRRAAPPL1BFile(tmpfile, self.filename_info, self.filetype_info)
            info = {}
            key = make_dataid(name='3a', calibration='reflectance')
            assert fh.get_dataset(key, info) is None
Beispiel #5
0
    def test_angles(self):
        """Test reading the angles."""
        with tempfile.TemporaryFile() as tmpfile:
            self._header.tofile(tmpfile)
            tmpfile.seek(22016, 0)
            self._data.tofile(tmpfile)

            fh = AVHRRAAPPL1BFile(tmpfile, self.filename_info, self.filetype_info)
            info = {}
            key = make_dataid(name='solar_zenith_angle')
            res = fh.get_dataset(key, info)
            assert(np.all(res == 0))
Beispiel #6
0
    def test_navigation(self):
        """Test reading the lon and lats."""
        with tempfile.TemporaryFile() as tmpfile:
            self._header.tofile(tmpfile)
            tmpfile.seek(22016, 0)
            self._data.tofile(tmpfile)

            fh = AVHRRAAPPL1BFile(tmpfile, self.filename_info, self.filetype_info)
            info = {}
            key = make_dataid(name='longitude')
            res = fh.get_dataset(key, info)
            assert(np.all(res == 0))
            key = make_dataid(name='latitude')
            res = fh.get_dataset(key, info)
            assert(np.all(res == 0))