_timestamp

class contrib.misc._timestamp.TimestampUtils[source]

Bases: object

equation_of_time(day_of_year)[source]

Return the equation of time (minutes).

solar_declination(day_of_year)[source]

Return solar declination (radians) using approximate formula.

solar_events(timestamp, latitude, longitude)[source]

Calculate solar noon, sunrise, and sunset for the given timestamp and coordinates. All results are UTC datetimes.

Parameters:
  • timestamp – POSIX timestamp (seconds since epoch)

  • latitude – latitude in decimal degrees (positive north)

  • longitude – longitude in decimal degrees (positive east, negative west)

Returns:

‘solar_noon’, ‘sunrise’, ‘sunset’ (UTC datetimes)

Return type:

dict with keys

timestamp_at_sunset(date: tuple, latitude: float, longitude: float)[source]