Enforce minimum service factor limits#325
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #325 +/- ##
===========================================
- Coverage 71.11% 71.09% -0.02%
===========================================
Files 44 44
Lines 5809 5812 +3
Branches 1147 1148 +1
===========================================
+ Hits 4131 4132 +1
- Misses 1358 1359 +1
- Partials 320 321 +1 ☔ View full report in Codecov by Sentry. |
dalonsoa
left a comment
There was a problem hiding this comment.
Right check, wrong place :)
src/muse/constraints.py
Outdated
| if np.all(technologies["minimum_service_factor"] == 0): | ||
| return None | ||
|
|
||
| min_service_factor = technologies["minimum_service_factor"] |
There was a problem hiding this comment.
Actually, the right place to make this check is in the readers, when the technodata is read and sort of validated, somewhere around here:
MUSE_OS/src/muse/readers/csv.py
Line 132 in c7a0101
This is validating the technodata timeslices file, but probably it should also be applied to the normal technodata file, in the previous function in the same module.
The data argument is just passed through unchanged.
Description
I've fixed #320 by introducing a check in the
minimum_serviceconstraint function that all minimum service factors are >=0 and <= 1 and I've also amended the spurious tests accordingly.The only thing is that I'm wondering whether this is a bit late to raise an error. Should the check be in some earlier parsing step (either in addition or instead)?
While I was reading through the docstring for
muse.constraintsI noticed some typos and fixed those while I was at it.Fixes #320.
Type of change
Key checklist
$ python -m pytest$ python -m sphinx -b html docs docs/buildFurther checks