Exemplo n.º 1
0
 def test_single_point_lat_long(self):
     """Test behaviour for a single grid cell on lat long grid."""
     cube = set_up_cube_lat_long()
     msg = "Invalid grid: projection_x/y coords required"
     radius = 6000.
     with self.assertRaisesRegex(ValueError, msg):
         GeneratePercentilesFromACircularNeighbourhood().run(cube, radius)
Exemplo n.º 2
0
 def test_single_point_lat_long(self):
     """Test behaviour for a single grid cell on lat long grid."""
     cube = set_up_cube_lat_long()
     msg = "Invalid grid: projection_x/y coords required"
     with self.assertRaisesRegexp(ValueError, msg):
         convert_distance_into_number_of_grid_cells(
             cube, self.DISTANCE, self.MAX_DISTANCE_IN_GRID_CELLS)
Exemplo n.º 3
0
 def test_wrong_coordinate(self):
     """Test an exception is raised if the x and y coordinates are not
     projection_x_coordinate or projection_y_coordinate."""
     cube = set_up_cube_lat_long()
     msg = "Invalid grid"
     with self.assertRaisesRegexp(ValueError, msg):
         check_if_grid_is_equal_area(cube)
 def test_single_point_lat_long(self):
     """Test behaviour for a single grid cell on lat long grid."""
     cube = set_up_cube_lat_long()
     msg = "Unable to convert from"
     radius = 6000.
     with self.assertRaisesRegex(ValueError, msg):
         GeneratePercentilesFromACircularNeighbourhood().run(cube, radius)
 def setUp(self):
     """Set up the cube for testing."""
     cube = set_up_cube_lat_long()
     lon_points = np.linspace(-8, 7, 16)
     lat_points = np.linspace(49, 64, 16)
     cube.coord('latitude').points = lat_points
     cube.coord('longitude').points = lon_points
     self.mask_cube = DayNightMask()._create_daynight_mask(cube)[0]
 def setUp(self):
     """Set up the cubes for testing."""
     self.cube = set_up_cube()
     x_points = np.linspace(-30000, 0, 16)
     self.cube.coord('projection_x_coordinate').points = x_points
     dtval = self.cube.coord('time').points[0]
     self.cube.coord('time').points = np.array(dtval + 7.5 + 24.0)
     # Lat lon cube
     self.cube_lat_lon = set_up_cube_lat_long()
     lon_points = np.linspace(-8, 7, 16)
     lat_points = np.linspace(49, 64, 16)
     self.cube_lat_lon.coord('latitude').points = lat_points
     self.cube_lat_lon.coord('longitude').points = lon_points
     dt = self.cube_lat_lon.coord('time').points[0]
     self.cube_lat_lon.coord('time').points[0] = dt + 7.5 + 24.0