openlca-python-tutorial
openlca-python-tutorial copied to clipboard
How to choose LCI method
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?
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!')