Skip to content

Commit

Permalink
Create test_ws_est.py
Browse files Browse the repository at this point in the history
  • Loading branch information
aclerc committed Apr 22, 2024
1 parent 72cf957 commit 086188e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/test_ws_est.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from pathlib import Path

import pandas as pd
from pandas.testing import assert_frame_equal

from wind_up.models import WindUpConfig
from wind_up.scada_power_curve import calc_pc_and_rated_ws
from wind_up.ws_est import add_ws_est


def test_ws_est(test_homer_config: WindUpConfig) -> None:
cfg = test_homer_config
wf_df = pd.read_parquet(Path(__file__).parents[0] / "test_data/Homer Wind Farm_July2023_scada_improved.parquet")

# usually x_bin_width would be cfg.ws_bin_width / 2 but that gives invalid power curve with so little data
pc_per_ttype, rated_ws_per_ttype = calc_pc_and_rated_ws(
cfg=cfg,
wf_df=wf_df,
x_col="WindSpeedMean",
y_col="pw_clipped",
x_bin_width=cfg.ws_bin_width * 2.01,
plot_cfg=None,
)
adf = add_ws_est(cfg=cfg, wf_df=wf_df, pc_per_ttype=pc_per_ttype, plot_cfg=None)
edf = pd.read_parquet(Path(__file__).parents[0] / "test_data/test_add_ws_est.parquet")
assert_frame_equal(adf, edf)

0 comments on commit 086188e

Please sign in to comment.