Documents · Verb reference
quantile_state
Convert raw values to a state cube using quantile thresholds.
Callable type: Grammar verb / pipe stage · Browse: State and events
Usage
from cubedynamics import verbs as v
v.quantile_state(*, quantile, direction, rolling_window=None, climatology=None, variable=None, name=None)
Arguments
| Argument | Meaning | Default |
|---|---|---|
| quantile | See implementation docstring below; no parameter-specific description supplied. | required |
| direction | See implementation docstring below; no parameter-specific description supplied. | required |
| rolling_window | See implementation docstring below; no parameter-specific description supplied. | None |
| climatology | See implementation docstring below; no parameter-specific description supplied. | None |
| variable | See implementation docstring below; no parameter-specific description supplied. | None |
| name | See implementation docstring below; no parameter-specific description supplied. | None |
Accepts
Raw cube -> Dataset with state, magnitude, and threshold.
Returns
Raw cube -> Dataset with state, magnitude, and threshold.
Order / grammar behavior
Raw cube -> Dataset with state, magnitude, and threshold.
Minimal example
Run from the repository root after python -m pip install -e '.[vignettes]'. Uses the checked observational PRISM fixture; no network is required.
from pathlib import Path
import xarray as xr
import matplotlib.pyplot as plt
from cubedynamics import pipe, verbs as v
# Frozen, reviewed PRISM observations; run from the repository root.
path = Path("tests/fixtures/real_data/prism_boulder_january_2024.nc")
with xr.open_dataset(path, engine="scipy") as observed:
cube = observed["tmax"].load()
assert cube.attrs["units"] == "degC"
result = (pipe(cube) | v.quantile_state(quantile=0.2, direction="below")).unwrap()
result.state.mean("time").plot()
plt.show()
Works with
Raw cube -> Dataset with state, magnitude, and threshold.
See also
- Working Lands · Read hot-and-dry weather as two nouns
- Learn: verbs
- Noun library
- Verbs by purpose
- All public callables (A–Z)
Implementation notes
No additional implementation notes in the current docstring.
Implementation source. Signatures and descriptions on this page are generated from this checkout, not hand-maintained copies.