databaseuuidbrightway

Finding the UUID of a biosphere3 flow in Brightway2


Is there a Brightway method to retrieve the UUID of a specific biosphere3 flow? My desired biosphere flow is:

'Water, lake' (cubic meter, None, ('natural resource', 'in water'))

Using the name fails to link my custom LCIA method to the flow.


Solution

  • here is the simplest way to do it.

    In [1]: import bw2data as bd
    
    In [2]: bd.projects.set_current('yourProject')
    
    In [3]: bio = bd.Database('biosphere3')
    # search for water
    In [4]: water = bio.search('Water, lake')
    # check the returned list
    In [5]: water
    Out[5]: ['Water, lake' (cubic meter, None, ('natural resource', 'in water'))]
    # select the one you want by index
    In [6]: water = water[0]
    # get the code
    In [7]: water['code']
    Out[7]: '1acb026e-9de6-48fe-9e0d-be4d24125bbc'
    # for more information about the flow
    In [8]: water.__dict__
    Out[8]: 
    {'_document': <ActivityDataset: 919>,
     '_data': {'categories': ('natural resource', 'in water'),
      'code': '1acb026e-9de6-48fe-9e0d-be4d24125bbc',
      'CAS number': '007732-18-5',
      'synonyms': ['oxidane'],
      'name': 'Water, lake',
      'database': 'biosphere3',
      'unit': 'cubic meter',
      'type': 'natural resource',
      'id': 919}}