Skip to main content

No project description provided

Project description

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 cite

If you use this software in publications, please cite our article in the Journal of Open Source Software:

@article{
    Duerrwaechter2026,
    author = {Dürrwächter, Jakob and Hosak, Merlin and Weiss, Bennet and Ueckerdt, Falko},
    title = {flodym: A Python package for dynamic material flow analysis},
    journal = {Journal of Open Source Software},
    year = {2026},
    doi = {10.21105/joss.10105},
    url = {https://doi.org/10.21105/joss.10105},
    publisher = {The Open Journal},
    volume = {11},
    number = {119},
    pages = {10105}
}

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!

To run the tests locally, install the package with test dependencies (pip install -e ".[tests]") and run:

pytest

How to report problems and get support

If you encounter a bug or unexpected behaviour, please open an issue on GitHub.

For questions and general support, use GitHub Discussions or contact jakob[dot]duerrwaechter[at]pik-potsdam.de.

Documentation

See our readthedocs page for documentation!

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

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

flodym-0.8.1.tar.gz (63.1 kB view details)

Uploaded Source

Built Distribution

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

flodym-0.8.1-py3-none-any.whl (54.8 kB view details)

Uploaded Python 3

File details

Details for the file flodym-0.8.1.tar.gz.

File metadata

  • Download URL: flodym-0.8.1.tar.gz
  • Upload date:
  • Size: 63.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for flodym-0.8.1.tar.gz
Algorithm Hash digest
SHA256 941886957fe2c6e98a005eea77660863d2d095ae2a76846e0db5da5c0243377b
MD5 592a878bc95bfe4601df953ead8a0e13
BLAKE2b-256 b5930f4682ab29f67cc3b2ea69059743b193a40c9ce9f9b39cb728378afc551f

See more details on using hashes here.

Provenance

The following attestation bundles were made for flodym-0.8.1.tar.gz:

Publisher: python-publish.yml on pik-piam/flodym

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

File details

Details for the file flodym-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: flodym-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 54.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for flodym-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 62830d0e8cac163048157e5ab13c41cbc3feed1b950e17b08f3ab1b91f4304a2
MD5 6b1c070c3b49f0ceece35db655965f5b
BLAKE2b-256 fbac44d1e2cf35af13f85d4dface65f978c423c365e0185a4d26be10809f407b

See more details on using hashes here.

Provenance

The following attestation bundles were made for flodym-0.8.1-py3-none-any.whl:

Publisher: python-publish.yml on pik-piam/flodym

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