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

Use Ecospold2 file - fix unlinked exchanges #189

Open
Youyi77 opened this issue Nov 10, 2024 · 2 comments
Open

Use Ecospold2 file - fix unlinked exchanges #189

Youyi77 opened this issue Nov 10, 2024 · 2 comments

Comments

@Youyi77
Copy link

Youyi77 commented Nov 10, 2024

Dear premise team,

I tried to directly transform the Ecospold2 files. But failed multiple times. I want to do a simple transformation for one Ecospold2 file using the default IAM scenario. Any guidance would be greatly appreciated! Thanks so much.

versions:
python: 3.10.11
ecoinvent: 3.9.1
premise: 2.2.1

Here is the error message I received:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[2], line 1
----> 1 ndb = NewDatabase(
      2         scenarios = [
      3             {"model":"remind", "pathway":"SSP2-Base", "year":2020}
      4         ],        
      5         source_type="ecospold", # <--- this is NEW
      6         source_file_path=r"[/Users/xuyouyi/Desktop/premise/EcoSpold02](http://localhost:8889/Desktop/premise/EcoSpold02)", # <-- this is NEW
      7         source_version="3.9.1",
      8     key='xxxxx', # <-- decryption key
      9     )

File [/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/premise/new_database.py:604](http://localhost:8889/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/premise/new_database.py#line=603), in NewDatabase.__init__(self, scenarios, source_version, source_type, key, source_db, source_file_path, additional_inventories, system_model, system_args, use_cached_inventories, use_cached_database, external_scenarios, quiet, keep_imports_uncertainty, keep_source_db_uncertainty, gains_scenario, use_absolute_efficiency, biosphere_name)
    602 print("- Extracting inventories")
    603 if use_cached_inventories:
--> 604     data = self.__find_cached_inventories(source_db)
    605     if data is not None:
    606         self.database.extend(data)

File [/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/premise/new_database.py:686](http://localhost:8889/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/premise/new_database.py#line=685), in NewDatabase.__find_cached_inventories(self, db_name)
    684 # else, extract the database, pickle it for next time and return it
    685 print("Cannot find cached inventories. Will create them now for next time...")
--> 686 data = self.__import_inventories()
    687 pickle.dump(data, open(file_name, "wb"))
    688 print(
    689     "Data cached. It is advised to restart your workflow at this point.\n"
    690     "This allows premise to use the cached data instead, which results in\n"
    691     "a faster workflow."
    692 )

File [/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/premise/new_database.py:823](http://localhost:8889/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/premise/new_database.py#line=822), in NewDatabase.__import_inventories(self)
    820     unlinked.extend(inventory.list_unlinked)
    822 if len(unlinked) > 0:
--> 823     raise ValueError("Fix the unlinked exchanges before proceeding")
    825 return data

ValueError: Fix the unlinked exchanges before proceeding

Also my code here:

ndb = NewDatabase(
        scenarios = [
            {"model":"remind", "pathway":"SSP2-Base", "year":2020}
        ],        
        source_type="ecospold", # <--- this is NEW
        source_file_path=r"/Users/xuyouyi/Desktop/premise/EcoSpold02", # <-- this is NEW
        source_version="3.9.1",
    key='xxxxxxxxxx', # <-- decryption key
    )
@OliverLyon
Copy link

The unlinked changes error also happens to 3.8 database as well.

@Youyi77
Copy link
Author

Youyi77 commented Nov 13, 2024

I took a closer look at the error message, and it lists numerous unlinked exchanges. Does this mean that the folder containing my EcoSpold02 files should include all the LCI datasets downloaded from the Ecoinvent website, rather than just the specific EcoSpold02 files I want to transform?

@Youyi77 Youyi77 changed the title Use Ecospold2 file - fix unlinked changes Use Ecospold2 file - fix unlinked exchanges Nov 13, 2024
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