Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 28, 2023
1 parent fe25202 commit 5eab9d3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ocf_ml_metrics/evaluation/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def evaluation(
results_df: pd.DataFrame,
model_name: str,
sun_threshold_degrees_for_night: float = -5.0,
error_thresholds: Union[float, int, list] = [1000, 2000],
error_thresholds: Union[float, int, list] = None,
outturn_unit: str = "mw",
**kwargs,
) -> dict:
Expand Down Expand Up @@ -45,6 +45,8 @@ def evaluation(
"""
# make sure datetimes columns datetimes and floor target time t to nearest 5-minutes
if error_thresholds is None:
error_thresholds = [1000, 2000]
results_df["t0_datetime_utc"] = pd.to_datetime(results_df["t0_datetime_utc"])
results_df["target_datetime_utc"] = pd.to_datetime(results_df["target_datetime_utc"])
results_df["target_datetime_utc"] = results_df["target_datetime_utc"].dt.floor("5T")
Expand Down Expand Up @@ -164,7 +166,7 @@ def evaluation_per_id(
results_df: pd.DataFrame,
model_name: str,
sun_threshold_degrees_for_night: float = -5.0,
error_thresholds: Union[float, int, list] = [1000, 2000],
error_thresholds: Union[float, int, list] = None,
outturn_unit: str = "mw",
**kwargs,
) -> dict:
Expand Down Expand Up @@ -196,6 +198,8 @@ def evaluation_per_id(
"""
# make sure datetimes columns datetimes and floor target time t to nearest 5-minutes
if error_thresholds is None:
error_thresholds = [1000, 2000]

Check warning on line 202 in ocf_ml_metrics/evaluation/evaluation.py

View check run for this annotation

Codecov / codecov/patch

ocf_ml_metrics/evaluation/evaluation.py#L202

Added line #L202 was not covered by tests
results_df["t0_datetime_utc"] = pd.to_datetime(results_df["t0_datetime_utc"])
results_df["target_datetime_utc"] = pd.to_datetime(results_df["target_datetime_utc"])
results_df["target_datetime_utc"] = results_df["target_datetime_utc"].dt.floor("5T")
Expand Down

0 comments on commit 5eab9d3

Please sign in to comment.