From b8740cf6e2c9cd4dfd674f4c47726899c1aa3120 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2026 17:42:00 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.15.4 → v0.15.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.15.4...v0.15.9) - [github.com/snakemake/snakefmt: v0.11.4 → v1.0.0](https://github.com/snakemake/snakefmt/compare/v0.11.4...v1.0.0) - [github.com/codespell-project/codespell: v2.4.1 → v2.4.2](https://github.com/codespell-project/codespell/compare/v2.4.1...v2.4.2) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8639e62..10954ae 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,7 @@ repos: # Python file formatting - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.15.4 + rev: v0.15.9 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] @@ -33,13 +33,13 @@ repos: # Snakemake file formatting - repo: https://github.com/snakemake/snakefmt - rev: v0.11.4 + rev: v1.0.0 hooks: - id: snakefmt # Spelling - repo: https://github.com/codespell-project/codespell - rev: v2.4.1 + rev: v2.4.2 hooks: - id: codespell files: .*\.(py|smk|md)$|^Snakefile$ From 2a0ab24a8d0db3c6c4fd7360601114bfb6d02e00 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2026 17:44:31 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/integration/Snakefile | 12 ++++++------ workflow/Snakefile | 4 ++-- workflow/rules/aggregate.smk | 22 +++++++++++----------- workflow/rules/automatic.smk | 24 ++++++++++++------------ workflow/rules/prepare.smk | 28 ++++++++++++++-------------- 5 files changed, 45 insertions(+), 45 deletions(-) diff --git a/tests/integration/Snakefile b/tests/integration/Snakefile index ad26532..c0a788c 100644 --- a/tests/integration/Snakefile +++ b/tests/integration/Snakefile @@ -11,10 +11,6 @@ with open(workflow.source_path("../../config/config.yaml"), "r") as f: # `config`: specifies the module configuration. # `pathvars:` helps you re-wire where the module places files. module module_co2stop_cdr: - snakefile: - "../../workflow/Snakefile" - config: - module_config["module_co2stop_cdr"] pathvars: # Redirect specific user resources (inputs) user_shapes="resources/inputs/{shapes}/shapes.parquet", @@ -25,6 +21,10 @@ module module_co2stop_cdr: logs="resources/co2stop_cdr/logs", resources="resources/co2stop_cdr/resources", results="resources/co2stop_cdr/results", + snakefile: + "../../workflow/Snakefile" + config: + module_config["module_co2stop_cdr"] # rename all module rules with a prefix, to avoid naming conflicts. @@ -36,8 +36,8 @@ FILES = ["aquifer"] # Request something from the module rule all: - message: - "A generic test case for your module." default_target: True input: expand("results/outputs/BALK/medium/{cdr}.parquet", cdr=FILES), + message: + "A generic test case for your module." diff --git a/workflow/Snakefile b/workflow/Snakefile index fcc36fc..1b9839f 100644 --- a/workflow/Snakefile +++ b/workflow/Snakefile @@ -43,8 +43,6 @@ workflow.source_path("scripts/_utils.py") rule all: - message: - "ERROR: Invalid `rule all:` call" default_target: True output: "INVALID", @@ -52,5 +50,7 @@ rule all: stderr="/all.stderr", conda: "envs/shell.yaml" + message: + "ERROR: Invalid `rule all:` call" shell: 'echo "This workflow must be called as a snakemake module." > {log.stderr}' diff --git a/workflow/rules/aggregate.smk b/workflow/rules/aggregate.smk index 1d0a556..67b078e 100644 --- a/workflow/rules/aggregate.smk +++ b/workflow/rules/aggregate.smk @@ -2,13 +2,6 @@ rule aggregate_co2stop: - message: - "Aggregating '{wildcards.shapes}-{wildcards.scenario}-{wildcards.cdr_group}'." - params: - bounds_mtco2=lambda wc: config["imputation"]["aggregated"][wc.cdr_group][ - "bounds_mtco2" - ], - proj_crs=config["crs"]["projected"], input: shapes="", storage_units=rules.prepare_co2stop_storage_units.output.mtco2, @@ -28,15 +21,18 @@ rule aggregate_co2stop: cdr_group="|".join(CDR_GROUP), conda: "../envs/co2stop.yaml" + params: + bounds_mtco2=lambda wc: config["imputation"]["aggregated"][wc.cdr_group][ + "bounds_mtco2" + ], + proj_crs=config["crs"]["projected"], + message: + "Aggregating '{wildcards.shapes}-{wildcards.scenario}-{wildcards.cdr_group}'." script: "../scripts/aggregate_co2stop.py" rule aggregate_totals: - message: - "Aggregating totals for '{wildcards.shapes}-{wildcards.scenario}'." - params: - proj_crs=config["crs"]["projected"], input: shapes="", aggregates=lambda wc: expand( @@ -59,5 +55,9 @@ rule aggregate_totals: scenario="|".join(["low", "medium", "high"]), conda: "../envs/co2stop.yaml" + params: + proj_crs=config["crs"]["projected"], + message: + "Aggregating totals for '{wildcards.shapes}-{wildcards.scenario}'." script: "../scripts/aggregate_totals.py" diff --git a/workflow/rules/automatic.smk b/workflow/rules/automatic.smk index ed622b8..cf3496d 100644 --- a/workflow/rules/automatic.smk +++ b/workflow/rules/automatic.smk @@ -2,29 +2,21 @@ rule download_co2stop: - message: - "Downloading the open CO2Stop dataset." - params: - url=internal["resources"]["automatic"]["co2stop"], output: zipfile="/automatic/co2stop.zip", log: "/download_co2stop.log", conda: "../envs/shell.yaml" + params: + url=internal["resources"]["automatic"]["co2stop"], + message: + "Downloading the open CO2Stop dataset." shell: "curl -sSLo {output.zipfile:q} {params.url:q}" rule unzip_co2stop: - message: - "Unzipping necessary data from the CO2Stop file." - params: - storage_data="CO2Stop_DataInterrogationSystem/Hydrocarbon_Storage_Units.csv", - storage_map="CO2Stop_Polygons Data/StorageUnits_March13.kml", - traps_data="CO2Stop_DataInterrogationSystem/Hydrocarbon_Traps.csv", - traps_map="CO2Stop_Polygons Data/DaughterUnits_March13.kml", - country_map="CO2Stop_Polygons Data/Basemap.kml", input: zipfile=rules.download_co2stop.output.zipfile, output: @@ -37,5 +29,13 @@ rule unzip_co2stop: "/automatic/unzip_co2stop.log", conda: "../envs/co2stop.yaml" + params: + storage_data="CO2Stop_DataInterrogationSystem/Hydrocarbon_Storage_Units.csv", + storage_map="CO2Stop_Polygons Data/StorageUnits_March13.kml", + traps_data="CO2Stop_DataInterrogationSystem/Hydrocarbon_Traps.csv", + traps_map="CO2Stop_Polygons Data/DaughterUnits_March13.kml", + country_map="CO2Stop_Polygons Data/Basemap.kml", + message: + "Unzipping necessary data from the CO2Stop file." script: "../scripts/unzip_co2stop.py" diff --git a/workflow/rules/prepare.smk b/workflow/rules/prepare.smk index 3d1e0ae..13ac0c1 100644 --- a/workflow/rules/prepare.smk +++ b/workflow/rules/prepare.smk @@ -4,13 +4,6 @@ CDR_GROUP = ["aquifer", "gas", "oil"] rule prepare_co2stop_storage_units: - message: - "Harmonising CO2Stop storage units: aquifer." - params: - cdr_group="aquifer", - cdr_group_config=lambda wc: config["imputation"]["co2stop"]["aquifer"], - dataset="storage_units", - geo_crs=config["crs"]["geographic"], input: table=rules.unzip_co2stop.output.storage_data, polygons=rules.unzip_co2stop.output.storage_map, @@ -33,18 +26,18 @@ rule prepare_co2stop_storage_units: "/storage_units/aquifer/prepare_co2stop.log", conda: "../envs/co2stop.yaml" + params: + cdr_group="aquifer", + cdr_group_config=lambda wc: config["imputation"]["co2stop"]["aquifer"], + dataset="storage_units", + geo_crs=config["crs"]["geographic"], + message: + "Harmonising CO2Stop storage units: aquifer." script: "../scripts/prepare_co2stop.py" rule prepare_co2stop_traps: - message: - "Harmonising CO2Stop traps: {wildcards.cdr_group}." - params: - cdr_group=lambda wc: wc.cdr_group, - cdr_group_config=lambda wc: config["imputation"]["co2stop"][wc.cdr_group], - dataset="traps", - geo_crs=config["crs"]["geographic"], input: table=rules.unzip_co2stop.output.traps_data, polygons=rules.unzip_co2stop.output.traps_map, @@ -69,5 +62,12 @@ rule prepare_co2stop_traps: cdr_group="|".join(CDR_GROUP), conda: "../envs/co2stop.yaml" + params: + cdr_group=lambda wc: wc.cdr_group, + cdr_group_config=lambda wc: config["imputation"]["co2stop"][wc.cdr_group], + dataset="traps", + geo_crs=config["crs"]["geographic"], + message: + "Harmonising CO2Stop traps: {wildcards.cdr_group}." script: "../scripts/prepare_co2stop.py"