Skip to content

Commit 8fda1ef

Browse files
authored
Merge pull request #11 from modelblocks-org/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2 parents d5a729b + 2a0ab24 commit 8fda1ef

6 files changed

Lines changed: 48 additions & 48 deletions

File tree

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@ repos:
2525

2626
# Python file formatting
2727
- repo: https://github.com/astral-sh/ruff-pre-commit
28-
rev: v0.15.4
28+
rev: v0.15.9
2929
hooks:
3030
- id: ruff
3131
args: [--fix, --exit-non-zero-on-fix]
3232
- id: ruff-format
3333

3434
# Snakemake file formatting
3535
- repo: https://github.com/snakemake/snakefmt
36-
rev: v0.11.4
36+
rev: v1.0.0
3737
hooks:
3838
- id: snakefmt
3939

4040
# Spelling
4141
- repo: https://github.com/codespell-project/codespell
42-
rev: v2.4.1
42+
rev: v2.4.2
4343
hooks:
4444
- id: codespell
4545
files: .*\.(py|smk|md)$|^Snakefile$

tests/integration/Snakefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ with open(workflow.source_path("../../config/config.yaml"), "r") as f:
1111
# `config`: specifies the module configuration.
1212
# `pathvars:` helps you re-wire where the module places files.
1313
module module_co2stop_cdr:
14-
snakefile:
15-
"../../workflow/Snakefile"
16-
config:
17-
module_config["module_co2stop_cdr"]
1814
pathvars:
1915
# Redirect specific user resources (inputs)
2016
user_shapes="resources/inputs/{shapes}/shapes.parquet",
@@ -25,6 +21,10 @@ module module_co2stop_cdr:
2521
logs="resources/co2stop_cdr/logs",
2622
resources="resources/co2stop_cdr/resources",
2723
results="resources/co2stop_cdr/results",
24+
snakefile:
25+
"../../workflow/Snakefile"
26+
config:
27+
module_config["module_co2stop_cdr"]
2828

2929

3030
# rename all module rules with a prefix, to avoid naming conflicts.
@@ -36,8 +36,8 @@ FILES = ["aquifer"]
3636

3737
# Request something from the module
3838
rule all:
39-
message:
40-
"A generic test case for your module."
4139
default_target: True
4240
input:
4341
expand("results/outputs/BALK/medium/{cdr}.parquet", cdr=FILES),
42+
message:
43+
"A generic test case for your module."

workflow/Snakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ workflow.source_path("scripts/_utils.py")
4343

4444

4545
rule all:
46-
message:
47-
"ERROR: Invalid `rule all:` call"
4846
default_target: True
4947
output:
5048
"INVALID",
5149
log:
5250
stderr="<logs>/all.stderr",
5351
conda:
5452
"envs/shell.yaml"
53+
message:
54+
"ERROR: Invalid `rule all:` call"
5555
shell:
5656
'echo "This workflow must be called as a snakemake module." > {log.stderr}'

workflow/rules/aggregate.smk

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22

33

44
rule aggregate_co2stop:
5-
message:
6-
"Aggregating '{wildcards.shapes}-{wildcards.scenario}-{wildcards.cdr_group}'."
7-
params:
8-
bounds_mtco2=lambda wc: config["imputation"]["aggregated"][wc.cdr_group][
9-
"bounds_mtco2"
10-
],
11-
proj_crs=config["crs"]["projected"],
125
input:
136
shapes="<user_shapes>",
147
storage_units=rules.prepare_co2stop_storage_units.output.mtco2,
@@ -28,15 +21,18 @@ rule aggregate_co2stop:
2821
cdr_group="|".join(CDR_GROUP),
2922
conda:
3023
"../envs/co2stop.yaml"
24+
params:
25+
bounds_mtco2=lambda wc: config["imputation"]["aggregated"][wc.cdr_group][
26+
"bounds_mtco2"
27+
],
28+
proj_crs=config["crs"]["projected"],
29+
message:
30+
"Aggregating '{wildcards.shapes}-{wildcards.scenario}-{wildcards.cdr_group}'."
3131
script:
3232
"../scripts/aggregate_co2stop.py"
3333

3434

