Skip to content

Commit

Permalink
Added sorting of consumed
Browse files Browse the repository at this point in the history
  • Loading branch information
smuellr committed Nov 14, 2015
1 parent 5f864d0 commit 080777a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions urbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1648,13 +1648,21 @@ def plot(prob, com, sit, timesteps=None, power_unit='MW', energy_unit='MWh'):
index=created.index[-1:]+1, columns=created.columns)
for col in std.columns:
std[col] = np.std(created[col])
# norming by mean value
std[col] = std[col] / np.mean(created[col])
# sort created ascencing with std i.e. base load first
created = created.append(std)
new_columns = created.columns[created.ix[created.last_valid_index()].argsort()]
created = created[new_columns][:-1]

if len(consumed.columns) > 1:
std = pd.DataFrame(np.zeros_like(consumed.tail(1)),
index=consumed.index[-1:]+1, columns=consumed.columns)
for col in std.columns:
std[col] = np.std(consumed[col])
# sort consumed ascencing with std i.e. base load first
consumed = consumed.append(std)
new_columns = consumed.columns[consumed.ix[consumed.last_valid_index()].argsort()]
consumed = consumed[new_columns][:-1]

# PLOT CREATED
ax0 = plt.subplot(gs[0])
sp0 = ax0.stackplot(created.index, created.as_matrix().T, linewidth=0.15)
Expand Down

0 comments on commit 080777a

Please sign in to comment.