improver.developer_tools.metadata_interpreter module
Module containing classes for metadata interpretation
- CATEGORICAL_MODE_CM(hour)
- class MOMetadataInterpreter[source]
Bases:
object
Class to interpret an iris cube according to the Met Office specific IMPROVER standard. This is intended as a debugging tool to aid developers in adding and modifying metadata within the code base.
- ANCIL = 'ancillary'
- DIAG = 'realizations'
- PERC = 'percentiles'
- PROB = 'probabilities'
- __init__()[source]
Initialise class parameters, which store information about a cube to be parsed into a human-readable string by the
display_interpretation()
function.
- _check_blend_and_model_attributes(attrs)[source]
Interprets attributes for model and blending information and checks for self-consistency
- Return type:
- _check_coord_bounds(cube, coord)[source]
If coordinate has bounds, check points are equal to upper bound
- Return type:
- _check_coords_are_horizontal(cube, coords)[source]
Checks that all the mentioned coords share the same dimensions as the x and y coords
- Return type:
- _check_coords_present(coords, expected_coords)[source]
Check whether all expected coordinates are present
- Return type:
- check_attributes(attrs)[source]
Checks for unexpected attributes, then interprets values for model information and checks for self-consistency
- Return type:
- check_threshold_coordinate_properties(cube_name, threshold_coord)[source]
Checks threshold coordinate properties are correct and consistent with cube name
- Return type:
- run(cube)[source]
Populates self-consistent interpreted parameters, or raises collated errors describing (as far as posible) how the metadata are a) not self-consistent, and / or b) not consistent with the Met Office IMPROVER standard.
Although every effort has been made to return as much information as possible, collated errors may not be complete if the issue is fundamental. The developer is advised to rerun this tool after each fix, until no further problems are raised.
- Return type:
- _format_standard_cases(interpreter, verbose, vstring)[source]
Format prob / perc / diagnostic information from a MOMetadataInterpreter instance
- display_interpretation(interpreter, verbose=False)[source]
Prints metadata interpretation in human-readable form. This should not be run on a MOMetadataInterpreter instance that has raised errors.
- Parameters:
interpreter (
MOMetadataInterpreter
) – Populated instance of MOMetadataInterpreterverbose (
bool
) – Optional flag to include information about the source of the metadata interpretation (eg name, coordinates, attributes, etc)
- Return type:
- Returns:
Formatted string describing metadata in human-readable form