3535
rule aggregate_totals:
36-
message:
37-
"Aggregating totals for '{wildcards.shapes}-{wildcards.scenario}'."
38-
params:
39-
proj_crs=config["crs"]["projected"],
4036
input:
4137
shapes="<user_shapes>",
4238
aggregates=lambda wc: expand(
@@ -59,5 +55,9 @@ rule aggregate_totals:
5955
scenario="|".join(["low", "medium", "high"]),
6056
conda:
6157
"../envs/co2stop.yaml"
58+
params:
59+
proj_crs=config["crs"]["projected"],
60+
message:
61+
"Aggregating totals for '{wildcards.shapes}-{wildcards.scenario}'."
6262
script:
6363
"../scripts/aggregate_totals.py"

workflow/rules/automatic.smk

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,21 @@
22

33

44
rule download_co2stop:
5-
message:
6-
"Downloading the open CO2Stop dataset."
7-
params:
8-
url=internal["resources"]["automatic"]["co2stop"],
95
output:
106
zipfile="<resources>/automatic/co2stop.zip",
117
log:
128
"<logs>/download_co2stop.log",
139
conda:
1410
"../envs/shell.yaml"
11+
params:
12+
url=internal["resources"]["automatic"]["co2stop"],
13+
message:
14+
"Downloading the open CO2Stop dataset."
1515
shell:
1616
"curl -sSLo {output.zipfile:q} {params.url:q}"
1717

1818

1919
rule unzip_co2stop:
20-
message:
21-
"Unzipping necessary data from the CO2Stop file."
22-
params:
23-
storage_data="CO2Stop_DataInterrogationSystem/Hydrocarbon_Storage_Units.csv",
24-
storage_map="CO2Stop_Polygons Data/StorageUnits_March13.kml",
25-
traps_data="CO2Stop_DataInterrogationSystem/Hydrocarbon_Traps.csv",
26-
traps_map="CO2Stop_Polygons Data/DaughterUnits_March13.kml",
27-
country_map="CO2Stop_Polygons Data/Basemap.kml",
2820
input:
2921
zipfile=rules.download_co2stop.output.zipfile,
3022
output:
@@ -37,5 +29,13 @@ rule unzip_co2stop:
3729
"<logs>/automatic/unzip_co2stop.log",
3830
conda:
3931
"../envs/co2stop.yaml"
32+
params:
33+
storage_data="CO2Stop_DataInterrogationSystem/Hydrocarbon_Storage_Units.csv",
34+
storage_map="CO2Stop_Polygons Data/StorageUnits_March13.kml",
35+
traps_data="CO2Stop_DataInterrogationSystem/Hydrocarbon_Traps.csv",
36+
traps_map="CO2Stop_Polygons Data/DaughterUnits_March13.kml",
37+
country_map="CO2Stop_Polygons Data/Basemap.kml",
38+
message:
39+
"Unzipping necessary data from the CO2Stop file."
4040
script:
4141
"../scripts/unzip_co2stop.py"

workflow/rules/prepare.smk

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@ CDR_GROUP = ["aquifer", "gas", "oil"]
44

55

66
rule prepare_co2stop_storage_units:
7-
message:
8-
"Harmonising CO2Stop storage units: aquifer."
9-
params:
10-
cdr_group="aquifer",
11-
cdr_group_config=lambda wc: config["imputation"]["co2stop"]["aquifer"],
12-
dataset="storage_units",
13-
geo_crs=config["crs"]["geographic"],
147
input:
158
table=rules.unzip_co2stop.output.storage_data,
169
polygons=rules.unzip_co2stop.output.storage_map,
@@ -33,18 +26,18 @@ rule prepare_co2stop_storage_units:
3326
"<logs>/storage_units/aquifer/prepare_co2stop.log",
3427
conda:
3528
"../envs/co2stop.yaml"
29+
params:
30+
cdr_group="aquifer",
31+
cdr_group_config=lambda wc: config["imputation"]["co2stop"]["aquifer"],
32+
dataset="storage_units",
33+
geo_crs=config["crs"]["geographic"],
34+
message:
35+
"Harmonising CO2Stop storage units: aquifer."
3636
script:
3737
"../scripts/prepare_co2stop.py"
3838

3939

4040
rule prepare_co2stop_traps:
41-
message:
42-
"Harmonising CO2Stop traps: {wildcards.cdr_group}."
43-
params:
44-
cdr_group=lambda wc: wc.cdr_group,
45-
cdr_group_config=lambda wc: config["imputation"]["co2stop"][wc.cdr_group],
46-
dataset="traps",
47-
geo_crs=config["crs"]["geographic"],
4841
input:
4942
table=rules.unzip_co2stop.output.traps_data,
5043
polygons=rules.unzip_co2stop.output.traps_map,
@@ -69,5 +62,12 @@ rule prepare_co2stop_traps:
6962
cdr_group="|".join(CDR_GROUP),
7063
conda:
7164
"../envs/co2stop.yaml"
65+
params:
66+
cdr_group=lambda wc: wc.cdr_group,
67+
cdr_group_config=lambda wc: config["imputation"]["co2stop"][wc.cdr_group],
68+
dataset="traps",
69+
geo_crs=config["crs"]["geographic"],
70+
message:
71+
"Harmonising CO2Stop traps: {wildcards.cdr_group}."
7272
script:
7373
"../scripts/prepare_co2stop.py"

0 commit comments

Comments
 (0)