improver.percentile module#

Module containing percentiling classes.

class PercentileConverter(collapse_coord, percentiles=None, retained_coordinates=None, fast_percentile_method=True)[source]#

Bases: BasePlugin

Plugin for converting from a set of values to a PDF.

Generate percentiles together with min, max, mean, stdev.

__init__(collapse_coord, percentiles=None, retained_coordinates=None, fast_percentile_method=True)[source]#

Create a PDF plugin with a given source plugin.

Parameters:
  • collapse_coord (Union[str, List[str]]) – The name of the coordinate(s) to collapse over. This coordinate(s) will no longer be present on the output cube, as it will have been replaced by the percentile coordinate.

  • percentiles (Optional[List[float]]) – Percentile values at which to calculate; if not provided uses DEFAULT_PERCENTILES. (optional)

  • retained_coordinates (Union[str, List[str], None]) – Optional list of collapsed coordinates that should be retained in their new scalar form. The default behaviour is to remove the scalar coordinates that result from coordinate collapse.

  • fast_percentile_method (bool) – If True use the numpy percentile method within Iris, which is much faster than scipy, but cannot handle masked data.

Raises:

TypeError – If collapse_coord is not a string.

_abc_impl = <_abc._abc_data object>#
process(cube)[source]#

Create a cube containing the percentiles as a new dimension.

What’s generated by default is:
  • 15 percentiles - (0%, 5%, 10%, 20%, 25%, 30%, 40%, 50%, 60%, 70%, 75%, 80%, 90%, 95%, 100%)

Parameters:

cube (Cube) – Given the collapse coordinate, convert the set of values along that coordinate into a PDF and extract percentiles.

Return type:

Cube

Returns:

A single merged cube of all the cubes produced by each percentile collapse.