spinetoolbox.mvcmodels.time_series_model_fixed_resolution

A model for fixed resolution time series, used by the parameter_value editors.

authors
  1. Soininen (VTT)

date

4.7.2019

Module Contents

Classes

TimeSeriesModelFixedResolution

A model for fixed resolution time series type parameter values.

class spinetoolbox.mvcmodels.time_series_model_fixed_resolution.TimeSeriesModelFixedResolution(series)[source]

Bases: spinetoolbox.mvcmodels.indexed_value_table_model.IndexedValueTableModel

A model for fixed resolution time series type parameter values.

series

a time series

Type

TimeSeriesFixedResolution

A base class for time pattern and time series models.

Parameters
  • value (TimePattern, TimeSeriesFixedStep, TimeSeriesVariableStep) – a parameter_value

  • index_header (str) – a header for the index column

  • value_header (str) – a header for the value column

flags(self, index)[source]

Returns flags at index.

property indexes(self)[source]

Returns the time stamps as an array.

insertRows(self, row, count, parent=QModelIndex())[source]

Inserts new values to the series.

The new values are set to zero. Start time or resolution are left unchanged.

Parameters
  • row (int) – a numeric index to the first stamp/value to insert

  • count (int) – number of stamps/values to insert

  • parent (QModelIndex) – index to a parent model

Returns

True if the operation was successful

removeRows(self, row, count, parent=QModelIndex())[source]

Removes values from the series.

Parameters
  • row (int) – a numeric index to the series where to begin removing

  • count (int) – how many stamps/values to remove

  • parent (QModelIndex) – an index to the parent model

Returns

True if the operation was successful.

reset(self, value)[source]

Resets the model with new time series data.

setData(self, index, value, role=Qt.EditRole)[source]

Sets a given value in the series.

Column index 1 refers to values. Note it does not make sense to set the time stamps in fixed resolution series.

Parameters
  • index (QModelIndex) – an index to the model

  • value (numpy.datetime64, float) – a new stamp or value

  • role (int) – a role

Returns

True if the operation was successful

batch_set_data(self, indexes, values)[source]

Sets data for several indexes at once.

Only the values of the series are modified as the time stamps are immutable.

Parameters
  • indexes (Sequence) – a sequence of model indexes

  • values (Sequence) – a sequence of floats corresponding to the indexes

set_ignore_year(self, ignore_year)[source]

Sets the ignore_year option of the time series.

set_repeat(self, repeat)[source]

Sets the repeat option of the time series.

set_resolution(self, resolution)[source]

Sets the resolution.

set_start(self, start)[source]

Sets the start datetime.

property values(self)[source]

Returns the values of the time series as an array.