Skip to content

Documents · Verb reference

rolling_median_split_synchrony

Compute rolling synchrony in lower and upper per-series sets.

Callable type: Grammar verb / pipe stage · Browse: Synchrony and comparison

Usage

from cubedynamics import verbs as v
v.rolling_median_split_synchrony(*, window_days=90, min_t=5, split_quantile=0.5, time_dim='time', output_stride=1, output_times=None, lower_var=None, upper_var=None)

Arguments

Argument Meaning Default
window_days See implementation docstring below; no parameter-specific description supplied. 90
min_t See implementation docstring below; no parameter-specific description supplied. 5
split_quantile See implementation docstring below; no parameter-specific description supplied. 0.5
time_dim See implementation docstring below; no parameter-specific description supplied. 'time'
output_stride See implementation docstring below; no parameter-specific description supplied. 1
output_times See implementation docstring below; no parameter-specific description supplied. None
lower_var See implementation docstring below; no parameter-specific description supplied. None
upper_var See implementation docstring below; no parameter-specific description supplied. None

Accepts

Statistical verb returning a three-variable :class:xarray.Dataset. For a DataArray, both sets come from the same variable. For a multi-variable Dataset, lower_var and upper_var select the variables used for the lower and upper sets, respectively. With split_quantile=0.5, the lower set contains dates when a pixel and its cube's center pixel are both at or below their rolling medians. The upper set contains dates when both are above their rolling medians. output_stride controls how many input timestamps to advance between outputs; use 30 for approximately monthly results from daily climate data. output_times can be used by streaming jobs to request a bounded batch of explicit rolling window end timestamps.

Returns

Statistical verb returning a three-variable :class:xarray.Dataset. For a DataArray, both sets come from the same variable. For a multi-variable Dataset, lower_var and upper_var select the variables used for the lower and upper sets, respectively. With split_quantile=0.5, the lower set contains dates when a pixel and its cube's center pixel are both at or below their rolling medians. The upper set contains dates when both are above their rolling medians. output_stride controls how many input timestamps to advance between outputs; use 30 for approximately monthly results from daily climate data. output_times can be used by streaming jobs to request a bounded batch of explicit rolling window end timestamps.

Order / grammar behavior

Statistical verb returning a three-variable :class:xarray.Dataset. For a DataArray, both sets come from the same variable. For a multi-variable Dataset, lower_var and upper_var select the variables used for the lower and upper sets, respectively. With split_quantile=0.5, the lower set contains dates when a pixel and its cube's center pixel are both at or below their rolling medians. The upper set contains dates when both are above their rolling medians. output_stride controls how many input timestamps to advance between outputs; use 30 for approximately monthly results from daily climate data. output_times can be used by streaming jobs to request a bounded batch of explicit rolling window end timestamps.

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.rolling_median_split_synchrony(window_days=14, min_t=3)).unwrap()
result["bottom_minus_top"].isel(time_window_end=-1).plot()
plt.show()

Works with

Statistical verb returning a three-variable :class:xarray.Dataset. For a DataArray, both sets come from the same variable. For a multi-variable Dataset, lower_var and upper_var select the variables used for the lower and upper sets, respectively. With split_quantile=0.5, the lower set contains dates when a pixel and its cube's center pixel are both at or below their rolling medians. The upper set contains dates when both are above their rolling medians. output_stride controls how many input timestamps to advance between outputs; use 30 for approximately monthly results from daily climate data. output_times can be used by streaming jobs to request a bounded batch of explicit rolling window end timestamps.

See also

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.