Skip to content

Documents · Verb reference

occurrence_synchrony

Measure whether states occur at the same times across locations.

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

Usage

from cubedynamics import verbs as v
v.occurrence_synchrony(*, spatial_mode='neighbors', radius_km=None, k_neighbors=None, reference=None, method='jaccard', window=None, stride=None, state_var='state')

Arguments

Argument Meaning Default
spatial_mode See implementation docstring below; no parameter-specific description supplied. 'neighbors'
radius_km See implementation docstring below; no parameter-specific description supplied. None
k_neighbors See implementation docstring below; no parameter-specific description supplied. None
reference See implementation docstring below; no parameter-specific description supplied. None
method See implementation docstring below; no parameter-specific description supplied. 'jaccard'
window See implementation docstring below; no parameter-specific description supplied. None
stride See implementation docstring below; no parameter-specific description supplied. None
state_var See implementation docstring below; no parameter-specific description supplied. 'state'

Accepts

State cube -> synchrony Dataset. Reference/neighborhood modes return maps; all-pairs returns edge data; regional returns time-series summaries.

Returns

State cube -> synchrony Dataset. Reference/neighborhood modes return maps; all-pairs returns edge data; regional returns time-series summaries.

Order / grammar behavior

State cube -> synchrony Dataset. Reference/neighborhood modes return maps; all-pairs returns edge data; regional returns time-series summaries.

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"

state = (pipe(cube) | v.threshold_state(threshold=0, direction="below")).unwrap()
result = (pipe(state) | v.occurrence_synchrony(spatial_mode="reference", reference="center")).unwrap()
result["occurrence_synchrony"].squeeze().plot()
plt.show()

Works with

State cube -> synchrony Dataset. Reference/neighborhood modes return maps; all-pairs returns edge data; regional returns time-series summaries.

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.