scmdata.timeseries
TimeSeries handling
Functionality for handling and storing individual time-series
- class scmdata.timeseries.TimeSeries(data, time=None, **kwargs)[source]
Bases:
OpsMixin
A 1D time-series with metadata
Proxies an xarray.DataArray with a single time dimension
- copy()[source]
Create a deep copy of the timeseries.
Any further modifications to the
Timeseries
returned copy will not be reflected in the currentTimeseries
- Return type
Timeseries
- interpolate(target_times: Union[ndarray, List[Union[datetime, int]]], interpolation_type: str = 'linear', extrapolation_type: str = 'linear')[source]
Interpolate the timeseries onto a new time axis
- Parameters
- Returns
A new TimeSeries with the new time dimension
- Return type
- property name
Timeseries name
If no name was provided this will be an automatically incrementing number
- reindex(time, **kwargs)[source]
Update the time dimension, filling in the missing values with NaN’s
This is different to interpolating to fill in the missing values. Uses xarray.DataArray.reindex to perform the reindexing
- Parameters
time (obj:np.ndarray) – Time values to reindex the data to. Should be
np.datetime64
values**kwargs – Additional arguments passed to xarray’s DataArray.reindex function
- Returns
A new TimeSeries with the new time dimension
- Return type
References
- property time_points
Time points of the data
- Return type
- property values
Get the data as a numpy array
- Return type