TurbulentRegionFromThreshold#
- class rojak.turbulence.analysis.TurbulentRegionFromThreshold(computed_diagnostic, severity, thresholds, threshold_mode, /, **sel_condition)[source]#
Computes a boolean mask of where a turbulence diagnostic falls within a given severity’s threshold bounds
Accepts either a single
xarray.DataArraywith a singleTurbulenceThresholds, or anxarray.Datasetof diagnostics with a mapping from diagnostic name to that diagnostic’sTurbulenceThresholds.- Parameters:
severity (TurbulenceSeverity)
thresholds (TurbulenceThresholds | Mapping[DiagnosticName, TurbulenceThresholds])
threshold_mode (TurbulenceThresholdMode)
- __init__(computed_diagnostic, severity, thresholds, threshold_mode, /, **sel_condition)[source]#
- Parameters:
computed_diagnostic (DataArray | Dataset) – Computed diagnostic value(s), either a single DataArray or a Dataset of diagnostics
severity (TurbulenceSeverity) – Turbulence severity to compute the boolean mask for
thresholds (TurbulenceThresholds | Mapping[DiagnosticName, TurbulenceThresholds]) – Threshold(s) to determine
severity. Must be a mapping from diagnostic name toTurbulenceThresholdsifcomputed_diagnosticis a Dataset, or a singleTurbulenceThresholdsif it is a DataArraythreshold_mode (TurbulenceThresholdMode) – Whether the thresholds are bounded intervals or lower bounds
**sel_condition – Passed to
xarray.DataArray.sel()/xarray.Dataset.sel()to subsetcomputed_diagnosticbefore computing the mask
- Raises:
TypeError – If
thresholdsis not the shape (mapping or single value) expected for the type ofcomputed_diagnosticValueError – If
computed_diagnosticis a Dataset whose variables are not a subset ofthresholds
- Return type:
None
Methods
__init__(computed_diagnostic, severity, ...)execute()Compute the boolean turbulence mask(s) for
self._computed_diagnostic