API Reference
surf_spot_finder.cli
find_surf_spot(config_file)
Find the best surf spot based on the given criteria.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config_file
|
str
|
Path to a YAML config file. See Config |
required |
Source code in src/surf_spot_finder/cli.py
surf_spot_finder.config.Config
Bases: BaseModel
Source code in src/surf_spot_finder/config.py
from_yaml(yaml_path)
classmethod
with open(yaml_path, "r") as f: data = yaml.safe_load(f) return cls(**data) yaml_path: Path to the YAML configuration file
Returns:
Name | Type | Description |
---|---|---|
Config |
Config
|
A new Config instance populated with values from the YAML file |
Source code in src/surf_spot_finder/config.py
surf_spot_finder.no_framework
find_surf_spot_no_framework(location, max_driving_hours, date, model_id)
Find the best surf spot based on the given location
and date
.
Uses the following tools:
- any_agent.tools.web_browsing
- surf_spot_finder.tools.openmeteo
- surf_spot_finder.tools.openstreetmap
To find nearby spots along with the forecast and recommended conditions for the spot.
Then, uses litellm
with the provided model_id
to score
each spot based on the available information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
location
|
str
|
The place of interest. |
required |
max_driving_hours
|
int
|
Used to limit the surf spots based on
the distance to |
required |
date
|
datetime
|
Used to filter the forecast results. |
required |
model_id
|
str
|
Can be any of the litellm providers. |
required |
Returns:
Type | Description |
---|---|
list[SpotScore]
|
A list of spot scores and reasons for the value. |
Source code in src/surf_spot_finder/no_framework.py
Tools
surf_spot_finder.tools.openmeteo
get_wave_forecast(lat, lon, date=None)
Get wave forecast for given location.
Forecast will include:
- wave_direction (degrees)
- wave_height (meters)
- wave_period (seconds)
- sea_level_height_msl (meters)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lat
|
float
|
Latitude of the location. |
required |
lon
|
float
|
Longitude of the location. |
required |
date
|
str | None
|
Date to filter by in any valid ISO 8601 format. If not provided, all data (default to 6 days forecast) will be returned. |
None
|
Returns:
Source code in src/surf_spot_finder/tools/openmeteo.py
get_wind_forecast(lat, lon, date=None)
Get wind forecast for given location.
Forecast will include:
- wind_direction (degrees)
- wind_speed (meters per second)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lat
|
float
|
Latitude of the location. |
required |
lon
|
float
|
Longitude of the location. |
required |
date
|
str | None
|
Date to filter by in any valid ISO 8601 format. If not provided, all data (default to 6 days forecast) will be returned. |
None
|
Returns:
Type | Description |
---|---|
list[dict]
|
Source code in src/surf_spot_finder/tools/openmeteo.py
surf_spot_finder.tools.openstreetmap
driving_hours_to_meters(driving_hours)
Convert driving hours to meters assuming a 70 km/h average speed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
driving_hours
|
int
|
The driving hours. |
required |
Returns:
Type | Description |
---|---|
int
|
The distance in meters. |
Source code in src/surf_spot_finder/tools/openstreetmap.py
get_area_lat_lon(area_name)
Get the latitude and longitude of an area from Nominatim.
Uses the Nominatim API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
area_name
|
str
|
The name of the area. |
required |
Returns:
Type | Description |
---|---|
tuple[float, float]
|
The area found. |
Source code in src/surf_spot_finder/tools/openstreetmap.py
get_lat_lon_center(bounds)
Get the latitude and longitude of the center of a bounding box.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bounds
|
dict
|
required |
Returns:
Type | Description |
---|---|
tuple[float, float]
|
The latitude and longitude of the center. |
Source code in src/surf_spot_finder/tools/openstreetmap.py
get_surfing_spots(lat, lon, radius)
Get surfing spots around a given latitude and longitude.
Uses the Overpass API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lat
|
float
|
The latitude. |
required |
lon
|
float
|
The longitude. |
required |
radius
|
int
|
The radius in meters. |
required |
Returns:
Type | Description |
---|---|
list[tuple[str, tuple[float, float]]]
|
The surfing places found. |