improver.synthetic_data.generate_metadata module
Module to generate a metadata cube.
- _create_data_array(ensemble_members, leading_dimension, npoints, height_levels)[source]
Create data array of specified shape filled with zeros
- Return type:
- _create_time_bounds(time, time_period)[source]
Create time bounds using time - time_period as the lower bound and time as the upper bound
- generate_metadata(mandatory_attributes, name='air_pressure_at_sea_level', units=None, time_period=None, ensemble_members=8, leading_dimension=None, cube_type='variable', spp__relative_to_threshold='greater_than', npoints=71, **kwargs)[source]
Generate a cube with metadata only.
- Parameters:
mandatory_attributes (
dict
) – Specifies the values of the mandatory attributes, title, institution and source.name (
str
) – Output variable name, or if creating a probability cube the name of the underlying variable to which the probability field applies.units (
Optional
[str
]) – Output variable units, or if creating a probability cube the units of the underlying variable / threshold.time_period (
Optional
[int
]) – The period in minutes between the time bounds. This is used to calculate the lower time bound. If unset the diagnostic will be instantaneous, i.e. without time bounds.ensemble_members (
int
) – Number of ensemble members. Default 8, unless percentile or probability set to True.leading_dimension (
Optional
[List
[float
]]) – List of realizations, percentiles or thresholds.cube_type (
str
) – The type of cube to be generated. Permitted values are “variable”, “percentile” or “probability”.spp__relative_to_threshold (
str
) – Value of the attribute “spp__relative_to_threshold” which is required for IMPROVER probability cubes.npoints (
int
) – Number of points along each of the y and x spatial axes.**kwargs (
Any
) – Additional keyword arguments to pass to the required cube setup function.
- Raises:
ValueError – If any options are not supported
KeyError – If mandatory_attributes does not contain all the required keys
- Return type:
- Returns:
Output of set_up_variable_cube(), set_up_percentile_cube() or set_up_probability_cube()