Skip to content

Commit

Permalink
Merge pull request #201 from NREL/bugfix/maximum-constraint2
Browse files Browse the repository at this point in the history
bugfix/Continue to fix max constraint issue
  • Loading branch information
jgu2 authored Jul 31, 2024
2 parents cfe35d7 + bd17fea commit 3f593f2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions calliope_app/api/models/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,15 @@ def get_static_values(self, meta, metric, location,
if location:
ctx = ctx[ctx['locs'] == location]
if etx is not None:
merged = pd.merge(ctx, etx, on='locs', how='left', suffixes=('_ctx', '_etx'))
ctx_g = ctx.groupby('techs').sum(["values"])
etx_g = etx.groupby('techs').sum(["values"])
merged = pd.merge(ctx_g, etx_g, on='techs', how='left', suffixes=('_ctx_g', '_etx_g'))
merged.fillna(0, inplace=True)
ctx['values'] = merged["values_ctx"] + merged["values_etx"]
ctx = ctx.groupby('techs').sum()
ctx = ctx['values'].to_dict()
merged['values'] = merged["values_ctx_g"] + merged["values_etx_g"]
ctx = merged['values'].to_dict()
else:
ctx = ctx.groupby('techs').sum()
ctx = ctx['values'].to_dict()
else:
ctx = {}

Expand Down

0 comments on commit 3f593f2

Please sign in to comment.