Skip to content

Commit c2b94e7

Browse files
committed
Fix issue with timeslice ordering
1 parent a0fe43c commit c2b94e7

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/muse/constraints.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,11 @@ def max_production(
446446
from xarray import ones_like, zeros_like
447447

448448
from muse.commodities import is_enduse
449-
from muse.timeslices import TIMESLICE, QuantityType, convert_timeslice
449+
from muse.timeslices import (
450+
TIMESLICE,
451+
QuantityType,
452+
convert_timeslice_new,
453+
)
450454

451455
if year is None:
452456
year = int(market.year.min())
@@ -465,10 +469,10 @@ def max_production(
465469
.sel(**kwargs)
466470
.drop_vars("technology")
467471
)
468-
capacity = convert_timeslice(
472+
capacity = convert_timeslice_new(
469473
techs.fixed_outputs * techs.utilization_factor,
470474
TIMESLICE,
471-
QuantityType.EXTENSIVE,
475+
QuantityType.INTENSIVE,
472476
)
473477
if "asset" not in capacity.dims and "asset" in search_space.dims:
474478
capacity = capacity.expand_dims(asset=search_space.asset)

src/muse/timeslices.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ def convert_timeslice_new(x, ts, quantity):
393393
from xarray import Coordinates
394394

395395
if hasattr(x, "timeslice"):
396+
x = x.sel(timeslice=ts["timeslice"])
396397
return x
397398

398399
mindex_coords = Coordinates.from_pandas_multiindex(ts.timeslice, "timeslice")

0 commit comments

Comments
 (0)