Skip to content

Commit ebb9b69

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 8bbd19e commit ebb9b69

4 files changed

Lines changed: 76 additions & 76 deletions

File tree

tests/integration/Snakefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,36 @@ configfile: workflow.source_path("./test_config.yaml")
33

44

55
rule download_netherlands_shapes:
6-
message:
7-
"Download and unzip the Netherlands shapes."
86
output:
97
"results/integration_test/resources/user/shapes/NLD.parquet",
108
log:
119
"results/integration_test/logs/download_netherlands_shapes.log",
1210
conda:
1311
"../../workflow/envs/shell.yaml"
12+
message:
13+
"Download and unzip the Netherlands shapes."
1414
shell:
1515
"""
1616
curl -sSLo {output:q} "https://zenodo.org/records/16684683/files/NLD.parquet"
1717
"""
1818

1919

2020
rule download_netherlands_protected_areas:
21-
message:
22-
"Download a dummy drop-in dataset for Netherlands protected areas (not based on WDPA)."
2321
output:
2422
"results/integration_test/resources/user/wdpa.gdb.zip",
2523
log:
2624
"results/integration_test/logs/download_netherlands_protected_areas.log",
2725
conda:
2826
"../../workflow/envs/shell.yaml"
27+
message:
28+
"Download a dummy drop-in dataset for Netherlands protected areas (not based on WDPA)."
2929
shell:
3030
"""
3131
curl -sSLo {output:q} "https://zenodo.org/records/16684513/files/wdpa-nl-dropin.gdb.zip"
3232
"""
3333

3434

