Skip to content

Commit aa4366f

Browse files
committed
select the correct region
1 parent a389ced commit aa4366f

File tree

1 file changed

+11
-1
lines changed
  • src/india_api/internal/inputs/indiadb

1 file changed

+11
-1
lines changed

src/india_api/internal/inputs/indiadb/client.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def get_predicted_power_production_for_location(
6262
"""Gets the predicted power production for a location.
6363
6464
Args:
65-
location: not used
65+
location: the location to get the predicted power production for
6666
asset_type: The type of asset to get the forecast for
6767
forecast_horizon: The time horizon to get the data for. Can be latest or day ahead
6868
forecast_horizon_minutes: The number of minutes to get the forecast for. forecast_horizon must be 'horizon'
@@ -91,6 +91,16 @@ def get_predicted_power_production_for_location(
9191

9292
# just select wind site
9393
sites = [s for s in sites if s.asset_type == asset_type]
94+
95+
# just select region
96+
sites = [site for site in sites if site.region == location]
97+
98+
if len(sites) == 0:
99+
raise HTTPException(
100+
status_code=204,
101+
detail=f"Site for {location=} not found and {asset_type=} not found",
102+
)
103+
94104
site = sites[0]
95105

96106
# read actual generations

0 commit comments

Comments
 (0)