diff --git a/tests/test_ops_curve_shift.py b/tests/test_ops_curve_shift.py index 82fdc1d..da62d4c 100644 --- a/tests/test_ops_curve_shift.py +++ b/tests/test_ops_curve_shift.py @@ -118,6 +118,7 @@ def test_calculate_power_curve_shift( if abs(expected) > CURVE_CONSTANTS[CurveTypes.POWER_CURVE.value]["warning_threshold"]: assert "Ops Curve Shift warning" in caplog.text + assert f": {actual:.3f}" in caplog.text # check the actual value (including its +/- sign) is in the log message np.testing.assert_almost_equal(actual=actual, desired=expected) diff --git a/wind_up/ops_curve_shift.py b/wind_up/ops_curve_shift.py index cf2cf82..5c7dd32 100644 --- a/wind_up/ops_curve_shift.py +++ b/wind_up/ops_curve_shift.py @@ -208,7 +208,7 @@ def _calculate_curve_shift(curve_shift_input: CurveShiftInput) -> float: post_df = curve_shift_input.post_df wtg_name = curve_shift_input.turbine_name - bins = np.arange(0, pre_df[conf.x_col].max() + conf.x_bin_width, conf.x_bin_width) if conf.x_bin_width > 0 else 10 # type: ignore[operator] + bins = np.arange(0, pre_df[conf.x_col].max() + conf.x_bin_width, conf.x_bin_width) if conf.x_bin_width > 0 else 10 # type: ignore[operator,var-annotated] mean_curve = pre_df.groupby(pd.cut(pre_df[conf.x_col], bins=bins, retbins=False), observed=True).agg( x_mean=pd.NamedAgg(column=conf.x_col, aggfunc="mean"), @@ -224,9 +224,7 @@ def _calculate_curve_shift(curve_shift_input: CurveShiftInput) -> float: # log warning if abs(result) > conf.warning_threshold: - warning_msg = ( - f"{wtg_name} Ops Curve Shift warning: abs({conf.name}) > {conf.warning_threshold}: {abs(result):.3f}" - ) + warning_msg = f"{wtg_name} Ops Curve Shift warning: abs({conf.name}) > {conf.warning_threshold}: {result:.3f}" result_manager.warning(warning_msg) return result