No project description provided
Project description
flodym
The flodym (Flexibe Open Dynamic Material Systems Model) library provides key functionality for building material flow analysis models, including
- the class
MFASystemacting as a template (parent class) for users to create their own material flow models - the class
FlodymArrayhandling 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
The development of flodym was conducted within the TRANSIENCE project, grant number 101137606, funded by the European Commission within the Horizon Europe Research and Innovation Programme.
Installation
flodym dependencies are managed with pip.
To install as a user: run python -m pip install flodym
To install as a developer:
- Clone the flodym repository using git.
- 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flodym-0.5.0.tar.gz.
File metadata
- Download URL: flodym-0.5.0.tar.gz
- Upload date:
- Size: 50.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e446887e6b176c5e689c17894e78a6effd1828522925514780b732a54426301
|
|
| MD5 |
65e274f5bb38939d9c9b7e69e179087b
|
|
| BLAKE2b-256 |
1d3f2d6d72257e26c4c1f97ab1d81a320ffa760434a8f4aba0020214a307bb4b
|
Provenance
The following attestation bundles were made for flodym-0.5.0.tar.gz:
Publisher:
python-publish.yml on pik-piam/flodym
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flodym-0.5.0.tar.gz -
Subject digest:
7e446887e6b176c5e689c17894e78a6effd1828522925514780b732a54426301 - Sigstore transparency entry: 246763982
- Sigstore integration time:
-
Permalink:
pik-piam/flodym@51810ce8e95f76245c7c9a235d33bab0e8031cb8 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/pik-piam
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@51810ce8e95f76245c7c9a235d33bab0e8031cb8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file flodym-0.5.0-py3-none-any.whl.
File metadata
- Download URL: flodym-0.5.0-py3-none-any.whl
- Upload date:
- Size: 50.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
895de58d542354fe762c30ca81d0e765132edc38e165c7227e5ee3ff35cc5294
|
|
| MD5 |
e93517e1334157f735030ce623ff305a
|
|
| BLAKE2b-256 |
323e13649697d454af0ac955324fd89322804a50aaf9b2a409ee908a3ba3c4df
|
Provenance
The following attestation bundles were made for flodym-0.5.0-py3-none-any.whl:
Publisher:
python-publish.yml on pik-piam/flodym
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flodym-0.5.0-py3-none-any.whl -
Subject digest:
895de58d542354fe762c30ca81d0e765132edc38e165c7227e5ee3ff35cc5294 - Sigstore transparency entry: 246764003
- Sigstore integration time:
-
Permalink:
pik-piam/flodym@51810ce8e95f76245c7c9a235d33bab0e8031cb8 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/pik-piam
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@51810ce8e95f76245c7c9a235d33bab0e8031cb8 -
Trigger Event:
release
-
Statement type: