Documents · Verb reference
rasterize_observations
Rasterize observation rows into a biological cube.
Callable type: Direct helper function · Browse: Spatial and alignment
Call this helper directly with the documented data arguments; it does not return a configured pipe stage. Use v.apply(...) or an explicit callable if composition is needed.
Usage
from cubedynamics import verbs as v
v.rasterize_observations(observations, *, template, time_col='date', y_col='y', x_col='x', value_col='value', reducer='sum', name=None)
Arguments
| Argument | Meaning | Default |
|---|---|---|
| observations | See implementation docstring below; no parameter-specific description supplied. | required |
| template | See implementation docstring below; no parameter-specific description supplied. | required |
| time_col | See implementation docstring below; no parameter-specific description supplied. | 'date' |
| y_col | See implementation docstring below; no parameter-specific description supplied. | 'y' |
| x_col | See implementation docstring below; no parameter-specific description supplied. | 'x' |
| value_col | See implementation docstring below; no parameter-specific description supplied. | 'value' |
| reducer | See implementation docstring below; no parameter-specific description supplied. | 'sum' |
| name | See implementation docstring below; no parameter-specific description supplied. | None |
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"
rows = cube.to_dataframe(name="value").reset_index()
# Re-grid actual PRISM cell-center observations; this is not a biological survey.
result = v.rasterize_observations(rows, template=cube, time_col="time", reducer="mean")
result.isel(time=0).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
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.