spinetoolbox.mvcmodels.time_series_model_variable_resolution

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

Module Contents

Classes

TimeSeriesModelVariableResolution

A model for variable resolution time series type parameter values.

class spinetoolbox.mvcmodels.time_series_model_variable_resolution.TimeSeriesModelVariableResolution(value, parent)[source]

Bases: spinetoolbox.mvcmodels.indexed_value_table_model.IndexedValueTableModel

A model for variable resolution time series type parameter values.

Parameters
  • value (IndexedValue) – a parameter_value

  • parent (QObject) – parent object

property indexes[source]

Returns the time stamps as an array.

property values[source]

Returns the values of the time series as an array.

flags(index)[source]

Returns the flags for given model index.

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

Inserts new time stamps and values to the series.

When inserting in the middle of the series the new time stamps are distributed evenly among the time span between the two time stamps around the insertion point. When inserting at the beginning or at the end of the series the duration between the new time stamps is set equal to the first/last duration in the original series.

The new values are set to zero.

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 insertion was successful

Return type

bool

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

Removes time stamps/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.

Return type

bool

reset(value)[source]

Resets the model with new time series data.

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

Sets a given time stamp or value in the series.

Column index 0 refers to time stamps while index 1 to values.

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

Return type

bool

batch_set_data(indexes, values)[source]

Sets data for several indexes at once.

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

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

set_ignore_year(ignore_year)[source]

Sets the ignore_year option of the time series.

set_repeat(repeat)[source]

Sets the repeat option of the time series.