Skip to content

Documents · Verb reference

compare_blocks

Compare all unique pairs in a block collection.

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

Usage

from cubedynamics import verbs as v
v.compare_blocks(*, variables=None, time_dim=None, block_dim='block', join='inner')

Arguments

Argument Meaning Default
variables See implementation docstring below; no parameter-specific description supplied. None
time_dim See implementation docstring below; no parameter-specific description supplied. None
block_dim See implementation docstring below; no parameter-specific description supplied. 'block'
join See implementation docstring below; no parameter-specific description supplied. 'inner'

Accepts

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

Returns

The public docstring does not specify a return contract. Do not assume a pipe-ready return; consult the linked implementation.

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"

west = (pipe(cube.isel(x=slice(0, 12))) | v.block_signature(block_id="west")).unwrap()
east = (pipe(cube.isel(x=slice(12, None))) | v.block_signature(block_id="east")).unwrap()
blocks = (pipe(west) | v.collect_blocks(east)).unwrap()
result = (pipe(blocks) | v.compare_blocks()).unwrap()
print(result)
blocks["tmax"].plot.line(x="time", hue="block")
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

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.