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.2.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

olca_schema-2.2.2-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

Details for the file olca_schema-2.2.2.tar.gz.

File metadata

  • Download URL: olca_schema-2.2.2.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for olca_schema-2.2.2.tar.gz
Algorithm Hash digest
SHA256 98753a67874ad09416c2a893a1982fdb2a368e6d97927cdc331954debb733e66
MD5 ac6b0a6d83f5904da7e1bba53e887382
BLAKE2b-256 d60dca8867502b98b0ca90e072c3caae14dc5631cdcc86e61dd045f28c3d3fca

See more details on using hashes here.

File details

Details for the file olca_schema-2.2.2-py3-none-any.whl.

File metadata

  • Download URL: olca_schema-2.2.2-py3-none-any.whl
  • Upload date:
  • Size: 28.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for olca_schema-2.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d6962240cd4aa41950748ddb1bf8856f690838e44ea3f8c7e8dc8b731f0dd423
MD5 b045e8d280e62b8f306dc28a80629780
BLAKE2b-256 7aebc4146c32a9cefd09a82971086844c755a17572f804da53d13d23651e579f

See more details on using hashes here.

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