import numpy as np
from dascore.core.coords import get_coord
from dascore.io.zarr import coord_attrs
start, step = np.datetime64(0, "ns"), np.timedelta64(1, "s")
time = get_coord(start=start, step=step, shape=(10,))
attrs = coord_attrs(time) # e.g. zarr_array.attrs.update(attrs)coord_attrs
coord_attrs(
coord ,
)-> ‘dict’
Return the attributes stating a coordinate’s grid on a zarr array.
Set on a coordinate array, they describe its labels, which a scan then never reads; the array may have no chunks written at all. The values are JSON-safe, and include a numeric coordinate’s CF units. A float grid’s labels are built once to check the description is exact. If the array’s length is later changed, its attributes must be rewritten, since a stated length unlike the array’s is taken as stale and the labels are read instead.
Parameters
| Parameter | Description |
|---|---|
| coord | A coordinate of one grid. |
Raises
ParameterError If the coordinate is not one grid JSON describes exactly.