Skip to main content

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


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)

Uploaded Source

Built Distribution

olca_schema-2.2.1-py3-none-any.whl (28.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page