gwexpy.interop.json_

Functions

from_dict(cls, data_dict, *[, unit, ...])

Create a TimeSeries from a dictionary.

from_json(cls, json_str, **kwargs)

Create a TimeSeries from a JSON string.

to_dict(ts)

Convert a TimeSeries to a dictionary.

to_json(ts)

Convert TimeSeries to a JSON string.

gwexpy.interop.json_.to_json(ts)[source]

Convert TimeSeries to a JSON string.

Includes data and basic metadata.

gwexpy.interop.json_.to_dict(ts)[source]

Convert a TimeSeries to a dictionary.

gwexpy.interop.json_.from_json(cls, json_str, **kwargs)[source]

Create a TimeSeries from a JSON string.

Extra keyword arguments are forwarded to from_dict() so callers can override metadata (unit/channel/name/t0/dt) absent from the JSON payload.

gwexpy.interop.json_.from_dict(cls, data_dict, *, unit=None, channel=None, name=None, t0=None, dt=None)[source]

Create a TimeSeries from a dictionary.

Metadata not present in data_dict can be supplied explicitly via the keyword arguments; an explicit argument always takes priority over a value stored in the dictionary (user > source). Missing t0/dt fall back to 0/1 with a UserWarning rather than silently.