Skip to main content

A python module for automating input output calculations and generating reports

Project description

pymrio logo

pymrio: Multi-Regional Input-Output Analysis in Python

https://img.shields.io/pypi/v/pymrio.svg https://anaconda.org/conda-forge/pymrio/badges/version.svg https://github.com/IndEcol/pymrio/workflows/build/badge.svg https://coveralls.io/repos/github/IndEcol/pymrio/badge.svg?branch=master Documentation Status https://img.shields.io/badge/License-GPL%20v3-blue.svg https://zenodo.org/badge/21688312.svg

What is it

Pymrio is an open source tool for analysing global environmentally extended multi-regional input-output tables (EE MRIOs). Pymrio aims to provide a high-level abstraction layer for global EE MRIO databases in order to simplify common EE MRIO data tasks. Pymrio includes automatic download functions and parsers for available EE MRIO databases like EXIOBASE, WIOD and EORA26. It automatically checks parsed EE MRIOs for missing data necessary for calculating standard EE MRIO accounts (such as footprint, territorial, impacts embodied in trade) and calculates all missing tables. Various data report and visualization methods help to explore the dataset by comparing the different accounts across countries.

Further functions include:

  • analysis methods to identify where certain impacts occur

  • modifying region/sector classification

  • restructuring extensions

  • export to various formats

  • visualization routines and

  • automated report generation

Where to get it

The full source code is available on Github at: https://github.com/IndEcol/pymrio

Pymrio is registered at PyPI and on the Anaconda Cloud. Install it by:

pip install pymrio --upgrade

or when using conda install it by

conda install -c conda-forge pymrio

or update to the latest version by

conda update -c conda-forge pymrio

The source-code of Pymrio available at the GitHub repo: https://github.com/IndEcol/pymrio

The master branch in that repo is supposed to be ready for use and might be ahead of the official releases. To install directly from the master branch use:

pip install git+https://github.com/IndEcol/pymrio@master

Development installation

To set up your development environment, install uv, then sync the project dependencies, including test and lint requirements:

uv sync --all-extras

See ./CONTRIBUTING.rst for further instructions about contributing to pymrio.

Quickstart

A small test mrio is included in the package.

To use it call

import pymrio
test_mrio = pymrio.load_test()

The test mrio consists of six regions and eight sectors:

print(test_mrio.sectors)
print(test_mrio.regions)
print(test_mrio.extensions)

The test mrio includes tables flow tables and some satellite accounts. To show these:

test_mrio.Z
test_mrio.emissions.F

However, some tables necessary for calculating footprints (like test_mrio.A or test_mrio.emissions.S) are missing. pymrio automatically identifies which tables are missing and calculates them:

test_mrio.calc_all()

Now, all accounts are calculated, including footprints and emissions embodied in trade:

test_mrio.A
test_mrio.emissions.D_cba
test_mrio.emissions.D_exp

To visualize the accounts:

import matplotlib.pyplot as plt
test_mrio.emissions.plot_account('emission_type1')
plt.show()

Everything can be saved with

test_mrio.save_all('some/folder')

See the documentation , tutorials and Stadler 2021 for further examples.

Tutorials

The documentation includes information about how to use pymrio for automatic downloading and parsing of the EE MRIOs EXIOBASE, WIOD, OECD and EORA26 as well as tutorials for the handling, aggregating and analysis of these databases.

Citation

If you use Pymrio in your research, citing the article describing the package (Stadler 2021) is very much appreciated.

For the full bibtex key see CITATION file.

Contributing

Want to contribute? Great! Please check CONTRIBUTING.rst if you want to help to improve Pymrio.

Communication, issues, bugs and enhancements

Please use the issue tracker for documenting bugs, proposing enhancements and all other communication related to pymrio.

You can follow me on twitter to get the latest news about all my open-source and research projects (and occasionally some random retweets).

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

pymrio-0.6.3.tar.gz (215.1 kB view details)

Uploaded Source

Built Distribution

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

pymrio-0.6.3-py3-none-any.whl (247.1 kB view details)

Uploaded Python 3

File details

Details for the file pymrio-0.6.3.tar.gz.

File metadata

  • Download URL: pymrio-0.6.3.tar.gz
  • Upload date:
  • Size: 215.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pymrio-0.6.3.tar.gz
Algorithm Hash digest
SHA256 4ed12fe68388ee33a04f32ef1d59f044ac767c5b2b2e064932adfa7d3a00de4c
MD5 1b8469e397da284ec3ed6689b4009605
BLAKE2b-256 13a447e093416a1a999612880b1096b25876bb9d83866845b64d147b2ef6aa53

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymrio-0.6.3.tar.gz:

Publisher: publish_pypi.yml on IndEcol/pymrio

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

File details

Details for the file pymrio-0.6.3-py3-none-any.whl.

File metadata

  • Download URL: pymrio-0.6.3-py3-none-any.whl
  • Upload date:
  • Size: 247.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pymrio-0.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a5947a05b93518055da78e09dfb2cd027b86dcfbdc60e7a13b9ec2cfb5a3bd6b
MD5 e2dff2126266d3f159f6507332cfac27
BLAKE2b-256 58e31813a19fdd571f3df7c8c6c7a0c05d08b0ab10184e561899e6bd8a68e64f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymrio-0.6.3-py3-none-any.whl:

Publisher: publish_pypi.yml on IndEcol/pymrio

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