Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
# Run ruff to lint and format
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.14.10
rev: v0.15.9
hooks:
# Run the linter.
- id: ruff
Expand All @@ -27,7 +27,7 @@ repos:

# Find common spelling mistakes in comments and docstrings
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
rev: v2.4.2
hooks:
- id: codespell
args: ['--ignore-regex="(\b[A-Z]+\b)"', '--ignore-words-list=fom,appartment,bage,ore,setis,tabacco,berfore,vor,pris,WEGE,Wege,Eletricity'] # Ignore capital case words, e.g. country codes
Expand All @@ -36,14 +36,14 @@ repos:

# YAML formatting
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.15.0
rev: v2.16.0
hooks:
- id: pretty-format-yaml
exclude: pinned\.yaml$
args: [--autofix, --indent, "2", --preserve-quotes]

# Format Snakemake rule / workflow files
- repo: https://github.com/snakemake/snakefmt
rev: v0.11.2
rev: v1.0.0
hooks:
- id: snakefmt
22 changes: 11 additions & 11 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ rule compile_cost_assumptions:
manual_input="inputs/manual_input.csv",
output:
expand("outputs/costs_{year}.csv", year=config["years"]),
log:
pathlib.Path("logs", "compile_cost_assumptions.log"),
conda:
"environment.yaml"
threads: 1
resources:
mem=500,
conda:
"environment.yaml"
log:
pathlib.Path("logs", "compile_cost_assumptions.log"),
script:
"scripts/compile_cost_assumptions.py"

Expand All @@ -54,13 +54,13 @@ rule compile_cost_assumptions_usa:
nrel_atb_input_fuel_costs="inputs/US/fuel_costs_usa.csv",
output:
expand("outputs/US/costs_{year}.csv", year=config["years"]),
log:
pathlib.Path("logs", "compile_cost_assumptions_usa.log"),
conda:
"environment.yaml"
threads: 1
resources:
mem=500,
conda:
"environment.yaml"
log:
pathlib.Path("logs", "compile_cost_assumptions_usa.log"),
script:
"scripts/compile_cost_assumptions_usa.py"

Expand All @@ -82,20 +82,20 @@ rule convert_EWG:
EWG="docu/EWG_LUT_100RE_All_Sectors_Global_Report_2019.pdf",
output:
costs="inputs/EWG_costs.csv",
conda:
"environment.yaml"
threads: 1
resources:
mem=500,
conda:
"environment.yaml"
script:
"scripts/convert_pdf_EWG_to_dataframe.py"


rule all:
default_target: True
input:
rules.compile_cost_assumptions.output,
rules.compile_cost_assumptions_usa.output,
default_target: True


rule purge:
Expand Down
42 changes: 24 additions & 18 deletions scripts/compile_cost_assumptions_usa.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,49 +774,55 @@ def pre_process_atb_input_file(

# Modify the unit of the normalized Fixed O&M to %/yr
atb_input_df["units"] = atb_input_df.apply(
lambda x: "%/year"
if x["core_metric_parameter"].casefold() == "fixed o&m"
else x["units"],
lambda x: (
"%/year"
if x["core_metric_parameter"].casefold() == "fixed o&m"
else x["units"]
),
axis=1,
)

# Modify the unit of CF to per unit
atb_input_df["units"] = atb_input_df.apply(
lambda x: "per unit"
if x["core_metric_parameter"].casefold() == "cf"
else x["units"],
lambda x: (
"per unit" if x["core_metric_parameter"].casefold() == "cf" else x["units"]
),
axis=1,
)

# Modify the unit of Additional OCC to USD/kW instead of $/kW
atb_input_df["units"] = atb_input_df.apply(
lambda x: "USD/kW"
if x["core_metric_parameter"].casefold() == "additional occ"
else x["units"],
lambda x: (
"USD/kW"
if x["core_metric_parameter"].casefold() == "additional occ"
else x["units"]
),
axis=1,
)

# Modify the unit of CAPEX to USD/kW instead of $/kW
atb_input_df["units"] = atb_input_df.apply(
lambda x: "USD/kW"
if x["core_metric_parameter"].casefold() == "capex"
else x["units"],
lambda x: (
"USD/kW" if x["core_metric_parameter"].casefold() == "capex" else x["units"]
),
axis=1,
)

# Modify the unit of Variable O&M to USD/MWh instead of $/MWh
atb_input_df["units"] = atb_input_df.apply(
lambda x: "USD/MWh"
if x["core_metric_parameter"].casefold() == "variable o&m"
else x["units"],
lambda x: (
"USD/MWh"
if x["core_metric_parameter"].casefold() == "variable o&m"
else x["units"]
),
axis=1,
)

# Modify the unit of Fuel cost O&M to USD/MWh instead of $/MWh
atb_input_df["units"] = atb_input_df.apply(
lambda x: "USD/MWh"
if x["core_metric_parameter"].casefold() == "fuel"
else x["units"],
lambda x: (
"USD/MWh" if x["core_metric_parameter"].casefold() == "fuel" else x["units"]
),
axis=1,
)

Expand Down
Loading