pathways

pathways: life cycle assessment of energy transition scenarios - Published in JOSS (2024)

https://github.com/polca/pathways

Science Score: 95.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README and JOSS metadata
  • Academic publication links
  • Committers with academic emails
    2 of 4 committers (50.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

energy lca prospective scenario

Scientific Fields

Engineering Computer Science - 80% confidence
Psychology Social Sciences - 40% confidence
Last synced: 4 months ago · JSON representation

Repository

Scenario-wide Life Cycle Assessment

Basic Info
  • Host: GitHub
  • Owner: polca
  • License: bsd-3-clause
  • Language: Jupyter Notebook
  • Default Branch: main
  • Homepage:
  • Size: 35.7 MB
Statistics
  • Stars: 19
  • Watchers: 2
  • Forks: 3
  • Open Issues: 1
  • Releases: 2
Topics
energy lca prospective scenario
Created over 2 years ago · Last pushed 4 months ago
Metadata Files
Readme License

README.md

pathways

pathways is a Python package that characterizes the environmental impacts of products, sectors or transition scenarios over time using Life Cycle Assessment (LCA). Compared to traditional scenario results from energy models, pathways provides a more detailed and transparent view of the environmental impacts of a scenario by resolving supply chains between producers and consumers (as an LCA does). Hence, direct and indirect emissions are accounted for, and double-counting issues are partially resolved.

pathways is initially designed to work with data packages produced by premise, but can be used with any IAM scenarios and LCA databases.

pathways reads a scenario and a corresponding set of scenario-based LCA matrices and calculates the environmental impacts of the scenario (or a subset of it) over time.

If you use pathways in a scientific publication, we would appreciate citations to the following paper:

Sacchi et al., (2024). pathways: life cycle assessment of energy transition scenarios. Journal of Open Source Software, 9(103), 7309, https://doi.org/10.21105/joss.07309

Requirements

pathways requires Python 3.10 or 3.11. It also requires the packages listed in the requirements.txt file.

Installation

pathways is in an early development stage, and can be installed from the Github repo with pip:

```bash

pip install git+https://github.com/polca/pathways.git

```

or alternatively, you can clone the repository and install it from the source:

```bash

git clone https://github.com/polca/pathways.git
cd pathways
pip install -r requirements.txt

```

pathways is also available via anaconda:

```bash

conda install -c conda-forge -c romainsacchi pathways

```

.. note:: If you use an ARM architecture, you may want to also install the scikit-umfpack package from the conda-forge channel for faster calculation. However, you need to make sure that numpy<=1.24.4 is installed, as bw2io is not compatible with the latest version of numpy:

```bash

conda install -c conda-forge scikit-umfpack

```

Usage

pathways is a Python package, and can be used in Python scripts or in a Python interpreter. See the example notebook.

Python

To use the Pathways class, you need to provide it with a datapackage that contains your scenario data, mapping information, and LCA matrices. The datapackage should be a zip file that contains the following files:

  • datapackage.json: a JSON file that describes the contents of the datapackage
  • a mapping folder containing a mapping.yaml file that describes the mapping between the IAM scenario and the LCA databases
  • a inventories folder containing the LCA matrices as CSV files
  • a scenario_data folder containing the IAM scenario data as CSV file

```python

from pathways import Pathways datapackagepath = "path/to/your/datapackage.zip" p = Pathways( datapackage=datapackagepath, debug=True # optional, if you want to see the logs )

Define your parameters (leave any as None to use all available values)

methods = ["IPCC 2021", "ReCiPe 2016"] models = ["ModelA", "ModelB"] scenarios = ["Baseline", "Intervention"] regions = ["Region1", "Region2"] years = [2020, 2025] variables = ["Electricity", "Transport"]

Run the calculation

p.calculate( methods=methods, models=models, scenarios=scenarios, regions=regions, years=years, variables=variables, use_distributions=0 # optional, if > 0: number of iterations for Monte Carlo analysis )

```

The list of available LCIA methods can be obtained like so:

```python

print(p.lcia_methods)

```

The argument datapackage is the path to the datapackage.zip file that describes the scenario and the LCA databases -- see dev/sample. The argument methods is a list of methods to be used for the LCA calculations. The argument years is a list of years for which the LCA calculations are performed. The argument regions is a list of regions for which the LCA calculations are performed. The argument scenarios is a list of scenarios for which the LCA calculations are performed.

If not specified, all the methods, years, regions and scenarios defined in the datapackage.json file are used, which can be very time-consuming.

Once calculated, the results of the LCA calculations are stored in the .lcia_results attribute of the Pathways object as an xarray.DataArray.

You can display the LCA results with an optional cutoff parameter to filter insignificant data:

```python

results = p.display_results(cutoff=0.001)
print(results)

```

It can be further formatted to a pandas' DataFrame or exported to a CSV/Excel file using the built-in methods of xarray.

```python

df = results.to_dataframe()
df.to_csv("results.csv")

```

Or the result can be exported as a Parquet file for further use in pandas or dask:

```python

p.export_results(filename="results.gzip")

```

Results can be visualized using your favorite plotting library. Screenshot

Finally, when running a Monte Carlo analysis (i.e., when use_distributions is greater than 0), parameters of the Monte Carlo analysis (coordinates of uncertain exchanges, values for each iteration, etc.) are stored in Excel files. It is possible to run Global Sensitivity Analysis (GSA) on the results of the Monte Carlo analysis, like so:

```python

from pathways import run_gsa
run_gsa(method="delta")

```

The method argument can only be "delta" for now. It will run a Delta Moment-Independent Measure (DMIM) sensitivity analysis on the results of the Monte Carlo analysis, to rank the influence of each uncertain exchange on the results' distribution.

Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.

You can contribute in many ways:

Types of Contributions

Report Bugs

Report bugs by filing issues on GitHub.

If you are reporting a bug, please include:

  • Your operating system name and version.
  • Any details about your local setup that might be helpful in troubleshooting.
  • Detailed steps to reproduce the bug.
  • For visual bugs, a screenshot or animated GIF of the bug in action.

Fix Bugs

Look through the GitHub issues for bugs. Anything tagged with "bug" and "help wanted" is open to whoever wants to implement it.

Implement Features

Look through the GitHub issues for features. Anything tagged with "enhancement" and "help wanted" is open to whoever wants to implement it.

Write Documentation

pathways could always use more documentation, whether as part of the official pathways docs, in docstrings, or even on the web in blog posts, articles, and such.

Submit Feedback

The best way to send feedback is to file an issue on the GitHub repository.

Credits

Contributors

Financial Support

License

pathways is licensed under the terms of the BSD 3-Clause License.

Owner

  • Name: POLCA
  • Login: polca
  • Kind: organization

International collaborative for improving prospective life cycle assessment

JOSS Publication

pathways: life cycle assessment of energy transition scenarios
Published
November 18, 2024
Volume 9, Issue 103, Page 7309
Authors
Romain Sacchi ORCID
Laboratory for Energy Systems Analysis, Centers for Energy and Environmental Sciences and Nuclear Engineering and Sciences, Paul Scherrer Institute, 5232 Villigen, Switzerland
Alvaro J. Hahn-Menacho ORCID
Laboratory for Energy Systems Analysis, Centers for Energy and Environmental Sciences and Nuclear Engineering and Sciences, Paul Scherrer Institute, 5232 Villigen, Switzerland, Chair of Energy Systems Analysis, Institute of Energy and Process Engineering, ETH Zürich, 8092 Zürich, Switzerland
Editor
Frauke Wiese ORCID
Tags
life cycle assessment prospective database premise scenario integrated assessment models energy system models

GitHub Events

Total
  • Create event: 3
  • Release event: 1
  • Issues event: 8
  • Watch event: 14
  • Issue comment event: 31
  • Push event: 34
  • Fork event: 2
Last Year
  • Create event: 3
  • Release event: 1
  • Issues event: 8
  • Watch event: 14
  • Issue comment event: 31
  • Push event: 34
  • Fork event: 2

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 312
  • Total Committers: 4
  • Avg Commits per committer: 78.0
  • Development Distribution Score (DDS): 0.276
Past Year
  • Commits: 41
  • Committers: 3
  • Avg Commits per committer: 13.667
  • Development Distribution Score (DDS): 0.22
Top Committers
Name Email Commits
romainsacchi r****s@m****m 226
romainsacchi r****n@R****h 44
alvarojhahn a****n@g****m 40
romainsacchi r****n@R****h 2
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 7
  • Total pull requests: 2
  • Average time to close issues: 20 days
  • Average time to close pull requests: 2 minutes
  • Total issue authors: 4
  • Total pull request authors: 1
  • Average comments per issue: 4.71
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 6
  • Pull requests: 1
  • Average time to close issues: 8 days
  • Average time to close pull requests: 2 minutes
  • Issue authors: 3
  • Pull request authors: 1
  • Average comments per issue: 5.5
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • marc-vdm (3)
  • dbantje (2)
  • romainsacchi (1)
  • lassekp (1)
Pull Request Authors
  • romainsacchi (4)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 15 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
  • Total maintainers: 1
pypi.org: pathways

Scenario-level LCA of energy systems and transition pathways

  • Homepage: https://github.com/polca/pathways
  • Documentation: https://pathways.readthedocs.io/
  • License: BSD 3-Clause License Copyright (c) 2024, Paul Scherrer Institut All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  • Latest release: 1.0.0
    published about 1 year ago
  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 15 Last month
Rankings
Dependent packages count: 10.9%
Average: 36.2%
Dependent repos count: 61.4%
Maintainers (1)
Last synced: 4 months ago