Skip to content

Conversation

@Mastomaki
Copy link

Throw domainerror when TimeSeries ParameterValue is refenced with a time slice which is out of domain of the time series.

Related to Checking the replacement value for variables #1016

Checklist before merging

  • Documentation is up-to-date
  • Release notes have been updated
  • Unit tests have been added/updated accordingly
  • Code has been formatted nicely
  • Unit tests pass

…ime slice which is out of domain of the time series.
t_end <= pv.value.indexes[1] && return NaN
t_start > pv.value.indexes[end] && !pv.value.ignore_year && return NaN
t_end <= pv.value.indexes[1] && throw(DomainError(pv, "Time index $t out of range!"))
t_start > pv.value.indexes[end] && !pv.value.ignore_year && throw(DomainError(pv, "Time index $t out of range!"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we rely on time series returning NaN in those cases for a lot of things - I suggest we instead error out in SpineOpt whenever we find a NaN in the replacement value.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion might also be more robust in case the NaN happens to be in the middle for some reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants