def test_geog_cs_circular(self): cube = stock.global_pp() assert cube.coord('longitude').circular result = _xy_range(cube) np.testing.assert_array_almost_equal(result, ((0, 360), (-90, 90)), decimal=0)
def test_geog_cs_circular(self): cube = stock.global_pp() assert cube.coord('longitude').circular result = _xy_range(cube) np.testing.assert_array_almost_equal( result, ((0, 360), (-90, 90)), decimal=0)
def test_geog_cs_regional(self): cube = stock.global_pp() cube = cube[10:20, 20:30] assert not cube.coord('longitude').circular result = _xy_range(cube) np.testing.assert_array_almost_equal( result, ((75, 108.75), (42.5, 65)), decimal=0)
def test_geog_cs_regional(self): cube = stock.global_pp() cube = cube[10:20, 20:30] assert not cube.coord("longitude").circular result = _xy_range(cube) np.testing.assert_array_almost_equal( result, ((75, 108.75), (42.5, 65)), decimal=0 )
def default_projection_extent(cube, mode=iris.coords.POINT_MODE): """ Return the cube's extents ``(x0, x1, y0, y1)`` in its default projection. Keyword arguments: * mode - Either ``iris.coords.POINT_MODE`` or ``iris.coords.BOUND_MODE``. Triggers whether the extent should be representative of the cell points, or the limits of the cell's bounds. The default is iris.coords.POINT_MODE. """ extents = cartography._xy_range(cube, mode) xlim = extents[0] ylim = extents[1] return tuple(xlim) + tuple(ylim)
def test_non_circular(self): cube = stock.realistic_3d() assert not cube.coord("grid_longitude").circular result_non_circ = _xy_range(cube) self.assertEqual(result_non_circ, ((-5.0, 5.0), (-4.0, 4.0)))
def test_bounds_mismatch(self): cube = stock.realistic_3d() cube.coord("grid_longitude").guess_bounds() with self.assertRaisesRegex(ValueError, "bounds"): _ = _xy_range(cube)
def test_bounds_mismatch(self): cube = stock.realistic_3d() cube.coord('grid_longitude').guess_bounds() with self.assertRaisesRegex(ValueError, 'bounds'): result_non_circ = _xy_range(cube)
def test_non_circular(self): cube = stock.realistic_3d() assert not cube.coord('grid_longitude').circular result_non_circ = _xy_range(cube) self.assertEqual(result_non_circ, ((-5.0, 5.0), (-4.0, 4.0)))
def test_bounds_mismatch(self): cube = stock.realistic_3d() cube.coord('grid_longitude').guess_bounds() with self.assertRaisesRegexp(ValueError, 'bounds'): result_non_circ = _xy_range(cube)