flodym

The Flexibe Open Dynamic Material Systems Model library provides key functionality for building material flow analysis models.
https://github.com/pik-piam/flodym

Category: Industrial Ecology
Sub Category: Life Cycle Assessment

Last synced: about 1 hour ago
JSON representation

Repository metadata

library for material flow analysis models

README.md

flodym

PyPI - Version
flodym.tests
docs
status

The flodym (Flexibe Open Dynamic Material Systems Model) library provides key functionality for building material flow analysis models, including

  • the class MFASystem acting as a template (parent class) for users to create their own material flow models
  • the class FlodymArray handling mathematical operations between multi-dimensional arrays
  • different classes representing stocks accumulation, in- and outflows based on age cohort tracking and lifetime distributions. Those can be integrated in the MFASystem.
  • different options for data input and export, as well as visualization

Thanks

flodym (flexible ODYM) is an adaptation of:

ODYM
Copyright (c) 2018 Industrial Ecology
author: Stefan Pauliuk, Uni Freiburg, Germany
https://github.com/IndEcol/ODYM

We gratefully acknowledge funding from the TRANSIENCE project, grant number 101137606, funded by the European Commission within the Horizon Europe Research and Innovation Programme, from the Kopernikus-Projekt Ariadne through the German Federal Ministry of Education and Research (grant no. 03SFK5A0-2), and from the PRISMA project funded by the European Commission within the Horizon Europe Research and Innovation Programme under grant agreement No. 101081604 (PRISMA).

Installation

flodym dependencies are managed with pip.

To install as a user: run python -m pip install flodym

To install as a developer:

  1. Clone the flodym repository using git.
  2. From the project main directory, run pip install -e ".[tests,docs,examples]" to obtain all the necessary
    dependencies, including those for running the tests, making the documentation, and running the examples.

Note that it is advisable to do this within a virtual environment.

Why choose flodym?

MFA models mainly consist on mathematical operations on different multi-dimensional arrays.

For example, the generation of different waste types waste might be a 3D-array defined over the dimensions time $t$, region $r$ and waste type $w$, and might be calculated from multiplying end_of_life_products (defined over time, region, and product type $p$) with a waste_share mapping from product type to waste type.
In numpy, the according matrix multiplication can be carried out nicely with the einsum function, were an index string indicates the involved dimensions:

waste = np.einsum('trp,pw->trw', end_of_life_products, waste_share)

flodym uses this function under the hood, but wraps it in a data type FlodymArray, which stores the dimensions of the array and internally manages the dimensions of different arrays involved in mathematical operations.

With this, the above example reduces to

waste[...] = end_of_life_products * waste_share

This gives a flodym-based MFA models the following properties:

  • Flexibility: When changing the dimensionality of any array in your code, you only have to apply the change once, where the array is defined, instead of adapting every operation involving it. This also allows, for example, to add or remove an entire dimension from your model with minimal effort.
  • Simplicity: Since dimensions are automatically managed by the library, coding array operations becomes much easier. No knowledge about the einsum function, about the dimensions of each involved array or their order are required.
  • Versatility: We offer different levels of flodym use: Users can choose to use the standard methods implemented for data read-in, system setup and visualization, or only use only some of the data types like FlodymArray, and custom methods for the rest.
  • Robustness: Through the use of Pydantic, the setup of the system is type-checked, highlighting errors early-on. The data read-in performs extensive checks on data sorting and completeness.
  • Performance: The use of numpy ndarrays ensures low model runtimes compared with dimension matching through pandas dataframes.

How to contribute

If you'd like to contribute, the issues page lists possible extensions and improvements.
If you wish to contribute your own, just create a fork and open a PR!

Documentation

See our readthedocs page for documentation!

The notebooks in the examples folder provide usage examples of the code.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: about 22 hours ago

Total Commits: 323
Total Committers: 10
Avg Commits per committer: 32.3
Development Distribution Score (DDS): 0.567

Commits in past year: 165
Committers in past year: 7
Avg Commits per committer in past year: 23.571
Development Distribution Score (DDS) in past year: 0.539

