nismod/open-gira

Open-data Global Infrastructure Risk/Resilience Analysis

Overview

Topics:

Latest release: v0.3.1, Last update: 2025-02-25

Linting: linting: failed, Formatting:formatting: failed

Deployment

Step 1: Install Snakemake and Snakedeploy

Snakemake and Snakedeploy are best installed via the Mamba package manager (a drop-in replacement for conda). If you have neither Conda nor Mamba, it is recommended to install Miniforge. More details regarding Mamba can be found here.

When using Mamba, run

mamba create -c conda-forge -c bioconda --name snakemake snakemake snakedeploy

to install both Snakemake and Snakedeploy in an isolated environment. For all following commands ensure that this environment is activated via

conda activate snakemake

Step 2: Deploy workflow

With Snakemake and Snakedeploy installed, the workflow can be deployed as follows. First, create an appropriate project working directory on your system and enter it:

mkdir -p path/to/project-workdir
cd path/to/project-workdir

In all following steps, we will assume that you are inside of that directory. Then run

snakedeploy deploy-workflow https://github.com/nismod/open-gira . --tag v0.3.1

Snakedeploy will create two folders, workflow and config. The former contains the deployment of the chosen workflow as a Snakemake module, the latter contains configuration files which will be modified in the next step in order to configure the workflow to your needs.

Step 3: Configure workflow

To configure the workflow, adapt config/config.yml to your needs following the instructions below.

Step 4: Run workflow

The deployment method is controlled using the --software-deployment-method (short --sdm) argument.

Snakemake will automatically detect the main Snakefile in the workflow subfolder and execute the workflow module that has been defined by the deployment in step 2.

For further options such as cluster and cloud execution, see the docs.

Step 5: Generate report

After finalizing your data analysis, you can automatically generate an interactive visual HTML report for inspection of results together with parameters and code inside of the browser using

snakemake --report report.zip

Configuration

The following section is imported from the workflow’s config/README.md.

open-gira configuration directory

README.md

This file.

config.yaml

YAML configuration file. This file contains parameters that are frequently modified prior to an analysis. Refer to it for more information.

land_use_to_surface_roughness.csv

A lookup table from a land use classification scheme to a typical surface roughness length. This is used in downscaling wind speeds in tropical-cyclone analyses.

arc_cluster

snakemake profile for running open-gira on the University of Oxford's ARC cluster.

damage_curves

CSV files, one per asset_type, describing the relationship between hazard intensity and damage fraction. These are used for direct damage estimation.

hazard_resource_locations

Fairly self-explanatory, contains files containing lists of hazard file URLs to acquire for analyses.

osm_filters

Text files for use by osmium to filter features based on tag. We used these to construct infrastructure networks from OpenStreetMap data.

rehab_costs

CSV files containing rehabilitation cost estimates in USD. One file per sector, each row a unique asset_type.

storm_sets

JSON files, each containing a single list. The list may contain zero or many unique string storm IDs. These can be used to subset a parent STORM_SET, e.g. IBTrACS may be subset to contain just storms that hit Mexico since 2000, if the relevant storm IDs are provided. Where the list provided is empty, this is interpreted as "process every storm in the parent set", i.e. all of IBTrACS.

Linting and formatting

Linting results

/tmp/tmpwfoyhgyf/nismod-open-gira-ef81de1/workflow/Snakefile:82: SyntaxWarning: invalid escape sequence '\d'
  COST_OR_FRACTION="cost|fraction",
/tmp/tmpwfoyhgyf/nismod-open-gira-ef81de1/workflow/Snakefile:102: SyntaxWarning: invalid escape sequence '\/'
  SAMPLE="\d+",
/tmp/tmpwfoyhgyf/nismod-open-gira-ef81de1/workflow/Snakefile:103: SyntaxWarning: invalid escape sequence '\d'
  # may be upper or lower, one 'f' or two
/tmp/tmpwfoyhgyf/nismod-open-gira-ef81de1/workflow/Snakefile:105: SyntaxWarning: invalid escape sequence '\/'
  
ModuleNotFoundError in file /tmp/tmpwfoyhgyf/nismod-open-gira-ef81de1/workflow/Snakefile, line 20:
No module named 'open_gira'
  File "/tmp/tmpwfoyhgyf/nismod-open-gira-ef81de1/workflow/Snakefile", line 20, in <module>

Formatting results

[DEBUG] 
<unknown>:1: SyntaxWarning: invalid escape sequence '\d'
<unknown>:1: SyntaxWarning: invalid escape sequence '\/'
<unknown>:1: SyntaxWarning: invalid escape sequence '\d'
<unknown>:1: SyntaxWarning: invalid escape sequence '\/'
[DEBUG] In file "/tmp/tmpwfoyhgyf/nismod-open-gira-ef81de1/workflow/Snakefile":  Formatted content is different from original
[INFO] 1 file(s) would be changed 😬

snakefmt version: 0.10.2