Skip to content

Commit 4025fe2

Browse files
committed
Replace zero values for production flows.
1 parent 266dda1 commit 4025fe2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

unfold/unfold.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,28 @@ def format_superstructure_dataframe(self) -> None:
12441244
+ [s["name"] for s in self.scenarios]
12451245
]
12461246

1247+
# ensure that no production flows have zero values
1248+
# in any of the scenario columns
1249+
# replace zeroes with ones
1250+
1251+
print(self.scenario_df.loc[
1252+
self.scenario_df["flow type"] == "production",
1253+
[s["name"] for s in self.scenarios],
1254+
].sum())
1255+
1256+
self.scenario_df.loc[
1257+
self.scenario_df["flow type"] == "production",
1258+
[s["name"] for s in self.scenarios],
1259+
] = self.scenario_df.loc[
1260+
self.scenario_df["flow type"] == "production",
1261+
[s["name"] for s in self.scenarios],
1262+
].replace(0, 1, regex=True)
1263+
1264+
print(self.scenario_df.loc[
1265+
self.scenario_df["flow type"] == "production",
1266+
[s["name"] for s in self.scenarios],
1267+
].sum())
1268+
12471269
def unfold(
12481270
self,
12491271
scenarios: List[int] = None,

0 commit comments

Comments
 (0)