ecoinvent 3.1 cutoff has unlinked exchanges in bw2 dev / win 7 /py3

Issue #19 new
giuseppe cardellini
created an issue

Hey Chris,

Hi am installing bw2 on a conda enviro in windows 7 32 bit (py 3.4.4). Just followed the advanced installation (https://docs.brightwaylca.org/advanced-installation.html#advanced-installation) and installed the development version (pip install --no-cache-dir --pre brightway2) but while there are no prob with ei 2.2 the 3.1 cutoff , that should work smoothly,returns several unlinked exchanges, see below

In [8]: ei31cutoff = SingleOutputEcospold2Importer(
    "C:\\Users\\Giuseppec\\Downloads\\cutoff\\datasets",
    "ecoinvent 3.1 cutoff")
Extracting ecospold2 files:
0%                          100%
[##############################] | ETA: 00:00:00 | Item ID: fff527b1-0fe4-4
Total time elapsed: 00:01:52
Title: Extracting ecospold2 files:
  Started: 02/04/2016 15:50:18
  Finished: 02/04/2016 15:52:11
  Total time elapsed: 00:01:52
  CPU %: 87.200000
  Memory %: 19.460622
Extracted 11301 datasets in 114.01 seconds

In [9] ei31cutoff.apply_strategies()
Applying strategy: normalize_units
Applying strategy: remove_zero_amount_coproducts
Applying strategy: remove_zero_amount_inputs_with_no_activity
Applying strategy: remove_unnamed_parameters
Applying strategy: es2_assign_only_product_with_amount_as_reference_product
Applying strategy: assign_single_product_as_activity
Applying strategy: create_composite_code
Applying strategy: drop_unspecified_subcategories
Applying strategy: link_biosphere_by_flow_uuid
Applying strategy: link_internal_technosphere_by_composite_code
Applying strategy: delete_exchanges_missing_activity
Applying strategy: delete_ghost_exchanges
Applying strategy: nuncertainty
Applied 13 strategies in 4.51 seconds

In [10]: ei31cutoff.statistics()
11301 datasets
521712 exchanges
780 unlinked exchanges
  Type biosphere: 12 unique unlinked exchanges
Out[7]:
(11301, 521712, 780)

Comments (3)

  1. Chris Mutel repo owner

    Thanks for the bug report.

    So, the elementary flow list (ElementaryExchanges.xml) in 3.1 has flows like this:

      <elementaryExchange id="4f26b71f-aac8-4cd4-81ed-02c64c24bca5" unitId="487df68b-4994-4027-8fdc-a4dc298257b7" casNumber="000208-96-8">
        <name xml:lang="en">Acenaphthylene_temp</name>
        <unitName xml:lang="en">kg</unitName>
        <compartment subcompartmentId="7011f0aa-f5f9-4901-8c10-884ad8296812">
          <compartment xml:lang="en">air</compartment>
          <subcompartment xml:lang="en">unspecified</subcompartment>
        </compartment>
      </elementaryExchange>
    

    Which is obviously complete nonsense - what the hell is Acenaphthylene_temp? These flows no longer exist in the 3.2 elementary flow list. As we are no using the 3.2 list to build up the flows in the biosphere3 database, this gives us linking errors.

    In the short term, a good workaround would just be to use 3.2 - it has a lot of improvements over 3.1 and no real drawbacks that I am aware of. In the meantime I will have to manually add a migration to change the 3.1 flows to 3.2 equivalents.

  2. giuseppe cardellini reporter

    Hey Chris, so, just to be sure I understood, I checked ecospold2_biosphere.py file in both dev (latest) installation and the previous one (0, 2, "dev4") and now the bw2 default biosphere db is the one of ei 3.2 (installed with bw2setup) that is the prob. All clear. Thanks! G

  3. Log in to comment