Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1911 +/- ##
==========================================
- Coverage 71.12% 71.12% -0.01%
==========================================
Files 149 149
Lines 14122 14166 +44
Branches 1872 1879 +7
==========================================
+ Hits 10044 10075 +31
- Misses 3548 3555 +7
- Partials 530 536 +6 🚀 New features to boost your workflow:
|
…models provided by tekniker for this step.
| PLR_list = [q / (self._model["Qref"] * CAPFT) for q in Q_solutions] | ||
|
|
||
| # Collect indices of physically valid PLRs | ||
| # the upper boarder is slightly increased (by 0.05) because of numerical errors that can |
There was a problem hiding this comment.
I see that the PLR limit is still 1 and not 1.05 though, if this is the expected behavior then I would remove the comment since it looks invalid
There was a problem hiding this comment.
Ah sorry, this comment is from an intermediate version. Will remove.
| """ | ||
|
|
||
| # Compute PLRs for each Q | ||
| PLR_list = [q / (self._model["Qref"] * CAPFT) for q in Q_solutions] |
There was a problem hiding this comment.
It works, but I would prefer to not use indexes in this function. For example, something like this would equally work without using list indexes, and it is more concise (note that you can use the Walrus operator in the dict comprehension, but I left it out due to also not being a huge fan of it):
PLR_dict = {
q / (self._model["Qref"] * CAPFT): q
for q in Q_solutions
if 0 <= q / (self._model["Qref"] * CAPFT) <= 1
}
if not PLR_dict:
log.error("IndividualCOPModel: No physically feasible PLR solutions. %s", PLR_dict)
return None
return PLR_dict[max(PLR_dict)]
There was a problem hiding this comment.
Thanks! Will implement your suggestion, because I do not mind either way.
Is there a reason to prefer dictionaries here besides personal preference?
Thanks for omitting the Walrus operator :-)
There was a problem hiding this comment.
Is there a reason to prefer dictionaries here besides personal preference?
It is mostly personal preference and trying to avoid index-based calculations when possible. IMO index-based calculations are very error prone and worth to replace with dictionaries or other calculation types whenever possible.
There was a problem hiding this comment.
Understood, thanks!
spyrostz
left a comment
There was a problem hiding this comment.
Some small comments, LGTM once resolved
Reason for the proposed changes
Please describe what we want to achieve and why.
Proposed changes
INTEGRATION_TESTS_BRANCH=master
GSY_FRAMEWORK_BRANCH=feature/GSYE-901
SCM_ENGINE_BRANCH=master