improver.between_thresholds module¶
Plugin to calculate probabilities of occurrence between specified thresholds
-
class
improver.between_thresholds.OccurrenceBetweenThresholds(threshold_ranges, threshold_units)[source]¶ Bases:
improver.BasePluginCalculate the probability of occurrence between thresholds
-
__init__(threshold_ranges, threshold_units)[source]¶ Initialise the class. Threshold ranges must be specified in a unit that is NOT sensitive to differences at the 1e-5 (float32) precision level.
- Parameters
- Raises
ValueError – If any of the specified thresholds are indistinguishable at the 1e-5 (float32) precision level
-
_abc_cache= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version= 213¶
-
_abc_registry= <_weakrefset.WeakSet object>¶
-
_calculate_probabilities()[source]¶ Calculate between_threshold probabilities cube
- Returns
Merged cube containing recalculated probabilities
- Return type
-
_get_multiplier()[source]¶ Check whether the cube contains “above” or “below” threshold probabilities. For “above”, the probability of occurrence between thresholds is the difference between probabilities at the lower and higher thresholds: P(lower) - P(higher). For “below” it is the inverse of this: P(higher) - P(lower), which is implemented by multiplying the difference by -1.
- Returns
or -1.
- Return type
- Raises
ValueError – If the spp__relative_to_threshold attribute is not recognised
-
_slice_cube()[source]¶ Extract required slices from input cube
- Returns
List of 2-item lists containing lower and upper threshold cubes
- Return type
- Raises
ValueError – If any of the required constraints returns None
-
_update_metadata(output_cube, original_units)[source]¶ Update output cube name and threshold coordinate
- Parameters
output_cube (iris.cube.Cube) – Cube containing new “between_thresholds” probabilities
original_units (str) – Required threshold-type coordinate units
-
process(cube)[source]¶ Calculate probabilities between thresholds for the input cube
- Parameters
cube (iris.cube.Cube) – Probability cube containing thresholded data (above or below)
- Returns
Cube containing probability of occurrence between thresholds
- Return type
-