@@ -136,6 +136,7 @@ def __init__(
136136 predefClusterOrder = None ,
137137 predefClusterCenterIndices = None ,
138138 solver = "highs" ,
139+ numericalTolerance = 1e-13 ,
139140 roundOutput = None ,
140141 addPeakMin = None ,
141142 addPeakMax = None ,
@@ -254,6 +255,10 @@ def __init__(
254255 :param solver: Solver that is used for k_medoids clustering. optional (default: 'cbc' )
255256 :type solver: string
256257
258+ :param numericalTolerance: Tolerance for numerical issues. Silences the warning for exceeding upper or lower bounds
259+ of the time series. optional (default: 1e-13 )
260+ :type numericalTolerance: float
261+
257262 :param roundOutput: Decimals to what the output time series get round. optional (default: None )
258263 :type roundOutput: integer
259264
@@ -321,6 +326,8 @@ def __init__(
321326
322327 self .solver = solver
323328
329+ self .numericalTolerance = numericalTolerance
330+
324331 self .segmentation = segmentation
325332
326333 self .roundOutput = roundOutput
@@ -1097,23 +1104,29 @@ def createTypicalPeriods(self):
10971104 if np .array (
10981105 self .typicalPeriods .max (axis = 0 ) > self .timeSeries .max (axis = 0 )
10991106 ).any ():
1100- warning_list = self .typicalPeriods .max (axis = 0 ) < self .timeSeries .max (axis = 0 )
1101- warnings .warn (
1102- "Something went wrong... At least one maximal value of the " +
1103- "aggregated time series exceeds the maximal value " +
1104- "the input time series for: " +
1105- "{}" .format (list (warning_list [warning_list > 0 ].index ))
1106- )
1107+ warning_list = self .typicalPeriods .max (axis = 0 ) > self .timeSeries .max (axis = 0 )
1108+ diff = self .typicalPeriods .max (axis = 0 ) - self .timeSeries .max (axis = 0 )
1109+ if abs (diff ).max () > self .numericalTolerance :
1110+ warnings .warn (
1111+ "At least one maximal value of the " +
1112+ "aggregated time series exceeds the maximal value " +
1113+ "the input time series for: " +
1114+ "{}" .format (diff [warning_list [warning_list > 0 ].index ].to_dict ()) +
1115+ ". To silence the warning set the 'numericalTolerance' to a higher value."
1116+ )
11071117 if np .array (
11081118 self .typicalPeriods .min (axis = 0 ) < self .timeSeries .min (axis = 0 )
11091119 ).any ():
11101120 warning_list = self .typicalPeriods .min (axis = 0 ) < self .timeSeries .min (axis = 0 )
1111- warnings .warn (
1112- "Something went wrong... At least one minimal value of the " +
1113- "aggregated time series exceeds the minimal value " +
1114- "the input time series for: " +
1115- "{}" .format (list (warning_list [warning_list > 0 ].index ))
1116- )
1121+ diff = self .typicalPeriods .min (axis = 0 ) - self .timeSeries .min (axis = 0 )
1122+ if abs (diff ).max () > self .numericalTolerance :
1123+ warnings .warn (
1124+ "Something went wrong... At least one minimal value of the " +
1125+ "aggregated time series exceeds the minimal value " +
1126+ "the input time series for: " +
1127+ "{}" .format (diff [warning_list [warning_list > 0 ].index ].to_dict ()) +
1128+ ". To silence the warning set the 'numericalTolerance' to a higher value."
1129+ )
11171130 return self .typicalPeriods
11181131
11191132 def prepareEnersysInput (self ):
0 commit comments