Skip to content

Commit da923be

Browse files
committed
remove 'horizon' CSV forecast option
1 parent 6586ac5 commit da923be

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/india_api/internal/service/regions.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -192,23 +192,20 @@ def get_forecast_csv(
192192
db: DBClientDependency,
193193
auth: dict = Depends(auth),
194194
forecast_horizon: Optional[ForecastHorizon] = ForecastHorizon.latest,
195-
forecast_horizon_minutes: Optional[int] = 0,
196195
):
197196
"""
198197
Route to get the day ahead forecast as a CSV file.
199198
By default, the CSV file will be for the latest forecast, from now forwards.
200-
The forecast_horizon can be set to 'latest', 'day_ahead' or 'horizon'.
199+
The forecast_horizon can be set to 'latest' or 'day_ahead'.
201200
- latest: The latest forecast, from now forwards.
202-
- day_ahead: The forecast for the next day, from midnight.
203-
- horizon: The forecast for the next horizon_horizon_minutes minutes, from default forecast history start.
204-
The forecast_horizon_minutes is only used if the forecast_horizon is set to 'horizon'.
201+
- day_ahead: The forecast for the next day, from 00:00.
205202
"""
206203

207204
if forecast_horizon is not None:
208-
if forecast_horizon not in [ForecastHorizon.latest, ForecastHorizon.day_ahead, ForecastHorizon.horizon]:
205+
if forecast_horizon not in [ForecastHorizon.latest, ForecastHorizon.day_ahead]:
209206
raise HTTPException(
210207
status_code=status.HTTP_400_BAD_REQUEST,
211-
detail=f"Invalid forecast_horizon {forecast_horizon}. Must be 'latest', 'day_ahead', or 'horizon.",
208+
detail=f"Invalid forecast_horizon {forecast_horizon}. Must be 'latest' or 'day_ahead'.",
212209
)
213210

214211
forecasts: GetForecastGenerationResponse = get_forecast_timeseries_route(
@@ -217,7 +214,6 @@ def get_forecast_csv(
217214
db=db,
218215
auth=auth,
219216
forecast_horizon=forecast_horizon,
220-
forecast_horizon_minutes=forecast_horizon_minutes,
221217
smooth_flag=False,
222218
)
223219

@@ -232,11 +228,11 @@ def get_forecast_csv(
232228
forecast_type = "intraday"
233229
case ForecastHorizon.day_ahead:
234230
forecast_type = "da"
235-
case ForecastHorizon.horizon:
236-
forecast_type = f"horizon_{forecast_horizon_minutes}"
237231
case _:
238-
# this shouldn't happen but will handle if class is changed
239-
forecast_type = "default"
232+
raise HTTPException(
233+
status_code=status.HTTP_400_BAD_REQUEST,
234+
detail=f"Invalid forecast_horizon {forecast_horizon}. Must be 'latest' or 'day_ahead'.",
235+
)
240236
csv_file_path = f"{region}_{source}_{forecast_type}_{tomorrow_ist}.csv"
241237

242238
description = (

0 commit comments

Comments
 (0)