3535
rule unzip_netherlands_protected_areas:
36-
message:
37-
"Download protected areas data."
3836
input:
3937
script=workflow.source_path("../../workflow/scripts/unzip_like.py"),
4038
zipfile=rules.download_netherlands_protected_areas.output,
@@ -44,6 +42,8 @@ rule unzip_netherlands_protected_areas:
4442
"results/integration_test/logs/unzip_netherlands_protected_areas.log",
4543
conda:
4644
"../../workflow/envs/shell.yaml"
45+
message:
46+
"Download protected areas data."
4747
shell:
4848
"""
4949
python {input.script:q} {input.zipfile:q} -t "results/integration_test/resources/user/" 2> {log:q}
@@ -68,10 +68,10 @@ use rule * from module_area_potentials as module_area_potentials_*
6868

6969
# Request something from the module
7070
rule all:
71-
message:
72-
"Run the module for the Netherlands shapes."
7371
default_target: True
7472
input:
7573
"results/integration_test/resources/user/shapes/NLD.parquet",
7674
"results/integration_test/resources/user/wdpa.gdb",
7775
"results/integration_test/results/NLD/area_potential_report.html",
76+
message:
77+
"Run the module for the Netherlands shapes."

workflow/Snakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ include: "rules/process.smk"
3535

3636

3737
rule all:
38-
message:
39-
"ERROR: Invalid `rule all:` call"
4038
default_target: True
4139
output:
4240
"INVALID",
4341
log:
4442
stderr="logs/all.stderr",
4543
conda:
4644
"envs/shell.yaml"
45+
message:
46+
"ERROR: Invalid `rule all:` call"
4747
shell:
4848
'echo "This workflow must be called as a snakemake module." > {log.stderr}'

workflow/rules/automatic.smk

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,30 @@ if config.get("tiny_files", False):
77
##
88

99
rule clip_slope:
10-
message:
11-
"Download slope data covering the bounds of the input shapefile."
12-
params:
13-
cog_url=internal["resources"]["automatic"]["slope"],
1410
input:
1511
vector="resources/user/shapes/{shape}.parquet",
1612
output:
1713
path="resources/automatic/cutout/{shape}/slope.tif",
1814
log:
1915
"logs/{shape}/clip_slope.log",
16+
params:
17+
cog_url=internal["resources"]["automatic"]["slope"],
18+
message:
19+
"Download slope data covering the bounds of the input shapefile."
2020
wrapper:
2121
"v7.2.0/geo/rasterio/clip-geotiff"
2222

2323
rule clip_bathymetry:
24-
message:
25-
"Download bathymetry data covering the bounds of the input shapefile."
26-
params:
27-
cog_url=internal["resources"]["automatic"]["bathymetry"],
2824
input:
2925
vector="resources/user/shapes/{shape}.parquet",
3026
output:
3127
path="resources/automatic/cutout/{shape}/bathymetry.tif",
3228
log:
3329
"logs/{shape}/clip_bathymetry.log",
30+
params:
31+
cog_url=internal["resources"]["automatic"]["bathymetry"],
32+
message:
33+
"Download bathymetry data covering the bounds of the input shapefile."
3434
wrapper:
3535
"v7.2.0/geo/rasterio/clip-geotiff"
3636

@@ -41,40 +41,38 @@ else:
4141
##
4242

4343
rule download_slope:
44-
message:
45-
"Download global slope data."
46-
params:
47-
url=internal["resources"]["automatic"]["slope"],
4844
output:
4945
path="resources/automatic/global/slope.tif",
5046
log:
5147
"logs/download_slope.log",
5248
conda:
5349
"../envs/shell.yaml"
50+
params:
51+
url=internal["resources"]["automatic"]["slope"],
52+
message:
53+
"Download global slope data."
5454
shell:
5555
"""
5656
curl -sSLo {output:q} {params.url:q}
5757
"""
5858

5959
rule download_bathymetry:
60-
message:
61-
"Download global bathymetry data."
62-
params:
63-
url=internal["resources"]["automatic"]["bathymetry"],
6460
output:
6561
path="resources/automatic/global/bathymetry.tif",
6662
log:
6763
"logs/download_bathymetry.log",
6864
conda:
6965
"../envs/shell.yaml"
66+
params:
67+
url=internal["resources"]["automatic"]["bathymetry"],
68+
message:
69+
"Download global bathymetry data."
7070
shell:
7171
"""
7272
curl -sSLo {output:q} {params.url:q}
7373
"""
7474

7575
rule clip_slope:
76-
message:
77-
"Cut slope data to the bounds of the input shapefile."
7876
input:
7977
script=workflow.source_path("../scripts/clip_raster.py"),
8078
shapes="resources/user/shapes/{shape}.parquet",
@@ -85,14 +83,14 @@ else:
8583
"logs/{shape}/clip_slope.log",
8684
conda:
8785
"../envs/default.yaml"
86+
message:
87+
"Cut slope data to the bounds of the input shapefile."
8888
shell:
8989
"""
9090
python {input.script:q} {input.slope:q} {input.shapes:q} {output:q} 2> {log:q}
9191
"""
9292

9393
rule clip_bathymetry:
94-
message:
95-
"Cut bathymetry data to the bounds of the input shapefile."
9694
input:
9795
script=workflow.source_path("../scripts/clip_raster.py"),
9896
shapes="resources/user/shapes/{shape}.parquet",
@@ -103,6 +101,8 @@ else:
103101
"logs/{shape}/clip_bathymetry.log",
104102
conda:
105103
"../envs/default.yaml"
104+
message:
105+
"Cut bathymetry data to the bounds of the input shapefile."
106106
shell:
107107
"""
108108
python {input.script:q} {input.bathymetry:q} {input.shapes:q} {output:q} 2> {log:q}
@@ -115,27 +115,23 @@ else:
115115

116116

117117
rule download_globcover:
118-
message:
119-
"Download the GlobCover land cover data (~380 MB)."
120-
params:
121-
url=internal["resources"]["automatic"]["globcover"],
122118
output:
123119
"resources/automatic/global/globcover.zip",
124120
log:
125121
"logs/download_globcover.log",
126122
conda:
127123
"../envs/shell.yaml"
124+
params:
125+
url=internal["resources"]["automatic"]["globcover"],
126+
message:
127+
"Download the GlobCover land cover data (~380 MB)."
128128
shell:
129129
"""
130130
curl -sSLo {output:q} {params.url:q}
131131
"""
132132

133133

134134
rule unzip_globcover:
135-
message:
136-
"Unzip the relevant TIF files from the GlobCover zip file."
137-
params:
138-
target_file=internal["resources"]["automatic"]["globcover_landcover_tif"],
139135
input:
140136
script=workflow.source_path("../scripts/unzip_like.py"),
141137
zipfile=rules.download_globcover.output,
@@ -145,15 +141,17 @@ rule unzip_globcover:
145141
"logs/unzip_globcover.log",
146142
conda:
147143
"../envs/shell.yaml"
144+
params:
145+
target_file=internal["resources"]["automatic"]["globcover_landcover_tif"],
146+
message:
147+
"Unzip the relevant TIF files from the GlobCover zip file."
148148
shell:
149149
"""
150150
python {input.script:q} {input.zipfile:q} -f {params.target_file:q} -o {output:q} 2> {log:q}
151151
"""
152152

