brightpath 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- brightpath-0.0.1/LICENSE +29 -0
- brightpath-0.0.1/MANIFEST.in +1 -0
- brightpath-0.0.1/PKG-INFO +140 -0
- brightpath-0.0.1/README.md +83 -0
- brightpath-0.0.1/brightpath/__init__.py +9 -0
- brightpath-0.0.1/brightpath/bwconverter.py +616 -0
- brightpath-0.0.1/brightpath/data/export/correspondence_biosphere_flows.yaml +247 -0
- brightpath-0.0.1/brightpath/data/export/ecoinvent_to_uvek_mapping.csv +659 -0
- brightpath-0.0.1/brightpath/data/export/ei_transport.csv +277 -0
- brightpath-0.0.1/brightpath/data/export/flows_biosphere_39.csv +4711 -0
- brightpath-0.0.1/brightpath/data/export/simapro-biosphere.json +2842 -0
- brightpath-0.0.1/brightpath/data/export/simapro-technosphere-3.5.csv +46564 -0
- brightpath-0.0.1/brightpath/data/export/simapro_blacklist.yaml +15 -0
- brightpath-0.0.1/brightpath/data/export/simapro_ei_exceptions.yaml +5 -0
- brightpath-0.0.1/brightpath/data/export/simapro_fields.yaml +37 -0
- brightpath-0.0.1/brightpath/data/export/simapro_headers.yaml +15 -0
- brightpath-0.0.1/brightpath/data/export/simapro_subcompartments.yaml +16 -0
- brightpath-0.0.1/brightpath/data/export/simapro_units.yaml +15 -0
- brightpath-0.0.1/brightpath/data/export/uvek_blacklist.yaml +7 -0
- brightpath-0.0.1/brightpath/data/export/uvek_conversion_factors.yaml +31 -0
- brightpath-0.0.1/brightpath/data/export/waste_exchange_names.yaml +11 -0
- brightpath-0.0.1/brightpath/simaproconverter.py +463 -0
- brightpath-0.0.1/brightpath/utils.py +1181 -0
- brightpath-0.0.1/brightpath.egg-info/PKG-INFO +140 -0
- brightpath-0.0.1/brightpath.egg-info/SOURCES.txt +29 -0
- brightpath-0.0.1/brightpath.egg-info/dependency_links.txt +1 -0
- brightpath-0.0.1/brightpath.egg-info/requires.txt +3 -0
- brightpath-0.0.1/brightpath.egg-info/top_level.txt +1 -0
- brightpath-0.0.1/pyproject.toml +40 -0
- brightpath-0.0.1/requirements.txt +3 -0
- brightpath-0.0.1/setup.cfg +4 -0
brightpath-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020, Potsdam Institute for Climate Impact Research, Paul Scherrer Institut
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
* Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
recursive-include brightpath *
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: brightpath
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Convert Brightway2 LCI data to Simapro and back.
|
|
5
|
+
Author-email: Romain Sacchi <romain.sacchi@psi.ch>
|
|
6
|
+
License: BSD 3-Clause License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2020, Potsdam Institute for Climate Impact Research, Paul Scherrer Institut
|
|
9
|
+
All rights reserved.
|
|
10
|
+
|
|
11
|
+
Redistribution and use in source and binary forms, with or without
|
|
12
|
+
modification, are permitted provided that the following conditions are met:
|
|
13
|
+
|
|
14
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
15
|
+
list of conditions and the following disclaimer.
|
|
16
|
+
|
|
17
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
18
|
+
this list of conditions and the following disclaimer in the documentation
|
|
19
|
+
and/or other materials provided with the distribution.
|
|
20
|
+
|
|
21
|
+
* Neither the name of the copyright holder nor the names of its
|
|
22
|
+
contributors may be used to endorse or promote products derived from
|
|
23
|
+
this software without specific prior written permission.
|
|
24
|
+
|
|
25
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
26
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
27
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
28
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
29
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
30
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
31
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
32
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
33
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
34
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
35
|
+
|
|
36
|
+
Project-URL: Homepage, https://github.com/polca/brightpath
|
|
37
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
38
|
+
Classifier: Intended Audience :: Developers
|
|
39
|
+
Classifier: Intended Audience :: Science/Research
|
|
40
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
41
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
42
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
43
|
+
Classifier: Operating System :: POSIX
|
|
44
|
+
Classifier: Programming Language :: Python
|
|
45
|
+
Classifier: Programming Language :: Python :: 3
|
|
46
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
47
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
48
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
49
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
50
|
+
Requires-Python: >=3.9
|
|
51
|
+
Description-Content-Type: text/markdown
|
|
52
|
+
License-File: LICENSE
|
|
53
|
+
Requires-Dist: bw2io
|
|
54
|
+
Requires-Dist: prettytable>=3
|
|
55
|
+
Requires-Dist: PyYAML>=6
|
|
56
|
+
Dynamic: license-file
|
|
57
|
+
|
|
58
|
+
# BrightPath
|
|
59
|
+
[](https://opensource.org/license/bsd-3-clause)
|
|
60
|
+
|
|
61
|
+
BrightPath bridges life-cycle assessment (LCA) data between
|
|
62
|
+
[Brightway2](https://brightway.dev/) and [SimaPro](https://simapro.com/). It
|
|
63
|
+
bundles the mappings that are required to translate units, flow names and
|
|
64
|
+
metadata between both tools and exposes high-level helpers to perform the
|
|
65
|
+
conversion in either direction.
|
|
66
|
+
|
|
67
|
+
## Features
|
|
68
|
+
|
|
69
|
+
* Convert Brightway2 inventories exported as Excel spreadsheets to the SimaPro
|
|
70
|
+
CSV format.
|
|
71
|
+
* Import SimaPro CSV exports and normalise them so that they can be registered
|
|
72
|
+
as Brightway databases.
|
|
73
|
+
* Ship curated mappings for biosphere flows, technosphere exchanges,
|
|
74
|
+
sub-compartments and blacklist entries required during the conversion.
|
|
75
|
+
|
|
76
|
+
## Installation
|
|
77
|
+
|
|
78
|
+
Install BrightPath from PyPI using [pip](https://pip.pypa.io/):
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pip install brightpath
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Usage
|
|
85
|
+
|
|
86
|
+
### Convert Brightway inventories to SimaPro CSV
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from brightpath import BrightwayConverter
|
|
90
|
+
|
|
91
|
+
converter = BrightwayConverter(
|
|
92
|
+
filepath="/path/to/brightway-export.xlsx",
|
|
93
|
+
metadata="/path/to/metadata.yaml", # optional
|
|
94
|
+
ecoinvent_version="3.9",
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
# Write the converted inventory to a CSV file (defaults to the current
|
|
98
|
+
# working directory unless ``export_dir`` is provided during initialisation).
|
|
99
|
+
output_path = converter.convert_to_simapro(database="ecoinvent")
|
|
100
|
+
print(output_path)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The converter also accepts inventory data that has already been loaded into
|
|
104
|
+
memory via the ``data`` argument and can return the converted rows directly by
|
|
105
|
+
calling ``convert_to_simapro(format="data")``.
|
|
106
|
+
|
|
107
|
+
### Convert SimaPro CSV exports to Brightway datasets
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
from brightpath import SimaproConverter
|
|
111
|
+
|
|
112
|
+
converter = SimaproConverter(
|
|
113
|
+
filepath="/path/to/simapro-export.csv",
|
|
114
|
+
ecoinvent_version="3.9",
|
|
115
|
+
db_name="my-simapro-import",
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
# Normalise exchange names, locations and metadata so that they align with
|
|
119
|
+
# Brightway conventions.
|
|
120
|
+
converter.convert_to_brightway()
|
|
121
|
+
|
|
122
|
+
# The processed data lives on ``converter.i`` (an instance of
|
|
123
|
+
# ``bw2io.SimaProCSVImporter``). You can now write the database to your
|
|
124
|
+
# Brightway project if desired:
|
|
125
|
+
# converter.i.write_database()
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Development
|
|
129
|
+
|
|
130
|
+
* Source code is formatted with standard Python tools and tested with
|
|
131
|
+
`pytest`.
|
|
132
|
+
* Data files required for the conversions live under `brightpath/data`.
|
|
133
|
+
* Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidance on running tests
|
|
134
|
+
and submitting pull requests.
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
138
|
+
BrightPath is distributed under the
|
|
139
|
+
[BSD-3-Clause license](LICENSE).
|
|
140
|
+
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# BrightPath
|
|
2
|
+
[](https://opensource.org/license/bsd-3-clause)
|
|
3
|
+
|
|
4
|
+
BrightPath bridges life-cycle assessment (LCA) data between
|
|
5
|
+
[Brightway2](https://brightway.dev/) and [SimaPro](https://simapro.com/). It
|
|
6
|
+
bundles the mappings that are required to translate units, flow names and
|
|
7
|
+
metadata between both tools and exposes high-level helpers to perform the
|
|
8
|
+
conversion in either direction.
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
* Convert Brightway2 inventories exported as Excel spreadsheets to the SimaPro
|
|
13
|
+
CSV format.
|
|
14
|
+
* Import SimaPro CSV exports and normalise them so that they can be registered
|
|
15
|
+
as Brightway databases.
|
|
16
|
+
* Ship curated mappings for biosphere flows, technosphere exchanges,
|
|
17
|
+
sub-compartments and blacklist entries required during the conversion.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
Install BrightPath from PyPI using [pip](https://pip.pypa.io/):
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install brightpath
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
### Convert Brightway inventories to SimaPro CSV
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from brightpath import BrightwayConverter
|
|
33
|
+
|
|
34
|
+
converter = BrightwayConverter(
|
|
35
|
+
filepath="/path/to/brightway-export.xlsx",
|
|
36
|
+
metadata="/path/to/metadata.yaml", # optional
|
|
37
|
+
ecoinvent_version="3.9",
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
# Write the converted inventory to a CSV file (defaults to the current
|
|
41
|
+
# working directory unless ``export_dir`` is provided during initialisation).
|
|
42
|
+
output_path = converter.convert_to_simapro(database="ecoinvent")
|
|
43
|
+
print(output_path)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The converter also accepts inventory data that has already been loaded into
|
|
47
|
+
memory via the ``data`` argument and can return the converted rows directly by
|
|
48
|
+
calling ``convert_to_simapro(format="data")``.
|
|
49
|
+
|
|
50
|
+
### Convert SimaPro CSV exports to Brightway datasets
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from brightpath import SimaproConverter
|
|
54
|
+
|
|
55
|
+
converter = SimaproConverter(
|
|
56
|
+
filepath="/path/to/simapro-export.csv",
|
|
57
|
+
ecoinvent_version="3.9",
|
|
58
|
+
db_name="my-simapro-import",
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
# Normalise exchange names, locations and metadata so that they align with
|
|
62
|
+
# Brightway conventions.
|
|
63
|
+
converter.convert_to_brightway()
|
|
64
|
+
|
|
65
|
+
# The processed data lives on ``converter.i`` (an instance of
|
|
66
|
+
# ``bw2io.SimaProCSVImporter``). You can now write the database to your
|
|
67
|
+
# Brightway project if desired:
|
|
68
|
+
# converter.i.write_database()
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Development
|
|
72
|
+
|
|
73
|
+
* Source code is formatted with standard Python tools and tested with
|
|
74
|
+
`pytest`.
|
|
75
|
+
* Data files required for the conversions live under `brightpath/data`.
|
|
76
|
+
* Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidance on running tests
|
|
77
|
+
and submitting pull requests.
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
BrightPath is distributed under the
|
|
82
|
+
[BSD-3-Clause license](LICENSE).
|
|
83
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
__all__ = ("BrightwayConverter", "SimaproConverter", "DATA_DIR")
|
|
2
|
+
__version__ = (0, 0, 2)
|
|
3
|
+
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
DATA_DIR = Path(__file__).resolve().parent / "data"
|
|
7
|
+
|
|
8
|
+
from .bwconverter import BrightwayConverter
|
|
9
|
+
from .simaproconverter import SimaproConverter
|