Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise error in tools.costs when a technology is assigned a reduction rate for which it does not have value #270

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

measrainsey
Copy link
Contributor

@measrainsey measrainsey commented Dec 18, 2024

Small PR to add an error in the costs tool in instances where a technology has a reduction category that is missing data

This issue came up in #235 (see @khaeru's comment here), where a technology was missing a reduction rate category in cost_reduction.csv that other technologies had. In this case, it didn't matter too much as that missing cost reduction category was never specified for that technology in the scenarios_reduction.csv. However, a hypothetical was brought up: what happens if a technology is assigned a reduction category for a scenario, but said reduction category does not exist for said technology?

I have added a few lines to check for these instances and if they exist, the tool should raise an error.

How to review

For @khaeru and/or @glatterf42 : Read the diff and note that the CI checks all pass.

PR checklist

  • Continuous integration checks all ✅
  • Add or expand tests; coverage checks both ✅
  • Add, expand, or update documentation.
  • Update doc/whatsnew.

@measrainsey measrainsey added the costs `.tools.costs`/cost data preparation label Dec 18, 2024
@measrainsey measrainsey self-assigned this Dec 18, 2024
@measrainsey measrainsey changed the title Raise error when a technology is assigned a reduction rate it does not have value a for in tools.costs Raise error in tools.costs when a technology is assigned a reduction rate for which it does not have value Dec 18, 2024
Copy link

codecov bot commented Dec 18, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 77.0%. Comparing base (91d6302) to head (fdd2dfd).

Files with missing lines Patch % Lines
message_ix_models/tools/costs/decay.py 50.0% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main    #270     +/-   ##
=======================================
- Coverage   78.0%   77.0%   -1.0%     
=======================================
  Files        215     215             
  Lines      16572   16575      +3     
=======================================
- Hits       12927   12776    -151     
- Misses      3645    3799    +154     
Files with missing lines Coverage Δ
message_ix_models/tools/costs/decay.py 97.1% <50.0%> (-2.9%) ⬇️

... and 10 files with indirect coverage changes

@khaeru khaeru force-pushed the mm/costs/add-error branch from 04e5544 to fdd2dfd Compare February 19, 2025 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
costs `.tools.costs`/cost data preparation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant