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

Error: Unknown objects #193

Open
OliverLyon opened this issue Jan 15, 2025 · 4 comments
Open

Error: Unknown objects #193

OliverLyon opened this issue Jan 15, 2025 · 4 comments

Comments

@OliverLyon
Copy link

I tried to export IAM scenarios to the superstructure database using ecoinvent 3.7.1. When it is writing activities to SQLite3 database, I received the following error.

UnknownObject: Exchange between ('ecoinvent-3.7.1-cutoff', 'aa7cac3a-3625-41d4-bc54-33e2cf11ec46') and ('super_db_15-01-2025', '00017146-dcc2-4f76-8190-bdce78fb7436') is invalid - one of these objects is unknown (i.e. doesn't exist as a process dataset)

Anyone know how to solve this?

Thanks

@romainsacchi
Copy link
Collaborator

Hi @OliverLyon, how was your biosphere database created?

The recommended way is to use bw2io.ecoinvent.import_ecoinvent_release
https://docs.brightway.dev/en/latest/_modules/bw2io/ecoinvent.html#import_ecoinvent_release

bw2io.ecoinvent.import_ecoinvent_release(
    "3.7",
    "cut-off",
    "ecoinvent_username",
    "ecoinvent_password",
)

Because I think your issue stems from an incorrect biosphere database.

@OliverLyon
Copy link
Author

OliverLyon commented Jan 24, 2025

Hi @OliverLyon, how was your biosphere database created?

The recommended way is to use bw2io.ecoinvent.import_ecoinvent_release https://docs.brightway.dev/en/latest/_modules/bw2io/ecoinvent.html#import_ecoinvent_release

bw2io.ecoinvent.import_ecoinvent_release(
    "3.7",
    "cut-off",
    "ecoinvent_username",
    "ecoinvent_password",
)

Because I think your issue stems from an incorrect biosphere database.

Hi, @romainsacchi:

Thank you for the reply. I created the biosphere database by importing a ecospold file downloaded from ecoinvent using the following code.

ndb = NewDatabase(
scenarios=scenarios, # Scenarios to process
#source_db="ecoinvent-3.7.1-cutoff", # Source database name
source_type="ecospold", # <--- this is NEW
source_db=EI_DATABASE, # Source database name
source_version="3.7.1", # Version of ecoinvent
source_file_path=r"C:\Users\Desktop\EcoInvent\ecoinvent 3.7.1_cutoff_ecoSpold02\datasets",
key='tUePmX_S5B8ieZkkM7WUU2CnO8SmShwmAeWK9x2rTFo=', # An actual decryption key
keep_source_db_uncertainty=True, # Keep ecoinvent uncertainty data
keep_imports_uncertainty=True, # Keep uncertainty in additional inventories
use_absolute_efficiency=True, # Use IAM's absolute efficiencies
quiet=False # Show detailed logs
)

Am I using the correct code or is there any other way to do it?

Thanks.

@romainsacchi
Copy link
Collaborator

Hi @OliverLyon,

your code does not create a biosphere database. Your code creates an instance of a class of premise.

You need to create a brightway project first, and within it, create a biosphere database:

import bw2data
import bw2io

bw2data.projects.set_current("my project")
bw2io.create_default_biosphere3()

And then, before running NewDatabase(), select the project that contains the biosphere database:

bw2data.projects.set_current("my project")

@OliverLyon
Copy link
Author

OliverLyon commented Feb 6, 2025

Hi @OliverLyon,

your code does not create a biosphere database. Your code creates an instance of a class of premise.

You need to create a brightway project first, and within it, create a biosphere database:

import bw2data
import bw2io

bw2data.projects.set_current("my project")
bw2io.create_default_biosphere3()

And then, before running NewDatabase(), select the project that contains the biosphere database:

bw2data.projects.set_current("my project")

Thanks @romainsacchi:

Now I can create the new database. After that I used:
ndb.write_superstructure_db_to_brightway(name="test_superstructure"),
to create a superstructure database, but it gave me an output error of:
UnknownObject: Exchange between ('biosphere3', 'c941d6d0-a56c-4e6c-95de-ac685635218d') and ('test_superstructure_01', '00afab00-8bc1-466c-a00c-6ec34b47627d') is invalid - one of these objects is unknown (i.e. doesn't exist as a process dataset)

Is it the correct way to construct superstructure?

It also gave me an error of:
UserWarning: Skipping migration 'fix-ecoinvent-flows-pre-35' because it isn't installed
warnings.warn(

Is it related to the fault in the end?

Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants