Skip to content

Commit

Permalink
update forecast test with no ts
Browse files Browse the repository at this point in the history
  • Loading branch information
zakwatts committed Jan 24, 2025
1 parent 8ea97ba commit df662f3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tests/unit/test_forecast_no_ts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,21 @@ def test_run_forecast_no_ts():
# make input data
site = PVSite(latitude=51.75, longitude=-1.25, capacity_kwp=1.25)

current_ts = pd.Timestamp.now().round("15min")
current_hr = pd.Timestamp.now().round(freq='h')
current_ts = pd.Timestamp.now()

# run gradient boosting model with no ts
predications_df = run_forecast(site=site, model="gb", ts=current_ts)
predications_df = run_forecast(site=site, model="gb")
# check current ts agrees with dataset
assert predications_df.index.min() == current_ts
assert predications_df.index.min() >= current_ts - pd.Timedelta(hours=1)

print(predications_df)
print(f"Current time: {current_ts}")
print(f"Max: {predications_df['power_kw'].max()}")

# run xgb model with no ts
predications_df = run_forecast(site=site, model="xgb", ts=current_ts)
predications_df = run_forecast(site=site, model="xgb")
# check current ts agrees with dataset
assert predications_df.index.min() == current_hr
assert predications_df.index.min() >= current_ts - pd.Timedelta(hours=1)

print(predications_df)
print(f"Current time: {current_ts}")
Expand Down

0 comments on commit df662f3

Please sign in to comment.