+1 vote
865 views
Hi,

With olca-ipc, I want to insert a flow under AGRIBALYSE/Agricultural in my flows categories tree. I imported Ecoinvent and Agribalyse databases.

The problem is that the processes tree also has AGRIBALYSE/Agricultural. Then when I use `client.find(olca.Category, 'Agricultural'`, the item retrieved is the ref to the processes category. Which is normal as the `find()` function retrieves the first item found. So finally I'm trying to insert a flow in the process tree.

Any clue to solve it ? Or maybe with something else than olca-ipc ?
in openLCA by (700 points)

1 Answer

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

You could use the `get_all` method to get all categories from the database: https://github.com/GreenDelta/olca-ipc.py/blob/master/olca/ipc.py#L94

It returns a generator over which you can iterate to find your category. Flow categories are tagged with `FLOW` as model type.

>>> import olca

>>> client = olca.Client(8080)

>>> next(client.get_all(olca.Category)).model_type

<ModelType.FLOW: 'FLOW'>

...