Skip to main content

Helper package for irv-datapkg workflow

Project description

Infrastructure Resilience Assessment Data Packages

DOI

Standalone workflow to create national scale open-data packages from global open datasets.

Setup

Get the latest code by cloning this repository:

git clone git@github.com:nismod/irv-datapkg.git

or

git clone https://github.com/nismod/irv-datapkg.git

Install Python and packages - suggest using micromamba:

micromamba create -f environment.yml

Activate the environment:

micromamba activate datapkg

Run

The data packages are produced using a snakemake workflow.

The workflow expects ZENODO_TOKEN, CDSAPI_KEY and CDSAPI_URL to be set as environment variables - these must be set before running any workflow steps.

If not interacting with Zenodo or the Copernicus Climate Data Store, these can be dummy strings:

echo "placeholder" > ZENODO_TOKEN
echo "https://cds-beta.climate.copernicus.eu/api" > CDSAPI_URL
echo "test" > CDSAPI_KEY

See Climate Data Store API docs and Zenodo API docs for access details.

Export from the file to the environment:

export ZENODO_TOKEN=$(cat ZENODO_TOKEN)
export CDSAPI_KEY=$(cat CDSAPI_KEY)
export CDSAPI_URL=$(cat CDSAPI_URL)

Check what will be run, if we ask for everything produced by the rule all, before running the workflow for real:

snakemake --dry-run all

Run the workflow, asking for all, using 8 cores, with verbose log messages:

snakemake --cores 8 --verbose all

Upload and publish

To publish, first create a Zenodo token, save it and export it as the ZENODO_TOKEN environment variable.

Upload a single data package:

snakemake --cores 1 zenodo/GBR.deposited

Publish (cannot be undone) either programmatically:

snakemake --cores 1 zenodo/GBR.published

Or after review online, through the Zenodo website (sandbox, live)

Post-publication

To get a quick list of DOIs from the Zenodo package json:

cat zenodo/*.deposition.json | jq '.metadata.prereserve_doi.doi'

To generate records.csv with details of published packages:

python scripts/published_metadata.py

Development Notes

In case of warnings about GDAL_DATA not being set, try running:

export GDAL_DATA=$(gdal-config --datadir)

To format the workflow definition Snakefile:

snakefmt Snakefile

To format the Python helper scripts:

black scripts

Related work

These Python libraries may be a useful place to start analysis of the data in the packages produced by this workflow:

  • snkit helps clean network data
  • nismod-snail is designed to help implement infrastructure exposure, damage and risk calculations

The open-gira repository contains a larger workflow for global-scale open-data infrastructure risk and resilience analysis.

Acknowledgments

MIT License, Copyright (c) 2023 Tom Russell and irv-datapkg contributors

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

irv_datapkg-0.2.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

irv_datapkg-0.2.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file irv_datapkg-0.2.0.tar.gz.

File metadata

  • Download URL: irv_datapkg-0.2.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for irv_datapkg-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5e6865637878e3d93aa0cf573a688e97cac949bef27b3fc90d882356eff94cfe
MD5 53f33fde21db7dff5b87fbcc6ae0f3b2
BLAKE2b-256 bba71aba596f354aee0213c8431402d084eb1e8cd12f92c9df1a4ebc81f5febf

See more details on using hashes here.

Provenance

The following attestation bundles were made for irv_datapkg-0.2.0.tar.gz:

Publisher: publish.yml on nismod/irv-datapkg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file irv_datapkg-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: irv_datapkg-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for irv_datapkg-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0306f85e7091687536454c5b37e72dd3b257df5a015dba4e152000480badcb85
MD5 8c9bf4c833c19d37018173cc1cf666a5
BLAKE2b-256 98b93e9fd3dd091ab93b7c4e30f0012fea53b61c0ef263e152710bd3a8aaa975

See more details on using hashes here.

Provenance

The following attestation bundles were made for irv_datapkg-0.2.0-py3-none-any.whl:

Publisher: publish.yml on nismod/irv-datapkg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page