scmdata.timeseries¶
TimeSeries handling
Functionality for handling and storing individual time-series
TimeSeries¶
- class 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
- Returns
Timeseries
- interpolate(target_times, interpolation_type='linear', extrapolation_type='linear')[source]¶
Interpolate the timeseries onto a new time axis
- Parameters
target_times (
typing.Union
[numpy.ndarray
,typing.List
[typing.Union
[datetime.datetime
,int
]]]) – Time grid onto which to interpolateinterpolation_type (str) – Interpolation type. Options are ‘linear’
extrapolation_type (str or None) – Extrapolation type. Options are None, ‘linear’ or ‘constant’
- Returns
TimeSeries
– A new TimeSeries with the new time dimension
- property meta¶
Metadata associated with the timeseries
- Returns
dict
- 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 (
typing.Any
) – Additional arguments passed to xarray’s DataArray.reindex function
- Returns
TimeSeries
– A new TimeSeries with the new time dimension
References
- property time_points¶
Time points of the data
- Returns
- property values¶
Get the data as a numpy array
- Returns