A package for reading and writing data sets in the openLCA schema format.
Project description
olca-schema
This is a package for reading and writing data sets in the openLCA schema format version 2. It provides a typed class model of the schema elements, methods for reading and writing them in the JSON format, reading and writing data sets in zip packages, and some utility methods.
Usage
The package is published on PyPI and
can be installed with pip
:
pip install olca-schema
Here is a small example that creates a package that can be imported into openLCA 2:
import olca_schema as o
import olca_schema.zipio as zipio
# create a unit group and flow property
units = o.new_unit_group('Units of mass', 'kg')
kg = units.units[0]
mass = o.new_flow_property('Mass', units)
# create a product flow and a process with the product as output
steel = o.new_product('Steel', mass)
process = o.new_process('Steel production')
output = o.new_output(process, steel, 1, kg)
output.is_quantitative_reference = True
# prints the Json string of the process
print(process.to_json())
# write a zip package with the data sets
with zipio.ZipWriter('path/to/example.zip') as w:
for entity in [units, mass, steel, process]:
w.write(entity)
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
olca_schema-2.2.1.tar.gz
(32.6 kB
view hashes)
Built Distribution
Close
Hashes for olca_schema-2.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df6fe729575947d579e0e443847600555a09dc77a0e058f6461e76a8196caaf0 |
|
MD5 | c447781bb87b69b5168a57c18be668ba |
|
BLAKE2b-256 | 74f846f052a2fccdf82bf713c586a63c0d48538326c0b9be32dc66d8c4730a12 |