improver.percentile module

Module containing percentiling classes.

class improver.percentile.PercentileConverter(collapse_coord, percentiles=None, fast_percentile_method=True)[source]

Bases: object

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

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

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

Create a PDF plugin with a given source plugin.

Parameters:
  • collapse_coord (str or list of 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 (Iterable list of floats or None) – Percentile values at which to calculate; if not provided uses DEFAULT_PERCENTILES. (optional)
Raises:

TypeError – If collapse_coord is not a string.

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 (iris.cube.Cube) – Given the collapse coordinate, convert the set of values along that coordinate into a PDF and extract percentiles.
Returns:A single merged cube of all the cubes produced by each percentile collapse.
Return type:cube (iris.cube.Cube)