Skip to content

Commit

Permalink
Merge pull request #250 from OSeMOSYS/fuel-limit-fix
Browse files Browse the repository at this point in the history
Fix for empty fuel limits
  • Loading branch information
trevorb1 authored Jan 17, 2025
2 parents e24b6ba + cfd1705 commit 9eff7a1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions workflow/scripts/osemosys_global/powerplant/fuel_limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ def get_user_fuel_limits(
r = r[0]

if fuel_limits.empty:
s = pd.Series(index=["REGION", "TECHNOLOGY", "YEAR"])
s.name = "VALUE"
return s
return pd.Series()

# format limits dataframe
limits = fuel_limits.copy()
Expand Down Expand Up @@ -87,7 +85,12 @@ def merge_template_user_limits(
user_limits: pd.Series,
years: Optional[list[int] | pd.Series] = None,
) -> pd.Series:
s = user_limits.combine_first(template)

if user_limits.empty:
s = template
else:
s = user_limits.combine_first(template)

if isinstance(years, list):
return s[s.index.get_level_values("YEAR").isin(years)]
elif isinstance(years, pd.Series):
Expand Down

0 comments on commit 9eff7a1

Please sign in to comment.