Skip to content

Commit 626c273

Browse files
authored
code: add rounding to compile_cost_assumptions_usa (#206)
* code: add rounding to compile_cost_assumptions_usa * notes: modify the release notes
1 parent d44ac92 commit 626c273

File tree

9 files changed

+14113
-14103
lines changed

9 files changed

+14113
-14103
lines changed

docs/release_notes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ Upcoming Release
4444

4545
* Update scenarios for US-specific eletrolyzer investment cost (https://github.com/PyPSA/technology-data/pull/194)
4646

47+
* Adds a Makefile (https://github.com/PyPSA/technology-data/pull/204)
48+
49+
* Adds rounding for the value column of the csv files produced by compile_cost_assumptions_usa (https://github.com/PyPSA/technology-data/pull/206)
50+
4751
`v0.11.0 <https://github.com/PyPSA/technology-data/releases/tag/v0.11.0>`__ (24th January 2025)
4852
=======================================================================================
4953

outputs/US/costs_2020.csv

Lines changed: 1498 additions & 1498 deletions
Large diffs are not rendered by default.

outputs/US/costs_2025.csv

Lines changed: 2023 additions & 2023 deletions
Large diffs are not rendered by default.

outputs/US/costs_2030.csv

Lines changed: 2102 additions & 2102 deletions
Large diffs are not rendered by default.

outputs/US/costs_2035.csv

Lines changed: 2120 additions & 2120 deletions
Large diffs are not rendered by default.

outputs/US/costs_2040.csv

Lines changed: 2122 additions & 2122 deletions
Large diffs are not rendered by default.

outputs/US/costs_2045.csv

Lines changed: 2122 additions & 2122 deletions
Large diffs are not rendered by default.

outputs/US/costs_2050.csv

Lines changed: 2114 additions & 2114 deletions
Large diffs are not rendered by default.

scripts/compile_cost_assumptions_usa.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ def duplicate_fuel_cost(input_file_path: str, list_of_years: list) -> pd.DataFra
11041104
by=["technology", "parameter"]
11051105
).reset_index(drop=True)
11061106

1107-
# Correct for inflation for technology-parameter pairs having units that contain USD
1107+
# correct for inflation for technology-parameter pairs having units that contain USD
11081108
inflation_rate_series_usd = prepare_inflation_rate(
11091109
input_file_inflation_rate, "USD"
11101110
)
@@ -1123,13 +1123,19 @@ def duplicate_fuel_cost(input_file_path: str, list_of_years: list) -> pd.DataFra
11231123
)["value"]
11241124
)
11251125

1126+
# round the value column
1127+
rounded_df = inflation_adjusted_updated_cost_df.copy()
1128+
rounded_df.loc[:, "value"] = round(
1129+
inflation_adjusted_updated_cost_df.value.astype(float), num_digits
1130+
)
1131+
11261132
# output the modified cost dataframe
11271133
output_cost_path_list = [
11281134
path for path in snakemake.output if str(year_val) in path
11291135
]
11301136
if len(output_cost_path_list) == 1:
11311137
output_cost_path = output_cost_path_list[0]
1132-
inflation_adjusted_updated_cost_df.to_csv(output_cost_path, index=False)
1138+
rounded_df.to_csv(output_cost_path, index=False)
11331139
logger.info(
11341140
f"The cost assumptions file for the US has been compiled for year {year_val}"
11351141
)

0 commit comments

Comments
 (0)