Documents · Verb reference
align_time
Return a verb that records an explicit temporal-alignment decision.
Callable type: Grammar verb / pipe stage · Browse: Spatial and alignment
Usage
from cubedynamics import verbs as v
v.align_time(other, *, mode='require_exact_support', time_dim='time')
Arguments
| Argument | Meaning | Default |
|---|---|---|
| other | See implementation docstring below; no parameter-specific description supplied. | required |
| mode | See implementation docstring below; no parameter-specific description supplied. | 'require_exact_support' |
| time_dim | See implementation docstring below; no parameter-specific description supplied. | 'time' |
Accepts
Two xarray objects with time coordinates. mode='labels' records label pairing; mode='require_exact_support' also requires identical known observation-support metadata.
Returns
The unchanged left xarray object with metadata describing coordinate and observation-support compatibility. No values or coordinates are shifted, resampled, interpolated, aggregated, or truncated.
Order / grammar behavior
Inspect and acknowledge temporal meaning before cross-source composition. Observation-support alignment and event-time matching are separate questions.
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"
other = cube.copy(deep=False)
result = (pipe(cube) | v.align_time(other, mode="labels")).unwrap()
# Labels and values are unchanged; inspect the recorded decision.
print(result.attrs["temporal_alignment_support"])
result.isel(time=0).plot()
plt.show()
Works with
Two xarray objects with time coordinates. mode='labels' records label pairing; mode='require_exact_support' also requires identical known observation-support metadata.
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.