improver.wxcode.utilities module

This module defines the utilities required for wxcode plugin

improver.wxcode.utilities.add_wxcode_metadata(cube)[source]

Add weather code metadata to a cube :param cube: Cube which needs weather code metadata added. :type cube: iris.cube.Cube

Returns

Cube with weather code metadata added.

Return type

iris.cube.Cube

improver.wxcode.utilities.expand_nested_lists(query, key)[source]

Produce flat lists from list and nested lists.

Parameters
  • query (dict) – A single query from the decision tree.

  • key (str) – A string denoting the field to be taken from the dict.

Returns

A 1D list containing all the values for a given key.

Return type

list

improver.wxcode.utilities.interrogate_decision_tree(wxtree)[source]

Obtain a list of necessary inputs from the decision tree as it is currently defined. Return a formatted string that contains the diagnostic names, the thresholds needed, and whether they are thresholded above or below these values. This output is used to create the CLI help, informing the user of the necessary inputs.

Parameters

wxtree (str) – The weather symbol tree that is to be interrogated.

Returns

Returns a formatted string descring the diagnostics required, including threshold details.

Return type

list of str

improver.wxcode.utilities.update_daynight(cubewx)[source]

Update weather cube depending on whether it is day or night

Parameters

cubewx (iris.cube.Cube) – Cube containing only daytime weather symbols.

Returns

Cube containing day and night weather symbols

Return type

iris.cube.Cube

Raises

CoordinateNotFoundError – cube must have time coordinate.