improver.cli.weather_symbol_modes module#
CLI to generate modal categories over periods.
- process(*cubes, decision_tree=None, broad_categories=None, wet_categories=None, intensity_categories=None, day_weighting=1, day_start=6, day_end=18, wet_bias=1, model_id_attr=None, record_run_attr=None)[source]#
Generates a modal weather code for the period covered by the input categorical cubes. Where there are different categories available for night and day, the modal code returned is always a day code, regardless of the times covered by the input files. The weather codes provided are expected to end at midnight and therefore represent either a full day or a partial day.
- Parameters:
cubes (iris.cube.CubeList) – A cubelist containing categorical cubes that cover the period over which a modal category is desired.
decision_tree (dict) – A JSON file containing a decision tree definition.
broad_categories (dict) – A JSON file containing a definition for a broad category grouping. The expected categories are wet and dry.
wet_categories (dict) – A JSON file containing a definition for a wet category grouping. No specific names for the keys are required. Key and values within the dictionary should both be ordered in terms of descending priority.
intensity_categories (dict) – A JSON file containing a definition for an intensity category grouping. Values should be ordered in terms of descending priority. The most common weather code from the options available representing different intensities will be used as the representative weather code.
day_weighting (
int) – Weighting to provide day time weather codes. A weighting of 1 indicates the default weighting. A weighting of 2 indicates that the weather codes during the day time period will be duplicated, so that they count twice as much when computing a representative weather code.day_start (
int) – Hour defining the start of the daytime period.day_end (
int) – Hour defining the end of the daytime period.wet_bias (
int) – Bias to provide wet weather codes. A bias of 1 indicates the default, where half of the codes need to be a wet code, in order to generate a wet code. A bias of 3 indicates that only a quarter of codes are required to be wet, in order to generate a wet symbol. To generate a wet symbol, the fraction of wet symbols therefore need to be greater than or equal to 1 / (1 + wet_bias).model_id_attr (str) – Name of attribute recording source models that should be inherited by the output cube. The source models are expected as a space-separated string.
record_run_attr (
str) – Name of attribute used to record models and cycles used in constructing the categorical data.
- Returns:
A cube of modal weather codes over a period.
- Return type: