Sunrise: API Reference#

class yr_weather.Sunrise(headers, use_cache=True)#

Bases: APIClient

A client for interacting with the Yr Sunrise API.

get_moon_events(date: str, lat: float, lon: float, offset: str | None = None) MoonEvents#

Get moon events data (moonrise, moonset, etc).

For more information, please see: https://api.met.no/weatherapi/sunrise/3.0/documentation

Parameters:
  • date (str) – A date formatted in ISO 8601 format, like so: YYYY-MM-DD.

  • lat (float | int) – The latitude of the location.

  • lon (float | int) – The longitude of the location.

  • offset (Optional[str]) – The timezone offset, given in the following format: +HH:MM or -HH:MM.

Return type:

MoonEvents

get_sun_events(date: str, lat: float, lon: float, offset: str | None = None) SunEvents#

Get sun events data (sunrise, sunset, etc).

For more information, please see: https://api.met.no/weatherapi/sunrise/3.0/documentation

Parameters:
  • date (str) – A date formatted in ISO 8601 format, like so: YYYY-MM-DD.

  • lat (float | int) – The latitude of the location.

  • lon (float | int) – The longitude of the location.

  • offset (Optional[str]) – The timezone offset, given in the following format: +HH:MM or -HH:MM.

Return type:

SunEvents

Dataclasses#

class yr_weather.data.sunrise.SunEvents(data: APISunData)#

A class with sun event data.

class yr_weather.data.sunrise.MoonEvents(data: APIMoonData)#

A class with moon event data.

class yr_weather.data.sunrise.TimeWithElevation(time: str, disc_centre_elevation: float, visible: bool)#

A dataclass with event data with disc centre elevation.

disc_centre_elevation: float#
time: str#
visible: bool#
class yr_weather.data.sunrise.TimeWithAzimuth(time: str, azimuth: float)#

A dataclass with event time data with azimuth.

azimuth: float#
time: str#
class yr_weather.data.sunrise.CommonEventsData(data: APIEventData)#

A class with common event data for both sun and moon events.

class yr_weather.data.sunrise.EventsGeometry(coordinates: List[float], type: str)#

A dataclass holding coordinates.

coordinates: List[float]#
type: str#