153153

154154
rule clip_landcover:
155-
message:
156-
"Cut land cover data to the bounds of the input shapefile."
157155
input:
158156
script=workflow.source_path("../scripts/clip_raster.py"),
159157
shapes="resources/user/shapes/{shape}.parquet",
@@ -164,6 +162,8 @@ rule clip_landcover:
164162
"logs/{shape}/clip_landcover.log",
165163
conda:
166164
"../envs/default.yaml"
165+
message:
166+
"Cut land cover data to the bounds of the input shapefile."
167167
shell:
168168
"""
169169
python {input.script:q} {input.landcover:q} {input.shapes:q} {output:q} 2> {log:q}
@@ -176,27 +176,23 @@ rule clip_landcover:
176176

177177

178178
rule download_ghsl:
179-
message:
180-
"Download the GHSL (Global Human Settlement Layer) built-up surface data."
181-
params:
182-
url=internal["resources"]["automatic"]["ghsl"],
183179
output:
184180
"resources/automatic/global/ghsl_built_s.zip",
185181
log:
186182
"logs/download_ghsl.log",
187183
conda:
188184
"../envs/shell.yaml"
185+
params:
186+
url=internal["resources"]["automatic"]["ghsl"],
187+
message:
188+
"Download the GHSL (Global Human Settlement Layer) built-up surface data."
189189
shell:
190190
"""
191191
curl -sSLo {output:q} {params.url:q}
192192
"""
193193

194194

195195
rule unzip_ghsl:
196-
message:
197-
"Unzip the relevant TIF file from the GHSL data."
198-
params:
199-
target_file=internal["resources"]["automatic"]["ghsl_tif"],
200196
input:
201197
script=workflow.source_path("../scripts/unzip_like.py"),
202198
zipfile=rules.download_ghsl.output,
@@ -206,15 +202,17 @@ rule unzip_ghsl:
206202
"logs/unzip_ghsl.log",
207203
conda:
208204
"../envs/shell.yaml"
205+
params:
206+
target_file=internal["resources"]["automatic"]["ghsl_tif"],
207+
message:
208+
"Unzip the relevant TIF file from the GHSL data."
209209
shell:
210210
"""
211211
python {input.script:q} {input.zipfile:q} -f {params.target_file:q} -o {output:q} 2> {log:q}
212212
"""
213213

214214

215215
rule clip_settlement:
216-
message:
217-
"Cut settlement data to the bounds of the input shapefile."
218216
input:
219217
script=workflow.source_path("../scripts/clip_raster.py"),
220218
shapes="resources/user/shapes/{shape}.parquet",
@@ -225,6 +223,8 @@ rule clip_settlement:
225223
"logs/{shape}/clip_settlement.log",
226224
conda:
227225
"../envs/default.yaml"
226+
message:
227+
"Cut settlement data to the bounds of the input shapefile."
228228
shell:
229229
"""
230230
python {input.script:q} {input.settlement:q} {input.shapes:q} {output:q} 2> {log:q}
@@ -237,8 +237,6 @@ rule clip_settlement:
237237

238238

239239
rule rasterise_clip_wdpa:
240-
message:
241-
"Rasterise and cut WDPA data to the bounds of the input shapefile, using the landcover raster as reference for the rasterisation."
242240
input:
243241
script=workflow.source_path("../scripts/clip_and_rasterise_polys.py"),
244242
shapes="resources/user/shapes/{shape}.parquet",
@@ -250,6 +248,8 @@ rule rasterise_clip_wdpa:
250248
"logs/{shape}/clip_wdpa.log",
251249
conda:
252250
"../envs/default.yaml"
251+
message:
252+
"Rasterise and cut WDPA data to the bounds of the input shapefile, using the landcover raster as reference for the rasterisation."
253253
shell:
254254
"""
255255
python {input.script:q} {input.shapes:q} {input.reference_raster:q} {input.protected_areas:q} {output:q} 2> {log:q}

0 commit comments

Comments
 (0)