Esempio n. 1
0
 def test_pqa_translate_path(self):
     input_folder = write_files({
         'pqa.tif': '',
         'process.log': '',
         'passinfo': ''
     })
     self.assertEqual(
         input_folder.joinpath('LS8_OLITIRS_PQ_P55_GAPQ01-032_101_078_20141012.tif'),
         drivers.PqaDriver().translate_path(
             _EXPECTED_PQA,
             input_folder.joinpath('pqa.tif')
         )
     )
     # Other files unchanged.
     self.assertEqual(
         input_folder.joinpath('process.log'),
         drivers.PqaDriver().translate_path(
             _EXPECTED_PQA,
             input_folder.joinpath('process.log')
         )
     )
     self.assertEqual(
         input_folder.joinpath('passinfo'),
         drivers.PqaDriver().translate_path(
             _EXPECTED_PQA,
             input_folder.joinpath('passinfo')
         )
     )
Esempio n. 2
0
    def test_pqa_defaults(self):
        # A one-band browse image.
        self.assertEqual(drivers.PqaDriver().browse_image_bands(_EXPECTED_PQA), ('pqa',))

        self.assertEqual('pqa', drivers.PqaDriver().get_id())

        sources = (drivers.OrthoDriver(), drivers.NbarDriver('brdf'))
        expected = drivers.PqaDriver().expected_source()

        # odd that set(sources).issubset(expected) returns False
        self.assertTrue(all([i in expected for i in sources]))
Esempio n. 3
0
    def test_pqa_to_band(self):
        input_folder = write_files({
            'pqa.tif': '',
            'process.log': '',
            'passinfo': '',
        })

        # Creates a single band.
        self.assertEqual(
            ptype.BandMetadata(path=input_folder.joinpath('pqa.tif'), number='pqa'),
            drivers.PqaDriver().to_band(None, input_folder.joinpath('pqa.tif'))
        )

        # Other files should not be bands.
        self.assertIsNone(drivers.PqaDriver().to_band(None, input_folder.joinpath('process.log')))
        self.assertIsNone(drivers.PqaDriver().to_band(None, input_folder.joinpath('passinfo')))
Esempio n. 4
0
    def test_pqa_fill(self):
        input_folder = write_files({
            'pqa.tif': '',
            'pq_metadata.yaml': dedent(
                """
                    algorithm_information:
                        software_version: 1.0
                        pq_doi:
                    ancillary: {}
                    tests_run: {}
                """)
        })

        dataset = ptype.DatasetMetadata(
            id_=_EXPECTED_PQA.id_,
            lineage=ptype.LineageMetadata(
                source_datasets={
                    'nbar': _EXPECTED_NBAR,
                    'level1': test_ls8.EXPECTED_OUT
                }
            )
        )

        received_dataset = drivers.PqaDriver().fill_metadata(dataset, input_folder)

        self.assert_same(_EXPECTED_PQA, received_dataset)
Esempio n. 5
0
 def test_pqa_label(self):
     self.assertEqual(
         "LS8_OLITIRS_PQ_P55_GAPQ01-032_101_078_20141012",
         drivers.PqaDriver().get_ga_label(_EXPECTED_PQA)
     )