solar
solar
#
Solar position forecasting via the astral library.
solar_position computes the sun's altitude and azimuth for a location and
instant. It is vectorized, so cg.Array arguments broadcast element-wise.
SolarPosition
dataclass
#
Solar position with altitude (elevation) and azimuth.
Attributes:
| Name | Type | Description |
|---|---|---|
altitude |
Annotated[float, Quantity('°', name='Sun altitude')]
|
Sun elevation in degrees above the horizon (-90° to 90°; negative is below the horizon). |
azimuth |
Annotated[float, Quantity('°', name='Sun azimuth', span=(0.0, 360.0))]
|
Sun azimuth in degrees clockwise from North (0°=N, 90°=E, 180°=S, 270°=W). |
Source code in capturegraph-recipes/capturegraph_recipes/scheduling/forecast/solar.py
solar_position(location, time)
#
Calculate solar position for a single datetime and location.
Vectorized: passing cg.Array arguments broadcasts element-wise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location
|
Location
|
Location with latitude, longitude, and altitude. |
required |
time
|
datetime | datetime64
|
Date and time. Timezone-aware datetimes are converted to UTC; naive datetimes are interpreted as system-local time. |
required |
Returns:
| Type | Description |
|---|---|
SolarPosition
|
SolarPosition with altitude and azimuth in degrees. |