Skip to content

Documents · Verb reference

overlap

Return a verb that finds coincident truth in two aligned state cubes.

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

Usage

from cubedynamics import verbs as v
v.overlap(other, *, left_variable=None, right_variable=None, name='overlap')

Arguments

Argument Meaning Default
other The second aligned boolean or state cube. required
left_variable Variables to select from Dataset inputs. If omitted, state is used when present; otherwise a single-variable Dataset is accepted. None
right_variable Variables to select from Dataset inputs. If omitted, state is used when present; otherwise a single-variable Dataset is accepted. None
name Name for the returned boolean DataArray. 'overlap'

Accepts

Consult the input parameters and implementation notes below. This namespace also includes direct helpers, not only pipe factories.

Returns

callable Pipe-ready verb producing a boolean DataArray.

Order / grammar behavior

A pipe passes the preceding result to the next callable. Confirm that the previous step's dimensions and semantic state satisfy the input contract. Reductions can remove dimensions; plotting may produce side effects.

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"

cold = (pipe(cube) | v.threshold_state(threshold=0, direction="below")).unwrap()
unusual = (pipe(cube) | v.quantile_state(quantile=0.2, direction="below")).unwrap()
result = (pipe(cold) | v.overlap(unusual) | v.mean(dim="time", keep_dim=False)).unwrap()
result.plot()
plt.show()

Works with

Use only the input types documented by this callable; not every helper accepts every noun or VirtualCube.

See also

Implementation notes

overlap does not perform vector intersection and does not establish causation or risk. It only records where two aligned conditions are true.

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