Skip to content

Commit

Permalink
put individual storms in a directory (tidying)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-fred committed Sep 14, 2023
1 parent 03adbf9 commit fd0fdfc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions workflow/rules/exposure/electricity_grid/disruption.smk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def country_storm_paths_for_storm_set(wildcards):
for storm_id, countries in country_set_by_storm.items():
paths.extend(
expand(
"results/power/by_country/{COUNTRY_ISO_A3}/disruption/{STORM_SET}/{STORM_ID}.nc",
"results/power/by_country/{COUNTRY_ISO_A3}/disruption/{STORM_SET}/by_storm/{STORM_ID}.nc",
COUNTRY_ISO_A3=countries, # list of str
STORM_SET=wildcards.STORM_SET, # str
STORM_ID=storm_id # str
Expand All @@ -42,7 +42,7 @@ def country_storm_paths_for_storm(wildcards):
country_set_by_storm = cached_json_file_read(json_file)

return expand(
"results/power/by_country/{COUNTRY_ISO_A3}/disruption/{STORM_SET}/{STORM_ID}.nc",
"results/power/by_country/{COUNTRY_ISO_A3}/disruption/{STORM_SET}/by_storm/{STORM_ID}.nc",
COUNTRY_ISO_A3=country_set_by_storm[wildcards.STORM_ID], # list of str
STORM_SET=wildcards.STORM_SET, # str
STORM_ID=wildcards.STORM_ID # str
Expand Down Expand Up @@ -135,7 +135,7 @@ def disruption_by_storm_for_country_for_storm_set(wildcards):
storms = storm_set_by_country[wildcards.COUNTRY_ISO_A3]

return expand(
"{OUTPUT_DIR}/power/by_country/{COUNTRY_ISO_A3}/disruption/{STORM_SET}/{STORM_ID}.nc",
"{OUTPUT_DIR}/power/by_country/{COUNTRY_ISO_A3}/disruption/{STORM_SET}/by_storm/{STORM_ID}.nc",
OUTPUT_DIR=wildcards.OUTPUT_DIR, # str
COUNTRY_ISO_A3=wildcards.COUNTRY_ISO_A3, # str
STORM_SET=wildcards.STORM_SET, # str
Expand Down
2 changes: 1 addition & 1 deletion workflow/rules/exposure/electricity_grid/exposure.smk
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def exposure_by_storm_for_country_for_storm_set(wildcards):
storms = storm_set_by_country[wildcards.COUNTRY_ISO_A3]

return expand(
"{OUTPUT_DIR}/power/by_country/{COUNTRY_ISO_A3}/exposure/{STORM_SET}/{STORM_ID}.nc",
"{OUTPUT_DIR}/power/by_country/{COUNTRY_ISO_A3}/exposure/{STORM_SET}/by_storm/{STORM_ID}.nc",
OUTPUT_DIR=wildcards.OUTPUT_DIR, # str
COUNTRY_ISO_A3=wildcards.COUNTRY_ISO_A3, # str
STORM_SET=wildcards.STORM_SET, # str
Expand Down
4 changes: 2 additions & 2 deletions workflow/rules/exposure/electricity_grid/intersection.smk
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ rule electricity_grid_damages:
grid_edges = rules.create_power_network.output.edges,
grid_nodes = rules.create_power_network.output.nodes,
output:
exposure = "{OUTPUT_DIR}/power/by_country/{COUNTRY_ISO_A3}/exposure/{STORM_SET}/{STORM_ID}.nc",
disruption = "{OUTPUT_DIR}/power/by_country/{COUNTRY_ISO_A3}/disruption/{STORM_SET}/{STORM_ID}.nc"
exposure = "{OUTPUT_DIR}/power/by_country/{COUNTRY_ISO_A3}/exposure/{STORM_SET}/by_storm/{STORM_ID}.nc",
disruption = "{OUTPUT_DIR}/power/by_country/{COUNTRY_ISO_A3}/disruption/{STORM_SET}/by_storm/{STORM_ID}.nc"
script:
"../../../scripts/intersect/grid_disruption.py"

Expand Down

0 comments on commit fd0fdfc

Please sign in to comment.