Skip to main content

SimaPro Method File to olca-schema converter

Project description

spm2olca is a simple command line tool that converts a SimaPro LCIA method files to a olca-schema (JSON-LD) package.

Installation

The installation of the package requires that Python >= 3.5 is installed and that the Python Scripts folder is in your system path. Then, you can just use pip to install it:

pip install spm2olca

After this you should be able to run the tool anywhere on your system. You can test this by executing the following command:

spm2olca -h

To uninstall it, just execute the following command:

pip uninstall spm2olca

Usage

Just type the spm2olca command followed by the SimaPro CSV file with LCIA methods you want to convert:

spm2olca "My Method.csv"

This will generate the olca-schema package which will have the same file name but with a .zip extension. This file can be then imported into openLCA.

To see additional options use the help flag -h:

spm2olca -h

Additional options:

  • -out: define the name of the output file

  • -skip_unmapped: LCIA factors with unmapped flows are not included (only applicable when a flow mapping is provided)

  • -log: define the log level (e.g. ‘all’ will log everything)

  • -units: a CSV file with unit mappings that should be used

  • -flows: a CSV file with flow mappings that should be used

A command with all options could look like this:

spm2olca -out=out.zip -log=all -skip_unmapped -units=units.csv -flows=flows.csv Method.csv

Mapping files

You can specify mapping files for flows and units that should be used in the conversion. If no unit mapping file is given, spm2olca will take a default mapping file in the conversion. For flows, new flows will be created if no mapping file is provided or if they are not contained in the mapping file. The general format of these mapping files is:

  • CSV files with semicolons as separator

  • UTF-8 encoded without a byte order mark

  • no column headers

Unit mappings

Units are mapped by name to openLCA units and flow properties. The mapping file must have the following columns:

0.  SimaPro name of the unit
1.  openLCA reference ID of the unit
2.  openLCA name of the flow property
3.  openLCA reference ID of the flow property

Flow mappings

The SimaPro flows are mapped to openLCA reference flows with a CSV mapping file with the following columns:

0.  SimaPro name of the flow (string)
1.  SimaPro compartment of the flow (string)
2.  SimaPro sub-compartment of the flow (string)
3.  SimaPro unit of the flow (string)
4.  openLCA reference ID of the flow (UUID)
5.  openLCA name of the flow (string)
6.  openLCA reference ID of the reference flow property of the flow (UUID)
7.  openLCA name of the reference flow property of the flow (string)
8.  openLCA reference ID of the reference unit of the flow (UUID)
9.  openLCA name of the reference unit of the flow (string)
10. conversion factor: amount_simapro * factor = amount_openlca (double)

This is the same file as in the openLCA reference data. The conversion factor f converts a flow amount from SimaPro a_s in the SimaPro reference unit to the respective amount of the flow in the openLCA reference unit a_o:

a_o = f * a_s

e.g.

a_o = [m3] = 0.001 * [kg] with a_s = [kg]

Thus, the value of an SimaPro LCIA factor is divided by the conversion factor for such a mapped flow when converted to openLCA, e.g.:

lcia_o = 2000/[m3] = 2/(0.001*[kg]) with a_s = [kg]

The structure of a SimaPro LCIA method file

In the following, the format of a SimaPro LCIA method file is shown in an EBNF like notation:

(* A LCIA method file contains a file header, LCIA methods, and flow lists *)
MethodFile  = FileHeader
              { Method }

              { UnitList }
              { FlowList };

(* The file header contains meta-data about the file format, column separator
   etc. *)
FileHeader  = "{" ... "}";

(* Each LCIA method starts with a line "Method" and ends with a line "End". It
   contains some method meta data, the LCIA categories*)
Method      = "Method"
              MethodMetaData
              { ImpactCategory }
              { NWSet }
              { DamageCategory } ;

(* An LCIA category starts with the line "Impact category" directly followed by
   a line with the meta-information like name and reference unit. *)
ImpactCategory   = "Impact category"
                   ImpactCategory ";" ReferenceUnit ;
                   ImpactFactors ;

(* The LCIA factors are written into a section starting with the header
   "Substances" followed with an LCIA factors each in a separate row. *)
ImpactFactors = "Substances"
                 { Compartment ";" SubCompartment ";" FlowName ";" CasNumber ";" ImpactFactor ";" Unit} ;


(* The weighting section in a normalization weighting set is optional *)
NWSet = "Normalization-Weighting set"
        NWSetName
        EmptyLine
        "Normalization"
        { ImpactCategory ";" NormalizationFactor }
        [
          "Weighting"
          ImpactCategory ";" WeightingFactor
        ];

(* A damage category starts with the header "Damage category" and contains a
   damage factor for each impact category. *)
DamageCategory = "Damage category"
                 DamageCategory ";" ReferenceUnit
                 EmptyLine
                 "Impact categories"
                 { ImpactCategory ";" DamageFactor }

QuantityList = "Quantities"
               { QuantityName ";" }

UnitList = "Units"
           { UnitSymbol ";" QuantityName ";" UnitFactor ";" ReferenceUnitName} ;

(* A flow list starts with a line with the flow type (e.g. "Waterborne emissions"
   followed by the meta data of the flows of this type with a separate line for
   each flow. *)
FlowList = <FlowType>
           { FlowMetaData }
           "End" ;

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

spm2olca-1.1.0.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

spm2olca-1.1.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file spm2olca-1.1.0.tar.gz.

File metadata

  • Download URL: spm2olca-1.1.0.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for spm2olca-1.1.0.tar.gz
Algorithm Hash digest
SHA256 2dce3f3ba4b612bbd48f5708500f09e6f10df9e452b4b1de7a858d5ed522c5e7
MD5 9d5b41f5e4adeb89b89f896c316edd01
BLAKE2b-256 bfbde8fa0347603cad4779372e72bf652039c09cf2e5db3f853e14d3f5355809

See more details on using hashes here.

File details

Details for the file spm2olca-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for spm2olca-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6539ca1927a1a605ff14cb0ba27321926891f2fd9f9410a1072987f19fdd81e9
MD5 7a71d0b0028efa353d469886ddcca2fc
BLAKE2b-256 9051193dbb3dfb7f5a44cc6762ae1e33a7c7c1f38ca03a562b6079b2380e5862

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