Ejemplo n.º 1
0
 def test_spherical_default_supported(self):
     cs_by_shape = {
         0: icoord_systems.GeogCS(6367470),
         6: icoord_systems.GeogCS(6371229)
     }
     for shape, expected in cs_by_shape.items():
         result = ellipsoid(shape, MDI, MDI, MDI)
         self.assertEqual(result, expected)
Ejemplo n.º 2
0
 def test_oblate_shape_3_7(self):
     for shape in [3, 7]:
         major, minor = 1, 10
         scale = 1
         result = ellipsoid(shape, major, minor, MDI)
         if shape == 3:
             # Convert km to m.
             scale = 1000
         expected = icoord_systems.GeogCS(major * scale, minor * scale)
         self.assertEqual(result, expected)
Ejemplo n.º 3
0
 def test_oblate_shape_3_7(self):
     for shape in [3, 7]:
         major, minor = 1, 10
         scale = 1
         result = ellipsoid(shape, major, minor, MDI)
         if shape == 3:
             # Convert km to m.
             scale = 1000
         expected = icoord_systems.GeogCS(major * scale, minor * scale)
         self.assertEqual(result, expected)
Ejemplo n.º 4
0
 def test_oblate_shape_3_7_no_minor(self):
     for shape in [3, 7]:
         emsg = 'minor axis to be specified'
         with self.assertRaisesRegexp(ValueError, emsg):
             ellipsoid(shape, 1, MDI, MDI)
Ejemplo n.º 5
0
 def test_spherical_shape_1(self):
     shape = 1
     radius = 10
     result = ellipsoid(shape, MDI, MDI, radius)
     expected = icoord_systems.GeogCS(radius)
     self.assertEqual(result, expected)
Ejemplo n.º 6
0
 def test_spherical_shape_1_no_radius(self):
     shape = 1
     emsg = 'radius to be specified'
     with self.assertRaisesRegexp(ValueError, emsg):
         ellipsoid(shape, MDI, MDI, MDI)
Ejemplo n.º 7
0
 def test_spherical_default_supported(self):
     cs_by_shape = {0: icoord_systems.GeogCS(6367470),
                    6: icoord_systems.GeogCS(6371229)}
     for shape, expected in cs_by_shape.items():
         result = ellipsoid(shape, MDI, MDI, MDI)
         self.assertEqual(result, expected)
Ejemplo n.º 8
0
 def test_shape_unsupported(self):
     unsupported = [2, 4, 5, 8, 9, 10, MDI]
     emsg = 'unsupported shape of the earth'
     for shape in unsupported:
         with self.assertRaisesRegexp(TranslationError, emsg):
             ellipsoid(shape, MDI, MDI, MDI)
Ejemplo n.º 9
0
 def test_oblate_shape_3_7_no_minor(self):
     for shape in [3, 7]:
         emsg = 'minor axis to be specified'
         with self.assertRaisesRegexp(ValueError, emsg):
             ellipsoid(shape, 1, MDI, MDI)
Ejemplo n.º 10
0
 def test_spherical_shape_1(self):
     shape = 1
     radius = 10
     result = ellipsoid(shape, MDI, MDI, radius)
     expected = icoord_systems.GeogCS(radius)
     self.assertEqual(result, expected)
Ejemplo n.º 11
0
 def test_spherical_shape_1_no_radius(self):
     shape = 1
     emsg = 'radius to be specified'
     with self.assertRaisesRegexp(ValueError, emsg):
         ellipsoid(shape, MDI, MDI, MDI)
Ejemplo n.º 12
0
 def test_shape_unsupported(self):
     unsupported = [8, 9, 10, MDI]
     emsg = 'unsupported shape of the earth'
     for shape in unsupported:
         with self.assertRaisesRegexp(TranslationError, emsg):
             ellipsoid(shape, MDI, MDI, MDI)