Documentation
¶
Overview ¶
Package solarwindow estimates when the sun crosses a chosen altitude for Iceland trip-planning tools.
The calculation is intentionally narrow: it returns UTC times for one coordinate and calendar date. Iceland keeps UTC year-round, so callers do not need a daylight-saving adjustment.
Index ¶
Constants ¶
const ( // ApparentHorizon is the conventional altitude used for sunrise and sunset. // It includes a small allowance for refraction and the solar disc radius. ApparentHorizon = -0.833 // CivilTwilight is the altitude used for the start and end of civil twilight. CivilTwilight = -6.0 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CrossingState ¶
type CrossingState string
CrossingState describes whether a threshold has two daily crossings.
const ( // Crosses means the sun rises above and later falls below the threshold. Crosses CrossingState = "crosses" // AlwaysAbove means the sun remains above the threshold throughout the day. AlwaysAbove CrossingState = "always_above" // AlwaysBelow means the sun remains below the threshold throughout the day. AlwaysBelow CrossingState = "always_below" )
type Window ¶
type Window struct {
DateUTC time.Time
Latitude float64
Longitude float64
AltitudeDegrees float64
State CrossingState
Start time.Time
End time.Time
ApproximateNoon time.Time
}
Window holds the result for a requested solar-altitude threshold. Start and End are populated only when State is Crosses.
func Calculate ¶
Calculate estimates the daily UTC window during which the sun is above altitudeDegrees. The implementation follows the NOAA Solar Calculator's fractional-year, equation-of-time, and solar-declination approximation.
Use ApparentHorizon for sunrise/sunset or CivilTwilight for usable civil light. Terrain, cloud, and local obstructions are deliberately not modeled.