njbrake commited on
Commit
e5f42e0
ยท
1 Parent(s): 515cbf5

google adk can't handle complex params rn

Browse files
src/surf_spot_finder/tools/openmeteo.py CHANGED
@@ -24,7 +24,7 @@ def _filter_by_date(
24
  ]
25
 
26
 
27
- def get_wave_forecast(lat: float, lon: float, date: str | None = None) -> list[dict]:
28
  """Get wave forecast for given location.
29
 
30
  Forecast will include:
@@ -38,7 +38,6 @@ def get_wave_forecast(lat: float, lon: float, date: str | None = None) -> list[d
38
  lat: Latitude of the location.
39
  lon: Longitude of the location.
40
  date: Date to filter by in any valid ISO 8601 format.
41
- If not provided, all data (default to 6 days forecast) will be returned.
42
 
43
  Returns:
44
  Hourly data for wave forecast.
@@ -74,7 +73,7 @@ def get_wave_forecast(lat: float, lon: float, date: str | None = None) -> list[d
74
  return hourly_data
75
 
76
 
77
- def get_wind_forecast(lat: float, lon: float, date: str | None = None) -> list[dict]:
78
  """Get wind forecast for given location.
79
 
80
  Forecast will include:
@@ -86,7 +85,6 @@ def get_wind_forecast(lat: float, lon: float, date: str | None = None) -> list[d
86
  lat: Latitude of the location.
87
  lon: Longitude of the location.
88
  date: Date to filter by in any valid ISO 8601 format.
89
- If not provided, all data (default to 6 days forecast) will be returned.
90
 
91
  Returns:
92
  Hourly data for wind forecast.
@@ -109,9 +107,8 @@ def get_wind_forecast(lat: float, lon: float, date: str | None = None) -> list[d
109
  response.raise_for_status()
110
  data = json.loads(response.content.decode())
111
  hourly_data = _extract_hourly_data(data)
112
- if date is not None:
113
- date = datetime.fromisoformat(date)
114
- hourly_data = _filter_by_date(date, hourly_data)
115
  if len(hourly_data) == 0:
116
  raise ValueError("No data found for the given date")
117
  return hourly_data
 
24
  ]
25
 
26
 
27
+ def get_wave_forecast(lat: float, lon: float, date: str) -> list[dict]:
28
  """Get wave forecast for given location.
29
 
30
  Forecast will include:
 
38
  lat: Latitude of the location.
39
  lon: Longitude of the location.
40
  date: Date to filter by in any valid ISO 8601 format.
 
41
 
42
  Returns:
43
  Hourly data for wave forecast.
 
73
  return hourly_data
74
 
75
 
76
+ def get_wind_forecast(lat: float, lon: float, date: str) -> list[dict]:
77
  """Get wind forecast for given location.
78
 
79
  Forecast will include:
 
85
  lat: Latitude of the location.
86
  lon: Longitude of the location.
87
  date: Date to filter by in any valid ISO 8601 format.
 
88
 
89
  Returns:
90
  Hourly data for wind forecast.
 
107
  response.raise_for_status()
108
  data = json.loads(response.content.decode())
109
  hourly_data = _extract_hourly_data(data)
110
+ date = datetime.fromisoformat(date)
111
+ hourly_data = _filter_by_date(date, hourly_data)
 
112
  if len(hourly_data) == 0:
113
  raise ValueError("No data found for the given date")
114
  return hourly_data