Beispiel #1
0
 def test_no_y_dimension_coordinate(self):
     """Test that a cube is created with the expected y and x coordinates
     within the output cube, if the input cube only has a
     projection_y_coordinate dimension coordinate."""
     sliced_cube = next(self.cube.slices(["projection_x_coordinate"]))
     data = sliced_cube.data
     coord_x = sliced_cube.coord("projection_x_coordinate")
     coord_y = sliced_cube.coord("projection_y_coordinate")
     new_cube = _create_cube_with_padded_data(sliced_cube, data, coord_x, coord_y)
     self.assertIsInstance(new_cube, iris.cube.Cube)
     self.assertArrayAlmostEqual(new_cube.data, data)
     self.assertEqual(new_cube.coord_dims("projection_x_coordinate")[0], 0)
     self.assertTrue(new_cube.coords("projection_y_coordinate", dim_coords=False))
Beispiel #2
0
    def test_xy_order(self):
        """Test that a cube is created with the expected order for the y and x
        coordinates within the output cube, if the input cube has dimensions
        of projection_x_coordinate and projection_y_coordinate."""
        sliced_cube = next(
            self.cube.slices(["projection_x_coordinate", "projection_y_coordinate"])
        )
        data = sliced_cube.data
        coord_x = sliced_cube.coord("projection_x_coordinate")
        coord_y = sliced_cube.coord("projection_y_coordinate")

        new_cube = _create_cube_with_padded_data(sliced_cube, data, coord_x, coord_y)
        self.assertIsInstance(new_cube, iris.cube.Cube)
        self.assertArrayAlmostEqual(new_cube.data, data)
        self.assertEqual(new_cube.coord_dims("projection_y_coordinate")[0], 1)
        self.assertEqual(new_cube.coord_dims("projection_x_coordinate")[0], 0)