improver.utilities.cube_checker module
Provides support utilities for checking cubes.
- assert_spatial_coords_match(cubes)[source]
Raises an Exception if spatial_coords_match returns False.
- assert_time_coords_valid(inputs, time_bounds)[source]
Raises appropriate ValueError if
Any input cube has or is missing time bounds (depending on time_bounds)
Input cube times do not match
Input cube forecast_reference_times do not match (unless blend_time is present)
Note that blend_time coordinates do not have to match as it is likely that data from nearby blends will be used together.
- Parameters:
- Raises:
ValueError – If any of the stated checks fail.
- check_cube_coordinates(cube, new_cube, exception_coordinates=None)[source]
Find and promote to dimension coordinates any scalar coordinates in new_cube that were originally dimension coordinates in the progenitor cube. If coordinate is in new_cube that is not in the old cube, keep coordinate in its current position.
- Parameters:
cube (
Cube
) – The input cube that will be checked to identify the preferred coordinate order for the output cube.new_cube (
Cube
) – The cube that must be checked and adjusted using the coordinate order from the original cube.exception_coordinates (
Optional
[List
[str
]]) – The names of the coordinates that are permitted to be within the new_cube but are not available within the original cube.
- Return type:
- Returns:
Modified cube with relevant scalar coordinates promoted to dimension coordinates with the dimension coordinates re-ordered, as best as can be done based on the original cube.
- Raises:
CoordinateNotFoundError – Raised if the final dimension coordinates of the returned cube do not match the input cube.
CoordinateNotFoundError – If a coordinate is within in the permitted exceptions but is not in the new_cube.
- check_for_x_and_y_axes(cube, require_dim_coords=False)[source]
Check whether the cube has an x and y axis, otherwise raise an error.
- Parameters:
- Raises:
ValueError – Raise an error if non-uniform increments exist between grid points.
- Return type:
- find_dimension_coordinate_mismatch(first_cube, second_cube, two_way_mismatch=True)[source]
Determine if there is a mismatch between the dimension coordinates in two cubes.
- Parameters:
- Return type:
- Returns:
List of the dimension coordinates that are only present in one out of the two cubes.