Giter Site home page Giter Site logo

Comments (4)

cmutel avatar cmutel commented on July 29, 2024

Fixed in 0.8.12

from brightway2-io.

IsaacZhucheng avatar IsaacZhucheng commented on July 29, 2024

Hi @cmutel Sorry to bother again. I might not be doing this the correct way. I update bw2io and create a new proejct, re-use the codes above but getting the same error. Should I use your import_ecoinvent_release instead?
My brightway2 is 2.4.4 (it says it is not compatible with 0.8.12 though, but I didn't find a newer version)

from brightway2-io.

tngTUDOR avatar tngTUDOR commented on July 29, 2024

This seems to have been fixed for legacy, but I can reproduce the error with bw25:

In [1]: import bw2data as bd

In [2]: import bw2io as bi

In [3]: bd.__version__
Out[3]: (4, 0, 'DEV33')

In [4]: bi.__version__
Out[4]: (0, 9, 'DEV26')
In [13]: importer = bi.SingleOutputEcospold2Importer('/home/upolig/Documents/dbs/ecoinvent/3.10/datasets/', 'ecoinvent-3.10-cutoff')
Extracting XML data from 23523 datasets
Extracted 23523 datasets in 38.39 seconds

In [14]: importer.apply_strategies()
Applying strategy: normalize_units
Applying strategy: update_ecoinvent_locations
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: fix_ecoinvent_flows_pre35
Applying strategy: drop_temporary_outdated_biosphere_flows
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: remove_uncertainty_from_negative_loss_exchanges
Applying strategy: fix_unreasonably_high_lognormal_uncertainties
Applying strategy: convert_activity_parameters_to_list
Applying strategy: add_cpc_classification_from_single_reference_product
Applying strategy: delete_none_synonyms
Applying strategy: update_social_flows_in_older_consequential
Applying strategy: set_lognormal_loc_value
Applied 22 strategies in 3.55 seconds

In [15]: importer.statistics()
23523 datasets
743409 exchanges
4034 unlinked exchanges
  Type biosphere: 62 unique unlinked exchanges
Out[15]: (23523, 743409, 4034)

from brightway2-io.

tngTUDOR avatar tngTUDOR commented on July 29, 2024

As of bw2io version 0.9.DEV26,

Importing ei 3.10 with ecoinvent_interface βœ…

This works for both, legacy and bw25.

For the "legacy" bw2 io, you need to make sure you have bwio version 0.8.12 exactly, install ecoinvent_interface and follow the Howto instructions at the bottom of this comment.

Importing ei 3.10 with SingleOutputEcospold2Importer πŸ•³οΈ

  • This requires a biosphere db to exist already in the project (this can be done with bw2setup())
  • the bw2setup() function will create a biosphere db compatible with ecoinvent 3.9: from this file, at this point in code:
def create_default_biosphere3(overwrite=False):
    from .importers import Ecospold2BiosphereImporter

    eb = Ecospold2BiosphereImporter()
    eb.apply_strategies()
    eb.write_database(overwrite=overwrite)

(because the Ecospold2BiosphereImporter() class will take as default "3.9" as version, and because there's also no "3.10" file.

Hence, when trying to use the SingleOutputEcospold2Importer to import ecoinvent 3.10, there are unlinked biosphere exchanges. so this leads to πŸ•³οΈ

What to do ?

The current solution to add ecoinvent 3.10 to a project, using brightway25 is to use the ecoinvent_interface feature of bw2io:

Prerequisite

install ecoinvent_interface:

pip install ecoinvent_interface

or

conda install -c conda-forge ecoinvent_interface

Howto

import bw2data as bd
import bw2io as bi

bd.projects.set_current('β˜•-rulez')
bi.import_ecoinvent_release(version="3.10", \ 
    system_model="cutoff", username=( ˘ ³˘)γƒŽΒ°οΎŸΒΊβο½‘, password=βšƒ)

from brightway2-io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.