openlca-python-tutorial icon indicating copy to clipboard operation
openlca-python-tutorial copied to clipboard

How to choose LCI method

Open gvoigt opened this issue 6 years ago • 1 comments

In the product system tutorial the LCI method is selected via an interactive window

methodDescriptor = ModelSelectionDialog.select(ModelType.IMPACT_METHOD)

How can I choose a method directly in jython? How can I list the possible methods?

gvoigt avatar Jun 20 '18 15:06 gvoigt

You can do this via the ImpactMethodDao, e.g.:


from org.openlca.core.database import ImpactMethodDao

method_for_calculation = None
dao = ImpactMethodDao(db)
for descriptor in dao.getDescriptors():
  if descriptor.name == 'My super LCIA method':
    method_for_calculation = descriptor
    break

if method_for_calculation is None:
  panic('Method not found!')

msrocka avatar Jun 28 '18 05:06 msrocka