Skip to content

Conversation

@finozzifa
Copy link
Contributor

@finozzifa finozzifa commented Mar 18, 2025

Closes # (if applicable).

This pull request addresses what detailed in this comment.

The work has been performed by @danielelerede-oet and myself.

Changes proposed in this Pull Request

Checklist

  • Code changes are sufficiently documented; i.e. new functions contain docstrings and further explanations may be given in doc.
  • Data source for new technologies is clearly stated.
  • Newly introduced dependencies are added to environment.yaml (if applicable).
  • A note for the release notes doc/release_notes.rst of the upcoming release is included.
  • I consent to the release of this PR's code under the GPLv3 license.

@finozzifa finozzifa marked this pull request as ready for review March 19, 2025 18:53
@finozzifa
Copy link
Contributor Author

hey @lkstrp and @euronion. I think this PR is ready to be reviewed!

@euronion euronion requested review from Copilot and euronion March 31, 2025 15:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR modifies the handling of inflation rate data by updating the prepare_inflation_rate function and adjusting its usage across tests and cost‐compilation scripts, with a particular focus on handling USD and EUR currency differences. Key changes include:

  • Updating test cases to use the new inflation rate file and support both USD and EUR currencies.
  • Refactoring the prepare_inflation_rate function and its documentation to accept a currency parameter.
  • Removing the inflation adjustment block from pre_process_manual_input_usa and adding inflation adjustment for USD costs in duplicate_fuel_cost.

Reviewed Changes

Copilot reviewed 17 out of 21 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/test_helpers.py Added tests for prepare_inflation_rate with various currency inputs.
test/test_compile_cost_assumptions_usa.py Removed passing of inflation_rate_file_path to pre_process_manual_input_usa.
test/test_compile_cost_assumptions.py Updated inflation_rate file path and removed redundant test for inflation.
test/conftest.py Modified test fixture index for inflation data to include USD and EUR rows.
scripts/compile_cost_assumptions_usa.py Removed inflation adjustment for EUR in pre_process_manual_input_usa and added USD inflation adjustment in duplicate_fuel_cost.
scripts/compile_cost_assumptions.py Removed duplicate definition of prepare_inflation_rate.
scripts/_helpers.py Updated prepare_inflation_rate to support both EUR and USD with conditional row selection.
Files not reviewed (4)
  • Snakefile: Language not supported
  • docs/release_notes.rst: Language not supported
  • docs/structure.rst: Language not supported
  • inputs/US/manual_input_usa.csv: Language not supported
Comments suppressed due to low confidence (3)

scripts/compile_cost_assumptions_usa.py:443

  • The removal of the inflation adjustment step in pre_process_manual_input_usa may lead to inconsistent cost estimates for EUR inputs. Please confirm that this change is intentional and update relevant tests and documentation accordingly.
return manual_input_usa_file_df

scripts/_helpers.py:199

  • [nitpick] The docstring for prepare_inflation_rate does not mention support for USD inflation rates. Consider updating the documentation to indicate that the function conditionally selects the row based on the 'currency_to_use' parameter.
def prepare_inflation_rate(fn: str, currency_to_use: str = "eur") -> pd.Series:

scripts/compile_cost_assumptions_usa.py:1120

  • [nitpick] The variable name 'eur_reference_year' is used when processing USD inflation adjustments. Consider renaming it to more clearly reflect its purpose or usage when applying USD adjustments.
eur_reference_year,

Copy link
Collaborator

@euronion euronion left a comment

Choose a reason for hiding this comment

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

minor comments.

@finozzifa
Copy link
Contributor Author

hey @euronion, I think that @danielelerede-oet and myself solved all the comments you posted (thanks again for that <3 ).

@euronion euronion self-requested a review April 2, 2025 06:55
@euronion
Copy link
Collaborator

euronion commented Apr 2, 2025

Thanks ! This makes reviewing much easier :)

Two last (re)quest(ion)s:

  • Why are some values in the manual_input_US.csv modified?
  • Since you are modifying some entries, can you also add a proper reference, e.g. URL/Link, to the JRC-TIMES model/documentation from where you are taking the values?

@finozzifa
Copy link
Contributor Author

finozzifa commented Apr 2, 2025

Thanks ! This makes reviewing much easier :)

Two last (re)quest(ion)s:

* Why are some values in the `manual_input_US.csv` modified?

* Since you are modifying some entries, can you also add a proper reference, e.g. URL/Link, to the JRC-TIMES model/documentation from where you are taking the values?

Hi @euronion thanks for your questions.

  1. I have asked @danielelerede-oet to convert the EUR entries in manual_input_usa.csv to USD. In fact, before the file contained entries for which the currency was EUR and others for which it was USD. This change makes the file cleaner (it felt strange to open manual_input_usa and find entries in EUR) and allows to significantly simplify the inflation adjustment, which can now be done just once at the end of compile_cost_assumptions_usa.py.

  2. we will add the reference you requested!

@danielelerede-oet
Copy link
Contributor

Thanks ! This makes reviewing much easier :)
Two last (re)quest(ion)s:

* Why are some values in the `manual_input_US.csv` modified?

* Since you are modifying some entries, can you also add a proper reference, e.g. URL/Link, to the JRC-TIMES model/documentation from where you are taking the values?

Hi @euronion thanks for your questions.

  1. I have asked @danielelerede-oet to convert the EUR entries in manual_input_usa.csv to USD. In fact, before the file contained entries for which the currency was EUR and others for which it was USD. This change makes the file cleaner (it felt strange to open manual_input_usa and find entries in EUR) and allows to significantly simplify the inflation adjustment, which can now be done just once at the end of compile_cost_assumptions_usa.py.
  2. we will add the reference you requested!

@euronion I added a more specific reference linking to the zenodo URL for the model and the specific file we took data from! :D Thank you!!!

@euronion
Copy link
Collaborator

euronion commented Apr 2, 2025

Nice, LGTM. RTM? :)

@finozzifa
Copy link
Contributor Author

Nice, LGTM. RTM? :)

Nice. Thanks for your approval

@lkstrp lkstrp merged commit 756f989 into PyPSA:master Apr 3, 2025
3 checks passed
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.

4 participants