This repository contains project-specific codes and configuration to run climate-related risk and resilience analysis of infrastructure networks in Jamaica.
For an initial overview of the style of analysis, a table of potential data requirements is presented in data-categories.csv.
Clone or download this repository from GitHub:
git clone git@github.com:nismod/jamaica-infrastructure.git
Next, install required Python packages:
We recommend using micromamba
to install the packages and manage installing libraries into a conda
environment, usually handling non-Python dependencies well.
Create a conda environment once (per machine/user):
micromamba create --file environment.yaml
The principal goal of this repository is to produce analysis results, (damages, losses and adaptation options) that can be ingested by the ETL pipeline in irv-jamaica.
The analysis is comprised of Python scripts wrapped in
snakemake rules. Snakemake is a workflow
management system that can be used to break up complex modelling chains and
improve the reproducibility of analyses. To invoke a rule, call snakemake
followed by the file you want to produce.
Some functionality is contained within a helper Python module, located in
src/jamaica_infrastructure
.
To make snakemake, the helper Python module and other software dependencies available, activate the environment we previously created.
micromamba activate jsrat
Analysis options can be configured using the config.yaml
file. See it for
inline documentation.
To invoke the rule (and all necessary predecessor rules) to compute commuter flows across the transport network:
snakemake --dry-run --cores 1 -- results/flow_mapping/labour_to_sectors_flow_paths.pq
Note that the --dry-run
flag asks snakemake
to report on what work (if any)
is necessary. As jobs can be long running, this is useful to check beforehand.
To actually run the rules, remove the dry run flag.
The --cores
flag indicates how many processors snakemake
will use to execute
the rules. If rules do not depend on one another and enough processors are
available, they may execute simultaneously. Also, some rules invoke scripts that
are parallelised and can make use more than one processor themselves.
See .smk
files in workflow/
for available rules and their required input and
output files.
While this workflow is in development, some of the rules are placeholders.
To check the validity of the rules and which target files have rules, try running:
python workflow/utilities/check_targets.py
This will not run any calculations, but rather check if there are available rules to generate the desired output. It takes a few minutes.
The helper Python libary contained in src/jamaica_infrastructure
also has
tests. These can be run with:
python -m pytest src/jamaica_infrastructure
These take a few seconds.
To run any rules you will need the processed_data/
folder which contains data
that has been cleaned and can be consumed by the rules. Contact the maintainers
for access to this folder.
Most(!) outputs are written to the results/
folder.
These paths can be configured by editing the config.yaml
file.
Outstanding work may be seen the issues on the GitHub repository.
If you are resurrecting scripts pertaining to this repository, they may rely on functionality since removed. Checkout v1.0 for the state of the project as of 2023 (prior to the rewrite of this repository in phase 3).
The Jamaica Energy Model (JEM) is a high-level power flow model of Jamaica's electricity network.
The J-SRAT web-based visualisation tool is implemented in
irv-jamaica
snail
is a supporting library, used here
for hazard-network intersections, under continuing development to support risk
analysis.
open-gira
is a supporting library and
set of workflows, used here for road network generation
This work is supported by the Coalition for Climate Resilient Investment (CCRI) project on infrastructure risk assessment and resilient investment prioritisation in Jamaica, funded by the UK Foreign, Commonwealth and Development Office (FCDO).