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

Uploaded Source

Built Distribution

olca_schema-2.4.0-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: olca_schema-2.4.0.tar.gz
  • Upload date:
  • Size: 33.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for olca_schema-2.4.0.tar.gz
Algorithm Hash digest
SHA256 2686a3b02a4d6f559c7fe81782c092afcb823f473d4b588470c3820633ac82cf
MD5 bc479af9b68d2c0963b6cb26062e9cb1
BLAKE2b-256 ba9333e352dcc01968d5f2451a62fafc97ed0bc0f4466254fd30673ac40553ce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: olca_schema-2.4.0-py3-none-any.whl
  • Upload date:
  • Size: 28.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for olca_schema-2.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7779e41b2e5333d934a9d6af6fcfbf4f1110d2ed8770cb64464b042875d676a4
MD5 7eef43073bdc229ce1bd3829b917c9cc
BLAKE2b-256 fffb0a1b97c3df8e63d9e1a80b8137d7bc2617aafb86d942e3716fc2f02672e9

See more details on using hashes here.

Supported by

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