Skip to content

Commit

Permalink
fix for windnet ad
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Dec 16, 2024
1 parent c03d4d7 commit 8ec47ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 5 additions & 1 deletion india_forecast_app/models/pvnet/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,13 @@ def _prepare_data_sources(self):

# Save generation data as netcdf file
generation_da = self.generation_data["data"].to_xarray()

# get the minimum timestamp in generation data
min_timestamp = generation_da.index.min().values
# Add the forecast timesteps to the generation, with 0 values
# 192 is 48 hours of 15 min intervals
forecast_timesteps = pd.date_range(
start=self.t0 - pd.Timedelta("1H"), periods=197, freq="15min"
start=min_timestamp, periods=len(generation_da.index) + 192, freq="15min"
)

generation_da = generation_da.reindex(index=forecast_timesteps, fill_value=0.00001)
Expand Down
8 changes: 5 additions & 3 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,13 @@ def test_app_client_ad(

app_run(timestamp=None, write_to_db=True)

n_forecasts = 2 * 2
# one model is 8 hours, one model is 4 hours
# 2 pv models, 1 wind model
# x2 for adjuster
n_forecasts = 3 * 2
# one models is 8 hours, two model is 4 hours
# x 4 for each 15 minutes
# x 2 for adjuster
n_forecast_values = (8 + 4) * 4 * 2
n_forecast_values = (8 + 4 + 4) * 4 * 2

assert db_session.query(ForecastSQL).count() == init_n_forecasts + n_forecasts
assert db_session.query(ForecastValueSQL).count() == init_n_forecast_values + n_forecast_values
Expand Down

0 comments on commit 8ec47ee

Please sign in to comment.