From b0fb8087daa30e59fb2a5ce00a3304cf5cc7e527 Mon Sep 17 00:00:00 2001 From: romainsacchi Date: Tue, 15 Oct 2024 16:54:55 +0200 Subject: [PATCH] Fix issue with proxy powerplant datasets in consequential. --- premise/electricity.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/premise/electricity.py b/premise/electricity.py index 4dddbf79..9bb118ce 100644 --- a/premise/electricity.py +++ b/premise/electricity.py @@ -1966,16 +1966,19 @@ def create_missing_power_plant_datasets(self) -> None: for tech, variable in load_electricity_variables().items(): if not variable.get("exists in database", True): - original = list( - ws.get_many( - self.database, - ws.equals("name", variable["proxy"]["name"]), - ws.equals( - "reference product", - variable["proxy"]["reference product"], - ), - ) - )[0] + try: + original = list( + ws.get_many( + self.database, + ws.equals("name", variable["proxy"]["name"]), + ws.equals( + "reference product", + variable["proxy"]["reference product"], + ), + ) + )[0] + except IndexError: + continue # make a copy new_dataset = copy.deepcopy(original)