Skip to content

Commit

Permalink
Fix superstructure SDF issue. Producitonf lows were getting zero valu…
Browse files Browse the repository at this point in the history
…es, leading to singular matrices.
  • Loading branch information
romainsacchi authored and romainsacchi committed Oct 17, 2024
1 parent bac32fc commit ed63c6c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion premise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"clear_inventory_cache",
"get_regions_definition",
)
__version__ = (2, 1, 5)
__version__ = (2, 1, 6)


from premise.new_database import NewDatabase
Expand Down
8 changes: 7 additions & 1 deletion premise/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,6 @@ def generate_scenario_difference_file(
df.loc[df["flow type"].isin(["technosphere", "production"]), "from categories"] = (
None
)
# df.loc[df["flow type"] == "production", list_scenarios] = 1.0

df.loc[df["flow type"] == "biosphere", "from database"] = biosphere_name

Expand Down Expand Up @@ -893,6 +892,13 @@ def generate_superstructure_db(
after = len(df)
print(f"Dropped {before - after} duplicate(s).")

for scenario in scenario_list:
df.loc[
(df["flow type"] == "production")
& (df[scenario] == 0),
scenario
] = 1

# if df is longer than the row limit of Excel,
# the export to Excel is not an option
if len(df) > 1048576:
Expand Down

0 comments on commit ed63c6c

Please sign in to comment.