sun#
Solar position (elevation and azimuth) for a location and time.
See sun for usage examples.
API Reference#
Solar geometry helpers (sun elevation and azimuth) based on PyEphem.
- pyedautils.data_prep.sun.sun_position(timestamp, latitude: float, longitude: float, *, altitude: float = 0.0, refraction: bool = True) Tuple[float, float] | DataFrame[source]#
Solar elevation and azimuth for the given time(s) and location.
- Parameters:
timestamp – A single datetime/
pandas.Timestampor a collection of timestamps (pandas.Series,DatetimeIndex, list or array). Timezone-aware values are converted to UTC; naive values are assumed to be UTC.latitude – Observer latitude in decimal degrees (north positive).
longitude – Observer longitude in decimal degrees (east positive).
altitude – Observer height above sea level in meters. Default 0.
refraction – If True (default), return the apparent position including atmospheric refraction. If False, return the true geometric position (no refraction).
- Returns:
a
(elevation, azimuth)tuple in degrees. For a collection: apandas.DataFramewith columnselevationandazimuth(degrees), indexed like the input (aSerieskeeps its index, otherwise a UTC-naiveDatetimeIndexis used).Elevation is the angle above the horizon (negative when the sun is below the horizon). Azimuth is measured clockwise from geographic north (0=N, 90=E, 180=S, 270=W).
- Return type:
For scalar input