polca / premise

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

Unable to work with the new IAM data (REMIND / update_fuels) #80

Closed gbatot closed 2 years ago

gbatot commented 2 years ago

Hi,

Since the recent updates, I am unable to set up databases with the new REMIND scenarios already included in the library. It works fine with the REMIND “SPP2-Base” scenario, yet I got an error with the others during the update_fuels step.

It seems that during the generation of new fuel markets, no suppliers can be identified.

Any ideas how to solve this issue?

Many thanks.


Here is the error(s) using premise v1.2.4 with either "SSP2-NPi", "SSP2-PkBudg1150", "SSP2-PkBudg500" scenario for the year 2030 :

////////////////////////////// FUELS /////////////////////////////// Generate region-specific direct air capture processes. Generate region-specific hydrogen production pathways. Generate region-specific hydrogen supply chains. Generate region-specific biogas and syngas supply chains. Generate region-specific synthetic fuel supply chains. Generate region-specific biofuel supply chains. Generate new fuel markets. --> petrol, unleaded

IndexError Traceback (most recent call last) Input In [10], in <cell line: 1>() ----> 1 ndb.update_fuels()

File ~\Miniconda3\envs\bw2\lib\site-packages\premise\ecoinvent_modification.py:767, in NewDatabase.update_fuels(self) 757 if "exclude" not in scenario or "update_fuels" not in scenario["exclude"]: 759 fuels = Fuels( 760 database=scenario["database"], 761 iam_data=scenario["iam data"], (...) 765 version=self.version, 766 ) --> 767 fuels.generate_fuel_markets() 768 scenario["database"] = fuels.database

File ~\Miniconda3\envs\bw2\lib\site-packages\premise\fuels.py:1638, in Fuels.generate_fuel_markets(self) 1633 share = d_fuels[var]["find_share"]( 1634 var, vars_map[fuel], region 1635 ) 1637 if share > 0: -> 1638 possible_suppliers = self.select_multiple_suppliers( 1639 var, d_fuels, dataset, vars_map[fuel] 1640 ) 1641 if not possible_suppliers: 1642 print( 1643 f"ISSUE with {var} in {region} for ds in location {dataset['location']}" 1644 )

File ~\Miniconda3\envs\bw2\lib\site-packages\premise\fuels.py:1429, in Fuels.select_multiple_suppliers(self, fuel, d_fuels, dataset, look_for) 1415 suppliers, counter = [], 0 1417 while not suppliers: 1419 suppliers = list( 1420 ws.get_many( 1421 self.database, 1422 ws.either([ws.contains("name", sup) for sup in possible_names]), 1423 ws.either( 1424 [ 1425 ws.equals("location", item) 1426 for item in possible_locations[counter] 1427 ] 1428 ) -> 1429 if isinstance(possible_locations[counter], list) 1430 else ws.equals("location", possible_locations[counter]), 1431 ws.either( 1432 *[ws.contains("reference product", item) for item in look_for] 1433 ), 1434 ws.doesnt_contain_any( 1435 "reference product", 1436 [ 1437 "petroleum coke", 1438 "petroleum gas", 1439 "wax", 1440 "low pressure", 1441 "pressure, vehicle grade", 1442 ], 1443 ), 1444 ) 1445 ) 1446 counter += 1 1448 if "low-sulfur" in dataset["name"]:

IndexError: list index out of range

romainsacchi commented 2 years ago

Hi @gbatot , sorry about this. This should be fixed with v.1.2.5 which should be up any minute now. Don't forget to clear_cache() after updating. Let me know and re-open the issue if it's not fixed.