Skip to content

Commit 6ec6fa4

Browse files
tghoshnrelhottleta
andcommitted
Small changes to make code cleaner for excluded regions
Co-Authored-By: hottleta <[email protected]>
1 parent 84d72da commit 6ec6fa4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

electricitylci/generation_mix.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,10 +365,12 @@ def olcaschema_usaverage(database, gen_dict, subregion=None):
365365
if subregion is None:
366366
subregion = model_specs.regional_aggregation
367367
generation_mix_dict = {}
368-
368+
# croppping the database according to the current fuel being considered
369+
#Not choosing the Hawaiian and Alaskan regions.
369370
us_database = create_generation_mix_process_df_from_egrid_ref_data(subregion='US')
370371
#Not choosing the Hawaiian and Alaskan regions.
371-
us_database = us_database[(us_database['Subregion'] != 'HIMS') & (us_database['Subregion'] != 'HIOA') & (us_database['Subregion'] != 'AKGD') & (us_database['Subregion'] != 'AKMS')]
372+
excluded_regions = ['HIMS','HIOA','AKGD','AKMS']
373+
us_database=us_database.loc[~us_database["Subregion"].isin(excluded_regions),:]
372374
df2 = us_database.groupby(['FuelCategory'])['Electricity'].agg('sum').reset_index()
373375
df2['Electricity_fuel_total'] = df2['Electricity']
374376
del df2['Electricity']
@@ -391,7 +393,7 @@ def olcaschema_usaverage(database, gen_dict, subregion=None):
391393
# fuelname = row['Fuelname']
392394
# croppping the database according to the current fuel being considered
393395
#Not choosing the Hawaiian and Alaskan regions.
394-
if reg == 'HIMS' or reg == 'HIOA' or reg == 'AKGD' or reg == 'AKMS':
396+
if reg in excluded_regions:
395397
continue
396398
else:
397399
database_f1 = database_reg[

0 commit comments

Comments
 (0)