-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Version Checks (indicate both or one)
-
I have confirmed this bug exists on the lastest release of Linopy.
-
I have confirmed this bug exists on the current
masterbranch of Linopy.
Issue Description
Observed behavior
When using a timezone-aware pandas.DatetimeIndex as a coordinate, and using multiplication of the variable and some pandas series, a warning is raised
UserWarning: coords for dimension(s) ['time'] is not aligned with the pandas object. Previously, the indexes of the pandas were ignored and overwritten in these cases. Now, the pandas object's coordinates are taken considered for alignment.
Reproducible Example
from linopy import Model
import pandas as pd
from datetime import datetime
from zoneinfo import ZoneInfo
m = Model()
exogenous_series0 = pd.Series(0,
index=pd.DatetimeIndex(
pd.date_range(start=datetime(2025,1,1), freq="15min", periods=4, tz=ZoneInfo("Australia/Sydney"), name="time")
)
)
time = exogenous_series0.index.copy()
exogenous_series1 = pd.Series(1, index=time)
var1 = m.add_variables(coords=[time], name="var1")
m.add_constraints(0 <= var1*exogenous_series1) ## This causes a warning
m.add_constraints(0 <= var1 + exogenous_series1) ## This does NOT cause a warningExpected Behavior
I expected to be able to use a timezone-aware pandas.DatetimeIndex as a coordinate. However, doing so causes a warning about alignment
Installed Versions
Details
Linopy 0.53Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working