improver.between_thresholds module
Plugin to calculate probabilities of occurrence between specified thresholds
- class OccurrenceBetweenThresholds(threshold_ranges, threshold_units)[source]
Bases:
PostProcessingPlugin
Calculate 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_impl = <_abc_data object>
- _calculate_probabilities()[source]
Calculate between_threshold probabilities cube
- Return type:
- Returns:
Merged cube containing recalculated probabilities
- _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.
- Return type:
- Returns:
or -1.
- Raises:
ValueError – If the spp__relative_to_threshold attribute is not recognised
- _slice_cube()[source]
Extract required slices from input cube
- Return type:
- Returns:
List of 2-item lists containing lower and upper threshold cubes
- Raises:
ValueError – If any of the required constraints returns None