Name Email Commits
Jakob Duerrwaechter j****r@p****e 140
pre-commit-ci[bot] 6****] 80
Sally Dacie s****a@p****e 51
Bennet Weiss b****s@p****e 16
Merjo m****k@p****e 15
copilot-swe-agent[bot] 1****t 13
Sally Dacie s****a@L****e 4
Gergo Suto g****o@p****e 2
SallyDa s****e@g****m 1
Leonie Schweiger l****r@p****e 1

Committer domains:


Issue and Pull Request metadata

Last synced: 19 days ago

Total issues: 5
Total pull requests: 51
Average time to close issues: 5 months
Average time to close pull requests: 6 days
Total issue authors: 2
Total pull request authors: 7
Average comments per issue: 1.0
Average comments per pull request: 0.22
Merged pull request: 38
Bot issues: 0
Bot pull requests: 9

Past year issues: 4
Past year pull requests: 51
Past year average time to close issues: 5 months
Past year average time to close pull requests: 6 days
Past year issue authors: 2
Past year pull request authors: 7
Past year average comments per issue: 1.0
Past year average comments per pull request: 0.22
Past year merged pull request: 38
Past year bot issues: 0
Past year bot pull requests: 9

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/pik-piam/flodym

Top Issue Authors

  • JakobBD (4)
  • bennet21 (1)

Top Pull Request Authors

  • JakobBD (34)
  • pre-commit-ci[bot] (9)
  • bennet21 (4)
  • Copilot (1)
  • Merjo (1)
  • gergosuto (1)
  • leonieschweiger (1)

Top Issue Labels

  • enhancement (1)
  • discussion (1)

Top Pull Request Labels


Package metadata

pypi.org: flodym

  • Homepage:
  • Documentation: https://flodym.readthedocs.io/
  • Licenses: mit
  • Latest release: 0.5.3 (published 24 days ago)
  • Last Synced: 2026-01-10T22:03:22.256Z (1 day ago)
  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 270 Last month
  • Rankings:
    • Dependent packages count: 9.761%
    • Average: 32.353%
    • Dependent repos count: 54.946%
  • Maintainers (1)

Dependencies

pyproject.toml pypi
  • PyYAML ^6.0
  • matplotlib ^3.7.1
  • numpy ^1.25.0
  • pandas ^2.0.2
  • pickle4 ^0.0.1
  • plotly ^5.18.0
  • python >=3.10,<3.13
  • scipy ^1.11.0
.github/workflows/main_actions.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v3 composite
requirements.txt pypi
  • Faker ==30.8.0
  • PyYAML ==6.0.2
  • annotated-types ==0.7.0
  • attrs ==24.2.0
  • charset-normalizer ==3.4.0
  • colorama ==0.4.6
  • contourpy ==1.3.0
  • cycler ==0.12.1
  • docformatter ==1.7.5
  • et-xmlfile ==1.1.0
  • fastjsonschema ==2.20.0
  • fonttools ==4.54.1
  • iniconfig ==2.0.0
  • jsonschema ==4.23.0
  • jsonschema-specifications ==2024.10.1
  • jupyter_core ==5.7.2
  • kiwisolver ==1.4.7
  • matplotlib ==3.9.2
  • nbformat ==5.10.4
  • numpy ==2.1.2
  • openpyxl ==3.1.5
  • packaging ==24.1
  • pandas ==2.2.3
  • pickle4 ==0.0.1
  • pillow ==11.0.0
  • platformdirs ==4.3.6
  • plotly ==5.24.1
  • pluggy ==1.5.0
  • polyfactory ==2.17.0
  • pydantic ==2.9.2
  • pydantic_core ==2.23.4
  • pyparsing ==3.2.0
  • pytest ==8.3.3
  • python-dateutil ==2.9.0.post0
  • pytz ==2024.2
  • pywin32 ==308
  • referencing ==0.35.1
  • rpds-py ==0.20.0
  • scipy ==1.14.1
  • setuptools ==75.2.0
  • six ==1.16.0
  • tenacity ==9.0.0
  • traitlets ==5.14.3
  • typing_extensions ==4.12.2
  • tzdata ==2024.2
  • untokenize ==0.1.1

Score: 11.542290073600132