databaseimportbrightway

Brightway2 and ecoinvent 3.10 -- unlinked exchanges


Trying to import the ecoinvent 3.10 cutoff database in brightway2 with the latest bw2io version 0.8.12 results in:

4034 unlinked exchanges
62 unique unlinked exchanges

I have updated conda and brightway2 and installed bw2io version 0.8.12, which I understand from a post by Chris Mutel here should enable ecoinvent 3.10 to be imported successfully. I then deleted the biosphere3 database, created a new Brightway2 project, and tried to import the ecoinvent 3.10 cutoff database. I am able to complete the import by dropping unlinked exchanges (code snippet below), and my small LCA project is working for now, but I would appreciate it if anyone could point out if I've missed any steps to be able to import without unlinked exchanges, or could confirm if this is an issue that needs to be resolved by the Brightway team.

if 'ecoinvent 3.10 cutoff' in bw.databases:
    print("Database has already been imported")
else:
    ei310 = bw.SingleOutputEcospold2Importer(fpei310, 'ecoinvent 3.10 cutoff')
    ei310.apply_strategies()
    ei310.statistics()
    ei310.drop_unlinked(i_am_reckless=True)
    ei310.write_database()

In case it is useful, a list of the 62 unique unlinked exchanges is provided below. All have Type = 'biosphere', Unit = 'kilogram', Reference Product = Categories = Location = 'unknown'.

Name                        Amount
1,3-Dichloropropene         3.79816E-14
2,4-D                       5.1299E-16
2,4-D dimethylamine salt    6.43555E-20
2-Chlorophenol              4.56463E-12
2-Methyl-2-butanol          7.96412E-17
Acenaphthylene              1.32035E-08
Acetic anhydride            5.89156E-09
Alpha-cypermethrin          2.26632E-18
Anthracene                  0.000894036
Benz(a)anthracene           5.13917E-09
Benzo(b)fluoranthene        4.91703E-09
Benzo(ghi)perylene          5.40864E-09
Benzo(k)fluoranthene        5.79605E-10
Chlorpyrifos                1.51881E-17
Chrysene                    3.60576E-09
Clethodim                   1.54785E-17
Clodinafop-propargyl        2.94307E-22
Clopyralid                  1.14674E-17
Cloquintocet-mexyl          7.36163E-23
Deltamethrin                1.91E-09
Dibenz(a,h)anthracene       1.14451E-09
Diflufenican                3.74885E-18
Diflufenzopyr               7.5E-09
Dimethoate                  0.0000036
Dimethyl malonate           0.00025
Ethalfluralin               0.0000085
Fluoranthene                1.86344E-08
Fluorene                    8.18379E-09
Fluquinconazole             3.58937E-18
Fluroxypyr                  5.48504E-18
Fluxapyroxad                0.0000002
Fungicides, unspecified     3.88286E-18
Glufosinate ammonium        0.00000014
Herbicides, unspecified     5.82429E-17
Imidacloprid                5.09564E-19
Indeno(1,2,3-cd)pyrene      5.40864E-09
Iodine                      4.57498E-10
Ketene                      1.38982E-09
Mefentrifluconazole         1.09316E-13
Methylcyclohexane           0.00025
Metsulfuron-methyl          5.27856E-19
N,N-Dimethylformamide       3.87314E-13
Naphthalene                 6.04093E-08
Nitrogen                    5.20858E-12
Oxyfluorfen                 8.69761E-20
Paraquat                    5.04032E-17
Peracetic acid              5.20058E-08
Phenanthrene                4.36693E-07
Pyrene                      1.14006E-08
Saflufenacil                0.000001
Sodium chloroacetate        0.007818092
Sodium methoxide            2.1053E-10
Sulfur dichloride           8.4437E-15
Sulfur trioxide             0.001817198
Thionyl chloride            2.35023E-14
Triallate                   0.000000268
Tribenuron-methyl           0.000000005
Triclopyr                   2.29534E-17
Trifluralin                 1.79647E-16
m-Nitrotoluene              8.88325E-06
o-Nitrotoluene              0.000145939
p-Nitrotoluene              9.51777E-05


Solution

  • The syntax for importing ecoinvent has changed to take advantage of the ecoinvent_interface library. You no longer need to run bw2setup (as you noticed, this installs biosphere flows from version 3.9). Instead, you can simply do:

    import bw2data as bd
    import bw2io as bi
    bd.projects.set_current("ecoinvent-3.10-cutoff")
    bi.import_ecoinvent_release("3.10", "cutoff")
    

    Note that the created biosphere database has the default name ecoinvent-3.10-biosphere instead of biosphere3 - explicit is better than implicit. This is configurable.