Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to Biosphere use #1142

Closed
10 tasks done
marc-vdm opened this issue Nov 29, 2023 · 1 comment · Fixed by #1145
Closed
10 tasks done

Improvements to Biosphere use #1142

marc-vdm opened this issue Nov 29, 2023 · 1 comment · Fixed by #1145
Assignees
Labels
feature Issues/PRs related to a new feature
Milestone

Comments

@marc-vdm
Copy link
Member

marc-vdm commented Nov 29, 2023

Feature request

Current situation:

Managing biosphere versions in AB projects is currently not ideal. Creating a new project installs the most recent version of the biosphere, potentially losing compatibility with older versions. (e.g. #1137).

Biosphere import when project is started

  • When starting a project, Biosphere data needs to be imported before doing anything else
  • AB then installs the most recent version of the biosphere available

image
image

if "biosphere3" not in bw.databases:
self.update.emit(0, "Creating default biosphere for {}".format(project))
bw.create_default_biosphere3()
project_settings.add_db("biosphere3")

Biosphere importer in Brightway

Updating Biosphere

  • When updating biosphere, AB looks for patches in bw2io.data
  • And applies all patches

image

PATCHES = [patch for patch in dir(data) if patch.startswith('add_ecoinvent') and patch.endswith('biosphere_flows')]

for i, patch in enumerate(self.PATCHES):
self.progress.emit(i)
update_bio = getattr(data, patch)
update_bio()

Proposal

What I propose is the following (explained more extensively in sections below):

  • We let user specify the version of ecoinvent they want their biosphere to be compatible with when importing default data
  • We let user specify which version of ecoinvent to update to when updating biosphere data
  • We create an online (hosted on this github repo) file that contains all ecoinvent versions AB is compatible with (currently 3.4-3.9.1), we then use this file for:
    • Showing which versions of ecoinvent can be imported (see also Proper sorting of available ecoinvent versions #1141)
    • Showing which ecoinvent-compatible version of biosphere to install on project creation
    • Showing which ecoinvent-compatible version of biosphere to update to

Downloading a specific version of biosphere

Should provide popup that allows user to choose ecoinvent-compatible version, sorted from highest to lowest
Should provide information that biosphere databases are not always backwards compatible (e.g. ei 3.8 does not work on biosphere for ei 3.9) and that versions cannot be downgraded

TODO

  • Add dialog option to choose version (default to highest)
  • Replace bw.create_default_biosphere3() with an AB version that can call Ecospold2BiosphereImporter(name="biosphere3", version="3.9") directly and call on chosen version
  • Read available version from variable somewhere (see Host file online section below)

Updating to specific version

Should provide popup that allows user to choose ecoinvent-compatible version, sorted from highest to lowest
Should provide information that biosphere databases are not always backwards compatible (e.g. ei 3.8 does not work on biosphere for ei 3.9) and that versions cannot be downgraded

TODO

  • Add dialog option to choose version (default to highest)
  • Only apply patches to max chosen version
  • Read available version from variable somewhere (see Host file online section below)

Show limited list of available ecoinvent versions for importing

Should limit the list of ecoinvent versions shown available for import

TODO

  • Read available version from variable somewhere (see Host file online section below)

Host file online

Host a file on our github with a list per AB version about what ecoinvent versions are compatible

  • Why online? This way users don't need to update AB for the list to be updated, but it would mean we need to keep a list for every version of AB
    • In case a new version of bw2io comes available that is compatible with current version of AB, we don't need users to update AB, we just update the compatibility list online and it should work
    • In case a new patch version of ecoinvent becomes available (e.g. 3.9.1, we can also just update the list, not requiring users to update AB
    • We can smartly write the implementation so we only need to store new version list when something changes
      • if user has AB 2.11 and the online list has 2.12 and 2.10 available, we choose the first version where AB is higher than list version (in this case 2.10)
    • file could look something like this:
      • 2.10.2: [3.4, 3.5, 3.6, 3.7, 3.7.1, 3.8, 3.9, 3.9.1, 3.10]
      • 2.10: [3.4, 3.5, 3.6, 3.7, 3.7.1, 3.8, 3.9, 3.9.1]

TODO

  • Write file like suggested above
  • Read file from internet
  • Local fallback in case of no connection
Copy link

This issue has been implemented in the new release of Activity Browser 🚀 (version 2.9.3), you can get the new version by updating Activity Browser.

🤖beep boop! I'm a bot and this message was an automated action. If updating does not make sense for this issue, just ignore this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Issues/PRs related to a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant