+5 votes
2.1k views
Hello,

I would like to create a new LCIA method by merging two existing LCIA methods. For example, I would like to merge TRACI2.1 and CML methods in one LCIA method. The copy and paste function does not work when we create a new LCIA method and it is cumbersome to add 100s of flows and create the LCIA method. So I end up running the same product system twice to calculate results according to TRACI and CML. If it is possible to merge existing LCIA methods to create a new one, then it will save processing time. Is it possible to do this in openLCA?
in openLCA by (220 points)

4 Answers

+7 votes
by (14.0k points)
selected by
 
Best answer

I added an entry to our issue tracker for this: https://github.com/GreenDelta/olca-app/issues/98

The following script shows how to copy an LCIA category from one method to another (tested in openLCA 1.10 but should also work in 1.9):

from org.openlca.core.database import ImpactMethodDao
 
# the name of the indicator / LCIA category you want to copy
INDICATOR = "Climate change - GWP100"
# the method that contains the indicator
SOURCE_METHOD = "CML (baseline) [v4.4, January 2015]"
# the method where you want to have the indicator copied to
TARGET_METHOD = "My method"
 
def main():
  dao = ImpactMethodDao(db)
 
  # load the targe method
  target = dao.getForName(TARGET_METHOD)
  if len(target) == 0:
    log.error("Could not find method {}"TARGET_METHOD)
    return
  target = target[0]
 
  # check that the indicator is not already there
  for i in target.impactCategories:
    if i.name == INDICATOR:
      log.error("The indicator {} already exists in {}",
                INDICATORTARGET_METHOD)
      return
 
  # load the source method
  source = dao.getForName(SOURCE_METHOD)
  if len(source) == 0:
    log.error("Could not find method {}"SOURCE_METHOD)
    return
  source = source[0]
 
  # find the indicator
  indicator = None
  for i in source.impactCategories:
    if i.name == INDICATOR:
      indicator = i
      break
  if indicator is None:
    log.error("Could not find indicator {} in method {}",
              INDICATORSOURCE_METHOD)
    return
 
  # finally, copy the indicator
  log.info("Copy indicator {} from {} to {}",
           INDICATORSOURCE_METHODTARGET_METHOD)
  cloned = indicator.clone()
  target.impactCategories.add(cloned)
  dao.update(target)
  log.info("done")
 
if __name__ == "__main__":
  main()
by (220 points)
Thank you! This code works!
+5 votes
by (330 points)

Either do it with a script as recommended or try it this way: it is a bit time consuming but it works and still saves time compared to processing everything twice or three times.

1. You should create at first a new empty assessment method in openLCA - with title and despription etc.
2. Export your freshly created method and the method, which contains the specific category e.g. the ILCD method.
3. Extract the second - so to say already existing - method.
4. Do NOT extract your empty method, that is important, after extraction no import is possible (I dunno why...)
5.Open for both impact methods the folder: "lcia_methods"
6.Open the .json files with an editor and copy the content in "https://jsonformatter.org". The formatter  makes the file easier to read.
7. Now copy the name and all to the impact category belonging details in your new impact method. For sure only the categories you wanna have in your new method. Add this information in the .json file of your new method.
8. Now open the folder "lcia_categories" folder - find the categories you need and copy those into your new method.
9. Finally you just need to copy all folders, which you havent' touched yet into your new impact method (categories, unit_groups etc.)
10. Import your new method into openLCA - best test is in an empty database. Be sure there is no method existing with the same name or any folder which might be created due to the import process is existing. This could cause problems.

First try should be done with just one category.

I hope this workaround is helpful. It worked for me but it took me a bit.

Cheers,
Steffen

0 votes
by (126k points)
Hello, not yet (or, it is but you need to do it via scripts, it is not really nice to do it via the user interface) - we plan to change this in future.
by (126k points)
I would say yes, since basically the methods are just a compilation of impact category (models), which are somewhat independent - GWP following IPCC, resource depletion maybe CML, asf. , and it is allowed to combine and reorganise them according to goal and scope of the LCA study ideally.
0 votes
by (2.6k points)
I want to second the need for this option!
...