capturegraph.scheduling.forecast
#
Forecast - Generate Potential Future Sessions#
Utilities for generating candidate sessions for the scheduler to choose from.
Use times to generate time slots, then compose them into sessions
using the cg.List() broadcasting pattern.
The key pattern
- Create an empty List:
potential = cg.List() - Assign time slots:
potential.date = cgsh.forecast.times(span=timedelta(hours=24)) - Add location:
potential.location = my_location - Add derived attributes:
potential.solar_angle = cgsh.forecast.solar_position(my_location, potential.date)
Available Functions
times(resolution, span): Generate datetime slots.weather(location, days): Fetch hourly weather from Open-Meteo (free, no API key).search(weather, times): Find nearest weather entry for each timestamp.
Example
from datetime import timedelta
import capturegraph.data as cg
import capturegraph.scheduling as cgsh
# Generate potential sessions for the next 24 hours
potential = cg.List()
potential.date = cgsh.forecast.times(span=timedelta(hours=24))
potential.location = my_location
# Add solar angles
potential.solar_angle = cgsh.forecast.solar_position(my_location, potential.date)
# Add weather forecasts
weather_data = cgsh.forecast.hourly_weather(my_location, days=3)
potential.weather = cgsh.forecast.nearest_weather(weather_data, potential.date)
Modules:
| Name | Description |
|---|---|
location |
Location Forecast - Geographic Coverage |
solar |
|
time |
Time Forecasting - Generate Future Time Slots |
weather |
Weather Forecasting - Open-Meteo Integration |