Skip to content

Commit 64c3e6a

Browse files
[pre-commit.ci] pre-commit autoupdate (#268)
1 parent 6a322be commit 64c3e6a

File tree

3 files changed

+39
-33
lines changed

3 files changed

+39
-33
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
# Run ruff to lint and format
1818
- repo: https://github.com/astral-sh/ruff-pre-commit
1919
# Ruff version.
20-
rev: v0.14.10
20+
rev: v0.15.9
2121
hooks:
2222
# Run the linter.
2323
- id: ruff
@@ -27,7 +27,7 @@ repos:
2727

2828
# Find common spelling mistakes in comments and docstrings
2929
- repo: https://github.com/codespell-project/codespell
30-
rev: v2.4.1
30+
rev: v2.4.2
3131
hooks:
3232
- id: codespell
3333
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
@@ -36,14 +36,14 @@ repos:
3636

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

4545
# Format Snakemake rule / workflow files
4646
- repo: https://github.com/snakemake/snakefmt
47-
rev: v0.11.2
47+
rev: v1.0.0
4848
hooks:
4949
- id: snakefmt

Snakefile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ rule compile_cost_assumptions:
3030
manual_input="inputs/manual_input.csv",
3131
output:
3232
expand("outputs/costs_{year}.csv", year=config["years"]),
33+
log:
34+
pathlib.Path("logs", "compile_cost_assumptions.log"),
35+
conda:
36+
"environment.yaml"
3337
threads: 1
3438
resources:
3539
mem=500,
36-
conda:
37-
"environment.yaml"
38-
log:
39-
pathlib.Path("logs", "compile_cost_assumptions.log"),
4040
script:
4141
"scripts/compile_cost_assumptions.py"
4242

@@ -54,13 +54,13 @@ rule compile_cost_assumptions_usa:
5454
nrel_atb_input_fuel_costs="inputs/US/fuel_costs_usa.csv",
5555
output:
5656
expand("outputs/US/costs_{year}.csv", year=config["years"]),
57+
log:
58+
pathlib.Path("logs", "compile_cost_assumptions_usa.log"),
59+
conda:
60+
"environment.yaml"
5761
threads: 1
5862
resources:
5963
mem=500,
60-
conda:
61-
"environment.yaml"
62-
log:
63-
pathlib.Path("logs", "compile_cost_assumptions_usa.log"),
6464
script:
6565
"scripts/compile_cost_assumptions_usa.py"
6666

@@ -82,20 +82,20 @@ rule convert_EWG:
8282
EWG="docu/EWG_LUT_100RE_All_Sectors_Global_Report_2019.pdf",
8383
output:
8484
costs="inputs/EWG_costs.csv",
85+
conda:
86+
"environment.yaml"
8587
threads: 1
8688
resources:
8789
mem=500,
88-
conda:
89-
"environment.yaml"
9090
script:
9191
"scripts/convert_pdf_EWG_to_dataframe.py"
9292

9393

9494
rule all:
95+
default_target: True
9596
input:
9697
rules.compile_cost_assumptions.output,
9798
rules.compile_cost_assumptions_usa.output,
98-
default_target: True
9999

100100

101101
rule purge:

scripts/compile_cost_assumptions_usa.py

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -774,49 +774,55 @@ def pre_process_atb_input_file(
774774

775775
# Modify the unit of the normalized Fixed O&M to %/yr
776776
atb_input_df["units"] = atb_input_df.apply(
777-
lambda x: "%/year"
778-
if x["core_metric_parameter"].casefold() == "fixed o&m"
779-
else x["units"],
777+
lambda x: (
778+
"%/year"
779+
if x["core_metric_parameter"].casefold() == "fixed o&m"
780+
else x["units"]
781+
),
780782
axis=1,
781783
)
782784

783785
# Modify the unit of CF to per unit
784786
atb_input_df["units"] = atb_input_df.apply(
785-
lambda x: "per unit"
786-
if x["core_metric_parameter"].casefold() == "cf"
787-
else x["units"],
787+
lambda x: (
788+
"per unit" if x["core_metric_parameter"].casefold() == "cf" else x["units"]
789+
),
788790
axis=1,
789791
)
790792

791793
# Modify the unit of Additional OCC to USD/kW instead of $/kW
792794
atb_input_df["units"] = atb_input_df.apply(
793-
lambda x: "USD/kW"
794-
if x["core_metric_parameter"].casefold() == "additional occ"
795-
else x["units"],
795+
lambda x: (
796+
"USD/kW"
797+
if x["core_metric_parameter"].casefold() == "additional occ"
798+
else x["units"]
799+
),
796800
axis=1,
797801
)
798802

799803
# Modify the unit of CAPEX to USD/kW instead of $/kW
800804
atb_input_df["units"] = atb_input_df.apply(
801-
lambda x: "USD/kW"
802-
if x["core_metric_parameter"].casefold() == "capex"
803-
else x["units"],
805+
lambda x: (
806+
"USD/kW" if x["core_metric_parameter"].casefold() == "capex" else x["units"]
807+
),
804808
axis=1,
805809
)
806810

807811
# Modify the unit of Variable O&M to USD/MWh instead of $/MWh
808812
atb_input_df["units"] = atb_input_df.apply(
809-
lambda x: "USD/MWh"
810-
if x["core_metric_parameter"].casefold() == "variable o&m"
811-
else x["units"],
813+
lambda x: (
814+
"USD/MWh"
815+
if x["core_metric_parameter"].casefold() == "variable o&m"
816+
else x["units"]
817+
),
812818
axis=1,
813819
)
814820

815821
# Modify the unit of Fuel cost O&M to USD/MWh instead of $/MWh
816822
atb_input_df["units"] = atb_input_df.apply(
817-
lambda x: "USD/MWh"
818-
if x["core_metric_parameter"].casefold() == "fuel"
819-
else x["units"],
823+
lambda x: (
824+
"USD/MWh" if x["core_metric_parameter"].casefold() == "fuel" else x["units"]
825+
),
820826
axis=1,
821827
)
822828

0 commit comments

Comments
 (0)