0 votes
42 views

I am working with USLCI and when I attempt to enumerate or access a process generator via IPC I get this error:

ValueError                                Traceback (most recent call last)
<ipython-input-14-c5be51e77ab1> in <module>
----> 1 next(processes)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\olca\ipc.py in get_all(self, model_type)
    103         for r in result:
    104             e = model_type()
--> 105             e.from_json(r)
    106             yield e
.
.
.
ValueError: 'NO_ALLOCATION' is not a valid AllocationType

This is confusing because if I query the openLCA database with something like:

select distinct(DEFAULT_ALLOCATION_METHOD) from tbl_processes

or

select distinct(ALLOCATION_TYPE) from tbl_allocation_factors

I get only:

ECONOMIC

PHYSICAL

NONE

What can I do/update to allow IPC to evaluate the generator and let me move on with my life?

in openLCA by (1.5k points)

1 Answer

0 votes
by (9.8k points)
selected by
 
Best answer

The enumeration values `NO_ALLOCATION` and `USE_DEFAULT_ALLOCATION` were missing in the olca-schema definition, I updated it: http://greendelta.github.io/olca-schema/html/AllocationType.html (yes the types in the olca-schema def. are different than the values in the database)

The olca-ipc.py module is generated from the olca-schema definition. I updated it and uploaded a new veryion to pypi.org: https://pypi.org/project/olca-ipc/0.0.9/. When you update the package, e.g. via `pip install -U olca-ipc` you should get the new version that supports the missing allocation types:

import olca

for e in olca.AllocationType:

  print(e)

this should print:

AllocationType.PHYSICAL_ALLOCATION

AllocationType.ECONOMIC_ALLOCATION

AllocationType.CAUSAL_ALLOCATION

AllocationType.USE_DEFAULT_ALLOCATION

AllocationType.NO_ALLOCATION

ago by (150 points)
This worked for updating the definitions; however, the allocation method is not changed when performing the calculation regardless of which AllocationType is set in the IPC code.
...