polca / premise

Coupling Integrated Assessment Models output with Life Cycle Assessment.
BSD 3-Clause "New" or "Revised" License
100 stars 45 forks source link

A problem about energy-perspective-2050-switzerland example #169

Open MMahdi97 opened 3 weeks ago

MMahdi97 commented 3 weeks ago

Hello everyone, I am trying to run the Swiss case example but it seems there is an issue my code is here

 fp = r"https://raw.githubusercontent.com/premise-community-scenarios/energy-perspective-2050-switzerland/main/datapackage.json"
    ep2050 = Package(fp)

    bw.projects.set_current("your_bw_project")

    ndb = NewDatabase(
            scenarios = [
                {"model":"image", "pathway":"SSP2-Base", "year":2050,},
                {"model":"image", "pathway":"SSP2-RCP26", "year":2030,},
            ],        
            source_type="ecospold", # <--- this is NEW
            source_file_path=r"C:\Ecoinvent39_cut_off\ecoinvent 3.9_cutoff_ecoSpold02\datasets", # <-- this is NEW
            source_version="3.9",
            key='tUePmX_S5B8ieZkkM7WUU2CnO8SmShwmAeWK9x2rTFo=',
            external_scenarios=[
                ep2050, # <-- list datapackages here
            ] 
        )

and the error is here: image

Does anyone know how to solve this issue? Thank you so much for helping.

romainsacchi commented 1 week ago

Hello @MMahdi97

please update premise to 2.1.1.dev2 (pip install premise==2.1.1.dev2). From premise v.2 on, the syntax for external scenarios changed a little:


 fp = r"https://raw.githubusercontent.com/premise-community-scenarios/energy-perspective-2050-switzerland/main/datapackage.json"
ep2050 = Package(fp)

bw.projects.set_current("your_bw_project")

ext = [
  "scenario": "BAU", "data": ep2050
]

  ndb = NewDatabase(
          scenarios = [
              {"model":"image", "pathway":"SSP2-Base", "year":2050, "external scenarios": ext},
              {"model":"image", "pathway":"SSP2-RCP26", "year":2030, "external scenarios": ext},
          ],        
          source_type="ecospold", # <--- this is NEW
          source_file_path=r"C:\Ecoinvent39_cut_off\ecoinvent 3.9_cutoff_ecoSpold02\datasets", # <-- this is NEW
          source_version="3.9",
          key='xxxx',
      )

Also, I know the decryption cna be found in some notebooks, but please refrain for posting it publicly.