Skip to content

Comments

Fix issues with costs outputs#420

Merged
tsmbland merged 3 commits intodevelopfrom
fix_costs_outputs
Jul 22, 2024
Merged

Fix issues with costs outputs#420
tsmbland merged 3 commits intodevelopfrom
fix_costs_outputs

Conversation

@tsmbland
Copy link
Collaborator

@tsmbland tsmbland commented Jul 19, 2024

Description

Fixes a couple of issues with the costs outputs in outputs/mca.py. The first of which emerged after we upgraded pandas/xarray, the second was an issue before (but was never caught).

Changes:

  • Use multiindex_to_coords to fix the ValueError: cannot insert hour, already exists error
  • Change "new" to "newcapa", which fixes a bug where the LCOE and EAC outputs were empty when only using new agents

Remaining problems with the costs outputs:

Fixes #383

Type of change

Please add a line in the relevant section of
CHANGELOG.md to
document the change (include PR #) - note reverse order of PR #s.

  • New feature (non-breaking change which adds functionality)
  • Optimization (non-breaking, back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (whatever its nature)

Key checklist

  • All tests pass: $ python -m pytest
  • The documentation builds and looks OK: $ python -m sphinx -b html docs docs/build

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@codecov
Copy link

codecov bot commented Jul 19, 2024

Codecov Report

Attention: Patch coverage is 0% with 24 lines in your changes missing coverage. Please review.

Project coverage is 71.35%. Comparing base (692c0e8) to head (769c802).

Files Patch % Lines
src/muse/outputs/mca.py 0.00% 24 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #420      +/-   ##
===========================================
- Coverage    71.38%   71.35%   -0.04%     
===========================================
  Files           44       44              
  Lines         5893     5893              
  Branches      1160     1156       -4     
===========================================
- Hits          4207     4205       -2     
- Misses        1366     1367       +1     
- Partials       320      321       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tsmbland tsmbland marked this pull request as ready for review July 19, 2024 12:52
@tsmbland tsmbland requested review from alexdewar and dalonsoa July 19, 2024 12:55
Copy link
Collaborator

@dalonsoa dalonsoa left a comment

Choose a reason for hiding this comment

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

Looks good. The code is way more readable now, in addition to fixing the bugs, which is always good news.

Comment on lines +773 to +777
data_agent = multiindex_to_coords(data_agent, "timeslice").to_dataframe(
"fuel_consumption_costs"
)
if not data_agent.empty:
data_sector.append(data_agent)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks ok, but it is doing something different than before. I assume this is correct, but I'm not sure why it is.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ah, ok, you are combining it with what it was being done afterwards. OK, looks fine.

@alexdewar
Copy link
Collaborator

FYI @tsmbland I'm just going through your PRs now

Copy link
Collaborator

@alexdewar alexdewar left a comment

Choose a reason for hiding this comment

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

I've only given it a quick scan, but LGTM!

@tsmbland tsmbland merged commit 6fcaa99 into develop Jul 22, 2024
@tsmbland tsmbland deleted the fix_costs_outputs branch July 22, 2024 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

LCOE output doesn't work [BUG]

3 participants