Open Global Infrastructure Risk/Resilience Analysis
Can be used to analyse environmental risks to infrastructure networks using global open data.
https://github.com/nismod/open-gira
Category: Climate Change
Sub Category: Natural Hazard and Storm
Last synced: about 9 hours ago
JSON representation
Repository metadata
Open-data Global Infrastructure Risk/Resilience Analysis
- Host: GitHub
- URL: https://github.com/nismod/open-gira
- Owner: nismod
- License: mit
- Created: 2021-09-02T12:43:58.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-04T15:01:02.000Z (26 days ago)
- Last Synced: 2025-04-17T21:24:42.515Z (13 days ago)
- Language: Python
- Homepage: https://nismod.github.io/open-gira/
- Size: 209 MB
- Stars: 13
- Watchers: 4
- Forks: 5
- Open Issues: 27
- Releases: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
README.md
Open Global Infrastructure Risk/Resilience Analysis
Introduction
This open-source snakemake
workflow can be used to analyse environmental risks to infrastructure
networks using global open data. It is a work in progress.
Goals:
- Automated pipeline for reproducible analysis anywhere in the world
- Maps per-country and of larger areas
- Charts/stats of exposure per admin region, per hazard type, scenario, epoch
- Consider transport, electricity, water, communications systems
- Consider river flooding, storm surge coastal flooding, tropical cyclones
- Estimate direct damages to physical networks
- Estimate indirect effects of disruption - people affected, economic activity disrupted
Non-goals:
- Using closed data, which may be appropriate for other projects or use-cases
- Detailed operational/engineering level simulation
- Long-term planning
Installation
Install open-gira
by cloning the repository:
git clone https://github.com/nismod/open-gira.git
The repository comes with a environment.yml
file describing the conda
and
PyPI
packages required to run open-gira
. The open-gira
developers
recommend using either micromamba
or mamba to install and
manage these conda
packages.
Having installed one of the suggested package managers, to create the
open-gira
conda environment:
micromamba create -f environment.yml -y
MacOS
On MacOS with Apple silicon chips, the osmium
and osmium-tool
packages are
not yet available for the osx-arm64
conda
subdir,
which is what Macs with silicon chips use by default.
Explicitly set it to osx-64
when creating the repo with mamba or conda:
mamba env create -f environment.yml --subdir osx-64
Or build osmium and osmium-tool from source.
And to activate the environment:
micromamba activate open-gira
Utilities
wget
Some rules use the wget
utility to download files.
On Linux or MacOS, you may already have the wget
utility available. If not,
it should be possible to install with your usual package manager (e.g. apt,
MacPorts, brew), or else using micromamba:
micromamba install wget
On Windows, you may have it already if you have a MinGW or Cygwin installation.
If not, you can access binaries at eternallybored.org.
Download the standalone exe and place it for example in C:\Users\username\bin
or somewhere on your PATH.
exactextract
exactextract
is used for zonal
statistics in the tropical cyclones / electricity grid analysis. It is not
available via the conda
package management ecosystem and so must be installed
separately. Please see exactextract installation
instructions.
imagemagick
imagemagick
is used for approximate comparison of
image files produced by the automated tests. Imagemagick is available for
download and installation. On
Linux, it is likely available through your package manager. On Mac, run brew install imagemagick
.
You are now ready to request result files, triggering analysis jobs in the
process.
Note that all subsequent commands given in the documentation assume that the
open-gira
environment is already activated.
Tests
Workflow steps are tested using small sample datasets.
To run the tests:
python -m pytest tests
Usage
open-gira
is comprised of a set of snakemake
rules which call scripts and
library code to request data, process it and produce results.
The key idea of snakemake
is similar to make
in that the workflow is
determined from the end (the files users want) to the beginning (the files
users have, if any) by applying general rules with pattern matching on file and
folder names.
A example invocation looks like:
snakemake --cores 2 -- results/wales-latest_filter-road-primary/edges.gpq
Here, we ask snakemake
to use up to 2 CPUs to produce a target file, in this
case, the edges of the Welsh road network. snakemake
pattern matches
wales-latest
as the OSM dataset name and road-primary
as the network
type we want to filter for, picking up the filter expressions as defined in config/osm_filters/road-primary.txt
.
To check what work we're going to request before commencing, use the -n
flag:
snakemake -n --cores 2 -- results/wales-latest_filter-road-primary/edges.gpq
This will explain which rules will be required to run to produce the target
file. It may be helpful to visualise
which rules are expected to run, too.
The workflow configuration details are in config/config.yml
. You can edit
this to set the target OSM infrastructure datasets, number of spatial slices, and
hazard datasets.
See the documentation
and config/README.md
for more details on usage in general and on configuration.
Documentation
Documentation is written using the mdbook
format, using markdown files in the ./docs
directory.
Follow the installation instructions
to get the mdbook
command-line tool.
To build the docs locally:
cd docs
mdbook build
open book/index.html
Or run mdbook serve
to run a server and rebuild the docs as you make changes.
Related projects
Two libraries have been developed in tandem with open-gira
and provide some
key functionality.
snail
The open-source Python library snail
is used for vector-raster intersection, e.g. identifying which road segments
might be affected by a set of flood map hazard rasters.
snkit
The snkit library is used for
network cleaning and assembly.
Acknowledgments
This research received funding from the FCDO Climate Compatible Growth
Programme. The views expressed here do not necessarily reflect the UK
government's official policies.
This research has also been supported by funding from: the World Bank
Group; the UK Natural Environment Research Council (NERC) through
the UK Centre for Greening Finance and Investment (CGFI); and Global
Center on Adaptation (GCA).
Owner metadata
- Name: National Infrastructure Systems Model
- Login: nismod
- Email:
- Kind: organization
- Description:
- Website: www.itrc.org.uk
- Location: United Kingdom
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/21081508?v=4
- Repositories: 30
- Last ynced at: 2023-02-28T18:04:50.433Z
- Profile URL: https://github.com/nismod
GitHub Events
Total
- Create event: 9
- Release event: 2
- Issues event: 10
- Watch event: 2
- Delete event: 6
- Issue comment event: 18
- Push event: 46
- Pull request review comment event: 2
- Pull request review event: 2
- Pull request event: 11
- Fork event: 1
Last Year
- Create event: 9
- Release event: 2
- Issues event: 10
- Watch event: 2
- Delete event: 6
- Issue comment event: 18
- Push event: 46
- Pull request review comment event: 2
- Pull request review event: 2
- Pull request event: 11
- Fork event: 1
Committers metadata
Last synced: 9 days ago
Total Commits: 1,270
Total Committers: 9
Avg Commits per committer: 141.111
Development Distribution Score (DDS): 0.49
Commits in past year: 108
Committers in past year: 3
Avg Commits per committer in past year: 36.0
Development Distribution Score (DDS) in past year: 0.157
Name | Commits | |
---|---|---|
Fred Thomas | f****s@o****k | 648 |
Tom Russell | t****l@o****k | 224 |
Fred Thomas | f****s@o****k | 153 |
Thibault Lestang | t****g@c****k | 119 |
maxrob27 | m****n@g****m | 94 |
mjaquiery | m****y@p****k | 21 |
Matt Jaquiery | m****y@c****k | 7 |
cenv0972 | c****2@l****k | 2 |
Fred Thomas | f****s@t****g | 2 |
Committer domains:
- ouce.ox.ac.uk: 3
- cs.ox.ac.uk: 2
- the-iea.org: 1
- linux-hn01.ouce.ox.ac.uk: 1
- psy.ox.ac.uk: 1
Issue and Pull Request metadata
Last synced: 1 day ago
Total issues: 108
Total pull requests: 129
Average time to close issues: 4 months
Average time to close pull requests: 9 days
Total issue authors: 8
Total pull request authors: 6
Average comments per issue: 0.85
Average comments per pull request: 0.53
Merged pull request: 122
Bot issues: 0
Bot pull requests: 0
Past year issues: 11
Past year pull requests: 9
Past year average time to close issues: 2 months
Past year average time to close pull requests: 10 days
Past year issue authors: 6
Past year pull request authors: 3
Past year average comments per issue: 1.91
Past year average comments per pull request: 0.56
Past year merged pull request: 9
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- thomas-fred (44)
- tomalrussell (39)
- mjaquiery (14)
- itrcrisks (4)
- tlestang (3)
- alisonpeard (2)
- ischlo (1)
- jacobbieker (1)
Top Pull Request Authors
- thomas-fred (71)
- tomalrussell (21)
- tlestang (16)
- mjaquiery (12)
- maxrob27 (8)
- albert8v (1)
Top Issue Labels
- enhancement (10)
- documentation (3)
- bug (2)
- good first issue (1)
Top Pull Request Labels
- enhancement (7)
- documentation (4)
- bug (2)
Dependencies
- actions/checkout v2 composite
- actions/checkout v2 composite
- mamba-org/provision-with-micromamba main composite
- osgeo/proj latest build
- peaceiris/mdbook v0.4.15
- nismod-snail ==0.5.2
- osmium ==3.2.0
- snkit ==1.8.1
- zenodo_get >=1.5.1
Score: 5.886104031450156