@@ -183,11 +183,27 @@ def check_inputs(self) -> None:
183
183
techno_compositions = self .technology_compositions
184
184
tech_specifics = self .tech_specifics
185
185
186
+ dict_df_names = {
187
+ 'model' : model ,
188
+ 'mapping' : mapping ,
189
+ 'mapping_esm_flows_to_CPC_cat' : mapping_esm_flows_to_CPC_cat ,
190
+ 'unit_conversion' : unit_conversion ,
191
+ 'efficiency' : efficiency ,
192
+ 'lifetime' : lifetime ,
193
+ 'tech_specifics' : tech_specifics ,
194
+ 'technology_compositions' : techno_compositions ,
195
+ }
196
+
186
197
try :
187
198
self .technology_compositions .Components = self .technology_compositions .Components .apply (ast .literal_eval )
188
199
except ValueError :
189
200
pass
190
201
202
+ # Check for duplicates in all dataframes
203
+ for df_name , df in dict_df_names .items ():
204
+ if df .duplicated ().any ():
205
+ print (f"Warning: there are duplicates in the { df_name } dataframe. Please check your inputs." )
206
+
191
207
# Check if the technologies and resources in the model file are in the mapping file
192
208
set_in_model_and_not_in_mapping = set ()
193
209
for tech_or_res in list (model .Name .unique ()):
@@ -275,6 +291,18 @@ def check_inputs(self) -> None:
275
291
f"(this will not be a problem in the workflow).\n " )
276
292
print (f"--> { sorted (set_in_tech_specifics_and_not_in_mapping )} \n " )
277
293
294
+ # Check that sub-technologies in the technology_compositions file are in the mapping file
295
+ set_sub_techs_not_in_mapping = set ()
296
+ for tech in list (techno_compositions .Name ):
297
+ sub_techs = [sub_tech for sub_tech in self .technology_compositions .Components
298
+ if sub_tech not in list (mapping .Name )]
299
+ if len (sub_techs ) > 0 :
300
+ set_sub_techs_not_in_mapping .add (tech )
301
+ if len (set_sub_techs_not_in_mapping ) > 0 :
302
+ print (f"List of technologies that are in the technology_compositions file but not in the mapping file "
303
+ f"(this will not be a problem in the workflow).\n " )
304
+ print (f"--> { sorted (set_sub_techs_not_in_mapping )} \n " )
305
+
278
306
def create_esm_database (
279
307
self ,
280
308
return_database : bool = False ,
0 commit comments