Skip to content

Commit

Permalink
simplify attrs handling
Browse files Browse the repository at this point in the history
  • Loading branch information
hrzn committed Jul 31, 2022
1 parent eb46b57 commit a695909
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions darts/dataprocessing/dtw/dtw.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from darts import TimeSeries
from darts.logging import get_logger, raise_if, raise_if_not
from darts.timeseries import DIMS, HIERARCHY_TAG, STATIC_COV_TAG
from darts.timeseries import DIMS

from .cost_matrix import CostMatrix
from .window import CRWindow, NoWindow, Window
Expand Down Expand Up @@ -220,10 +220,7 @@ def warped(self) -> (TimeSeries, TimeSeries):
self.series1._time_dim: pd.RangeIndex(values1.shape[0]),
DIMS[1]: xa1.coords[DIMS[1]],
},
attrs={
STATIC_COV_TAG: xa1.attrs[STATIC_COV_TAG],
HIERARCHY_TAG: xa1.attrs[HIERARCHY_TAG],
},
attrs=xa1.attrs,
)

warped_series2 = xr.DataArray(
Expand All @@ -233,10 +230,7 @@ def warped(self) -> (TimeSeries, TimeSeries):
self.series2._time_dim: pd.RangeIndex(values2.shape[0]),
DIMS[1]: xa2.coords[DIMS[1]],
},
attrs={
STATIC_COV_TAG: xa2.attrs[STATIC_COV_TAG],
HIERARCHY_TAG: xa2.attrs[HIERARCHY_TAG],
},
attrs=xa2.attrs,
)

time_dim1, time_dim2 = self.series1._time_dim, self.series2._time_dim
Expand Down

0 comments on commit a695909

Please sign in to comment.