Skip to content

Documents · Verb reference

local_synchrony_stack

Build unreduced moving-center synchrony stacks.

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

Usage

from cubedynamics import verbs as v
v.local_synchrony_stack(*, lower_var=None, upper_var=None, window_days=90, window_end=None, min_t=5, split_quantile=0.5, time_dim='time', center_y_indices=None, center_x_indices=None, max_radius_km=None, distance_bands_km=(25.0, 50.0, 100.0, 250.0), pair_batch_size=4096)

Arguments

Argument Meaning Default
lower_var See implementation docstring below; no parameter-specific description supplied. None
upper_var See implementation docstring below; no parameter-specific description supplied. None
window_days See implementation docstring below; no parameter-specific description supplied. 90
window_end See implementation docstring below; no parameter-specific description supplied. None
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'
center_y_indices See implementation docstring below; no parameter-specific description supplied. None
center_x_indices See implementation docstring below; no parameter-specific description supplied. None
max_radius_km See implementation docstring below; no parameter-specific description supplied. None
distance_bands_km See implementation docstring below; no parameter-specific description supplied. (25.0, 50.0, 100.0, 250.0)
pair_batch_size See implementation docstring below; no parameter-specific description supplied. 4096

Accepts

Climate cube -> relationship stack with dimensions center, y, x. Cold synchrony uses the lower tail of lower_var; warm synchrony uses the upper tail of upper_var. The output contains the full stack plus distance, bearing, direction, and joint-count diagnostics.

Returns

Climate cube -> relationship stack with dimensions center, y, x. Cold synchrony uses the lower tail of lower_var; warm synchrony uses the upper tail of upper_var. The output contains the full stack plus distance, bearing, direction, and joint-count diagnostics.

Order / grammar behavior

Climate cube -> relationship stack with dimensions center, y, x. Cold synchrony uses the lower tail of lower_var; warm synchrony uses the upper tail of upper_var. The output contains the full stack plus distance, bearing, direction, and joint-count diagnostics.

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"

small = cube.isel(y=slice(0, 4), x=slice(0, 4))
temperature = xr.Dataset({"tmin": small, "tmax": small})
result = (pipe(temperature) | v.local_synchrony_stack(lower_var="tmin", upper_var="tmax", window_days=14, min_t=3, center_y_indices=range(2), center_x_indices=range(2))).unwrap()
# One center landscape; selecting a focal pixel across center shows its stack.
result["delta_s"].isel(center=0).plot()
plt.show()

Works with

Climate cube -> relationship stack with dimensions center, y, x. Cold synchrony uses the lower tail of lower_var; warm synchrony uses the upper tail of upper_var. The output contains the full stack plus distance, bearing, direction, and joint-count diagnostics.

See also

Implementation notes

One bounded rolling window is materialized. Apply this verb to a center tile plus halo; do not request a dense national center-by-focal matrix.

Implementation source. Signatures and descriptions on this page are generated from this checkout, not hand-maintained copies.