Esempio n. 1
0
class Test_as_cartopy_crs(tests.IrisTest):
    def setUp(self):
        self.latitude_of_projection_origin = 0.0
        self.longitude_of_central_meridian = 0.0
        self.semi_major_axis = 6377563.396
        self.semi_minor_axis = 6356256.909
        self.false_easting = 0.0
        self.false_northing = 0.0
        self.standard_parallels = (-18., -36.)
        self.ellipsoid = GeogCS(self.semi_major_axis, self.semi_minor_axis)
        self.aea_cs = AlbersEqualArea(self.latitude_of_projection_origin,
                                      self.longitude_of_central_meridian,
                                      self.false_easting,
                                      self.false_northing,
                                      self.standard_parallels,
                                      ellipsoid=self.ellipsoid)

    def test_crs_creation(self):
        res = self.aea_cs.as_cartopy_crs()
        globe = ccrs.Globe(semimajor_axis=self.semi_major_axis,
                           semiminor_axis=self.semi_minor_axis,
                           ellipse=None)
        expected = ccrs.AlbersEqualArea(self.longitude_of_central_meridian,
                                        self.latitude_of_projection_origin,
                                        self.false_easting,
                                        self.false_northing,
                                        self.standard_parallels,
                                        globe=globe)
        self.assertEqual(res, expected)
Esempio n. 2
0
class Test_as_cartopy_crs(tests.IrisTest):
    def setUp(self):
        self.latitude_of_projection_origin = 0.0
        self.longitude_of_central_meridian = 0.0
        self.semi_major_axis = 6377563.396
        self.semi_minor_axis = 6356256.909
        self.false_easting = 0.0
        self.false_northing = 0.0
        self.standard_parallels = (-18., -36.)
        self.ellipsoid = GeogCS(self.semi_major_axis, self.semi_minor_axis)
        self.aea_cs = AlbersEqualArea(
            self.latitude_of_projection_origin,
            self.longitude_of_central_meridian,
            self.false_easting,
            self.false_northing,
            self.standard_parallels,
            ellipsoid=self.ellipsoid)

    def test_crs_creation(self):
        res = self.aea_cs.as_cartopy_crs()
        globe = ccrs.Globe(semimajor_axis=self.semi_major_axis,
                           semiminor_axis=self.semi_minor_axis,
                           ellipse=None)
        expected = ccrs.AlbersEqualArea(
            self.longitude_of_central_meridian,
            self.latitude_of_projection_origin,
            self.false_easting,
            self.false_northing,
            self.standard_parallels,
            globe=globe)
        self.assertEqual(res, expected)
Esempio n. 3
0
class Test_as_cartopy_crs(tests.IrisTest):
    def setUp(self):
        self.latitude_of_projection_origin = 0.0
        self.longitude_of_central_meridian = 0.0
        self.semi_major_axis = 6377563.396
        self.semi_minor_axis = 6356256.909
        self.false_easting = 0.0
        self.false_northing = 0.0
        self.standard_parallels = (-18.0, -36.0)
        self.ellipsoid = GeogCS(self.semi_major_axis, self.semi_minor_axis)
        self.aea_cs = AlbersEqualArea(
            self.latitude_of_projection_origin,
            self.longitude_of_central_meridian,
            self.false_easting,
            self.false_northing,
            self.standard_parallels,
            ellipsoid=self.ellipsoid,
        )

    def test_crs_creation(self):
        res = self.aea_cs.as_cartopy_crs()
        globe = ccrs.Globe(
            semimajor_axis=self.semi_major_axis,
            semiminor_axis=self.semi_minor_axis,
            ellipse=None,
        )
        expected = ccrs.AlbersEqualArea(
            self.longitude_of_central_meridian,
            self.latitude_of_projection_origin,
            self.false_easting,
            self.false_northing,
            self.standard_parallels,
            globe=globe,
        )
        self.assertEqual(res, expected)

    def test_fail_too_few_parallels(self):
        emsg = "parallels"
        with self.assertRaisesRegex(ValueError, emsg):
            AlbersEqualArea(standard_parallels=())

    def test_fail_too_many_parallels(self):
        emsg = "parallels"
        with self.assertRaisesRegex(ValueError, emsg):
            AlbersEqualArea(standard_parallels=(1, 2, 3))