Skip to content

Commit

Permalink
import export change by positive or negative
Browse files Browse the repository at this point in the history
  • Loading branch information
yunusozsahin committed Jul 18, 2019
1 parent a67f72c commit d150379
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions urbs/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,14 @@ def get_timeseries(instance, stf, com, sites, timesteps=None):
df_transmission = get_input(instance, 'transmission')
if com in set(df_transmission.index.get_level_values('Commodity')):
imported = get_entity(instance, 'e_tra_out')
minus_imported = imported[imported < 0]
minus_imported = -1 * minus_imported.swaplevel('sit', 'sit_')
imported = imported[imported >= 0]
imported = pd.concat([imported, minus_imported])
imported = imported.loc[timesteps].xs(
[stf, com], level=['stf', 'com'])
min
imported = imported.unstack(level='tra').sum(axis=1)
#exported_help = imported.loc[imported < 0]
#imported.loc[imported >= 0]
imported = imported.unstack(
level='sit_')[sites].fillna(0).sum(
axis=1)
Expand All @@ -161,6 +164,10 @@ def get_timeseries(instance, stf, com, sites, timesteps=None):
imported = drop_all_zero_columns(imported)

exported = get_entity(instance, 'e_tra_in')
minus_exported = exported[exported < 0]
minus_exported = -1 * minus_exported.swaplevel('sit', 'sit_')
exported = exported[exported >= 0]
exported = pd.concat([exported, minus_exported])
exported = exported.loc[timesteps].xs(
[stf, com], level=['stf', 'com'])
exported = exported.unstack(level='tra').sum(axis=1)
Expand Down

0 comments on commit d150379

Please sign in to comment.