gwexpy.timeseries.io.zarr_
Note
Current behavior follows the Phase 7 truth ledger and the #8-19
fail-fast fix:
Per-array
sample_rateis the primary timing metadata.dtis accepted as a fallback and converted tosample_rate = 1 / dt.If both are missing, reading raises
ValueErrorinstead of silently assuming1 Hz.Legacy stores can be recovered intentionally with exactly one of
sample_rate_override=...ordt_override=....
Zarr reader/writer for gwexpy.
Convention
A Zarr store is a group where each array represents one channel.
Per-array attributes sample_rate (Hz) and t0 (GPS seconds) are
used to reconstruct the time axis. If sample_rate is absent the
inverse of dt is tried. If both are absent, reading fails with a
clear error instead of silently assuming 1 Hz.
Directory stores, zip stores, and any other backend supported by the
zarr library can be used as source / target.
Functions
|
Read a Zarr store into a TimeSeriesDict. |
|
Read a Zarr store and return the first channel. |
|
Read a Zarr store and convert its channels to a matrix. |
|
Write a TimeSeriesDict to a Zarr store. |
|
Write one |
- gwexpy.timeseries.io.zarr_.read_timeseriesdict_zarr(source, *, channels=None, unit=None, sample_rate_override=None, dt_override=None, **kwargs) TimeSeriesDict[source]
Read a Zarr store into a TimeSeriesDict.
- Parameters:
source (str, path-like, or zarr store) – Path to the
.zarrdirectory (or any zarr-compatible store).channels (iterable of str, optional) – Array names to read. If None, all arrays in the root group are loaded.
unit (str, optional) – Physical unit override applied to every channel.
sample_rate_override (float, optional) – Explicit sample-rate recovery value in Hz for legacy stores that lack per-array
sample_rateanddtmetadata. Mutually exclusive withdt_override.dt_override (float, optional) – Explicit sample-spacing recovery value in seconds for legacy stores that lack per-array timing metadata. Mutually exclusive with
sample_rate_override.**kwargs – Additional keyword arguments forwarded to
zarr.open_group.
- gwexpy.timeseries.io.zarr_.read_timeseries_zarr(source, **kwargs) TimeSeries[source]
Read a Zarr store and return the first channel.
- gwexpy.timeseries.io.zarr_.read_timeseriesmatrix_zarr(source, **kwargs) TimeSeriesMatrix[source]
Read a Zarr store and convert its channels to a matrix.
- gwexpy.timeseries.io.zarr_.write_timeseriesdict_zarr(tsd, target, **kwargs)[source]
Write a TimeSeriesDict to a Zarr store.
Each channel is written as an array in the root group with
sample_rate,t0, andunitstored as attributes.
- gwexpy.timeseries.io.zarr_.write_timeseries_zarr(ts, target, **kwargs)[source]
Write one
TimeSeriesto a Zarr store.