Skip to content

Commit

Permalink
Merge pull request #43 from OnSSET/elecstatus_cleanup
Browse files Browse the repository at this point in the history
deleted seperate_elec_status
  • Loading branch information
oluchee committed Nov 27, 2019
2 parents 0b91e8c + 54f25db commit 2c1044d
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions onsset/onsset.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,7 @@ def elec_current_and_future(self, elec_actual, elec_actual_urban, elec_actual_ru

logging.info('Calibrate current electrification')
self.df[SET_ELEC_CURRENT] = 0


# This if function here skims through T&D columns to identify if any non 0 values exist; Then it defines priority accordingly.
if max(self.df[SET_DIST_TO_TRANS]) > 0:
Expand Down Expand Up @@ -1072,22 +1073,9 @@ def elec_current_and_future(self, elec_actual, elec_actual_urban, elec_actual_ru
self.df.apply(lambda row: 1 if row[SET_ELEC_CURRENT] == 1 else 99, axis=1)

return elec_modelled, rural_elec_ratio, urban_elec_ratio


@staticmethod
def separate_elec_status(elec_status):
"""
Separate out the electrified and unelectrified states from list.
"""

electrified = []
unelectrified = []

for i, status in enumerate(elec_status):
if status:
electrified.append(i)
else:
unelectrified.append(i)
return electrified, unelectrified


@staticmethod
def get_2d_hash_table(x, y, unelectrified, distance_limit):
Expand Down Expand Up @@ -1236,7 +1224,12 @@ def elec_extension(self, grid_calc, max_dist, year, start_year, end_year, timest
grid_connect_limit -= densification_connections

cell_path_adjusted = list(np.zeros(len(status)).tolist())
electrified, unelectrified = self.separate_elec_status(status)


electrified = self.df[SET_ELEC_FUTURE_GRID + "{}".format(year)].loc[self.df[SET_ELEC_FUTURE_GRID + "{}".format(year)]==1].index.values.tolist()

unelectrified=self.df[SET_ELEC_FUTURE_GRID + "{}".format(year)].loc[self.df[SET_ELEC_FUTURE_GRID + "{}".format(year)]==0].index.values.tolist()


if (prio == 2) or (prio == 4):
changes = []
Expand Down

0 comments on commit 2c1044d

Please sign in to comment.