Пример #1
0
 def test_migrates_added_extension(self) -> None:
     item = pystac.Item.from_file(
         TestCases.get_path("data-files/examples/0.8.1/item-spec/"
                            "examples/planet-sample.json"))
     self.assertTrue(ViewExtension.has_extension(item))
     view_ext = ViewExtension.ext(item)
     self.assertEqual(view_ext.sun_azimuth, 101.8)
     self.assertEqual(view_ext.sun_elevation, 58.8)
     self.assertEqual(view_ext.off_nadir, 1)
Пример #2
0
    def test_apply(self) -> None:
        item = next(iter(TestCases.test_case_2().get_all_items()))
        self.assertFalse(ViewExtension.has_extension(item))

        ViewExtension.add_to(item)
        ViewExtension.ext(item).apply(
            off_nadir=1.0,
            incidence_angle=2.0,
            azimuth=3.0,
            sun_azimuth=4.0,
            sun_elevation=5.0,
        )

        self.assertEqual(ViewExtension.ext(item).off_nadir, 1.0)
        self.assertEqual(ViewExtension.ext(item).incidence_angle, 2.0)
        self.assertEqual(ViewExtension.ext(item).azimuth, 3.0)
        self.assertEqual(ViewExtension.ext(item).sun_azimuth, 4.0)
        self.assertEqual(ViewExtension.ext(item).sun_elevation, 5.0)
Пример #3
0
 def test_validate_view(self) -> None:
     item = pystac.Item.from_file(self.example_uri)
     self.assertTrue(ViewExtension.has_extension(item))
     item.validate()