diff --git a/README.md b/README.md index a683e84..fcf9723 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Supported products are: - Locationforecast (v2.0) - Radar (v2.0) - Textforecast (v2.0) -- Sunrise (v2.0) +- Sunrise (v3.0) - Geosatellite (v1.4) # Requirements diff --git a/docs/gettingstarted.rst b/docs/gettingstarted.rst index bfc4698..1a90b34 100644 --- a/docs/gettingstarted.rst +++ b/docs/gettingstarted.rst @@ -138,7 +138,7 @@ Sunrise ------- The Sunrise submodule allows you to calculate various events, such as sunrises, sunsets, low moons, high moons and so on. -For more information about the API itself, check `MET's documentation `__. +For more information about the API itself, check `MET's documentation `__. In the example below, we use the :meth:`Sunrise.get_detail` function to get data about the sunset. diff --git a/docs/index.rst b/docs/index.rst index 5c62c24..5e3aaa0 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -37,7 +37,7 @@ Supported products are: * Locationforecast (v2.0) * Radar (v2.0) * Textforecast (v2.0) -* Sunrise (v2.0) +* Sunrise (v3.0) * Geosatellite (v1.4) Requirements diff --git a/docs/locationforecast/api.rst b/docs/locationforecast/api.rst index 338fc8b..22c14f5 100644 --- a/docs/locationforecast/api.rst +++ b/docs/locationforecast/api.rst @@ -12,11 +12,9 @@ Locationforecast: API Reference .. autoclass:: yr_weather.locationforecast.ForecastTime :members: - :undoc-members: .. autoclass:: yr_weather.locationforecast.ForecastFuture :members: - :undoc-members: Dataclasses ----------- diff --git a/docs/locationforecast/examples.rst b/docs/locationforecast/examples.rst index b884965..b6b3bce 100644 --- a/docs/locationforecast/examples.rst +++ b/docs/locationforecast/examples.rst @@ -11,7 +11,7 @@ The examples assume you have set up a :class:`Locationforecast` client with a va import yr_weather - # Replace with your own User-Agent. See MET API Terms of Service for correct User-Agents. + # Replace with your own User-Agent. See MET API Terms of Service for correct user agents. headers = { "User-Agent": "Your User-Agent" } diff --git a/docs/sunrise/examples.rst b/docs/sunrise/examples.rst index d0b7286..15c6fde 100644 --- a/docs/sunrise/examples.rst +++ b/docs/sunrise/examples.rst @@ -11,116 +11,29 @@ The examples assume you have set up a :class:`Sunrise` client like so: import yr_weather - my_client = yr_weather.Sunrise() + # Replace with your own User-Agent. See MET API Terms of Service for correct user agents. + headers = { + "User-Agent": "Your User-Agent" + } + + my_client = yr_weather.Sunrise(headers=headers) .. admonition:: Important :class: attention All of the next examples will use ``my_client`` as a reference to your client. -Getting one detail from Sunrise data +Getting one event from Sunrise data ------------------------------------ .. code-block:: python - # Get sunset for Oslo, Norway - sunset = my_client.get_detail("sunset", "2023-01-20", 59.91, 10.75, "+01:00") - - print(sunset) - # Example output: - # { - # 'desc': 'LOCAL DIURNAL SUN SET', - # 'time': '2023-01-20T16:00:36+01:00'} - # } + # Get sun and moon events data for Oslo, Norway + sun_events = client.get_sun_events("2023-10-10", 59.91, 10.75) + moon_events = client.get_moon_events("2020-10-10", 59.91, 10.75) -Getting all data from Sunrise ------------------------------ + sunrise_time = sun_events.sunrise.time + moonrise_time = moon_events.moonrise.time -.. code-block:: python - - # Get sunrise data for Oslo, Norway - sr_data = my_client.get_sunrise("2023-01-20", 59.91, 10.75, "+01:00") - - print(sr_data) - # Example output: - # { - # "location": { - # "height": "0", - # "latitude": "59.9", - # "longitude": "10.7", - # "time": [ - # { - # "date": "2023-01-20", - # "high_moon": { - # "desc": "LOCAL DIURNAL MAXIMUM MOON ELEVATION (Max= 1.94192)", - # "elevation": "1.941923918", - # "time": "2023-01-20T11:01:37+01:00" - # }, - # "low_moon": { - # "desc": "LOCAL DIURNAL MINIMUM MOON ELEVATION (Min= -57.28220)", - # "elevation": "-57.282202638", - # "time": "2023-01-20T23:33:17+01:00" - # }, - # "moonphase": { - # "desc": "LOCAL MOON STATE * MOON PHASE= 92.4 (waning crescent)", - # "time": "2023-01-20T00:00:00+01:00", - # "value": "92.421478765" - # }, - # "moonposition": { - # "azimuth": "34.784350684", - # "desc": "LOCAL MOON POSITION Elv: -54.742 deg, Azi: 34.784, Rng: 365364.7 km", - # "elevation": "-54.741908062", - # "phase": "92.421478765", - # "range": "365364.745236254", - # "time": "2023-01-20T00:00:00+01:00" - # }, - # "moonrise": { - # "desc": "LOCAL DIURNAL MOON RISE", - # "time": "2023-01-20T09:14:14+01:00" - # }, - # "moonset": { - # "desc": "LOCAL DIURNAL MOON SET", - # "time": "2023-01-20T12:48:59+01:00" - # }, - # "moonshadow": { - # "azimuth": "261.058146106", - # "desc": "LOCAL MOON STATE * SHADOW ANGLES (azi=261.1,ele=-62.5)", - # "elevation": "-62.546205058", - # "time": "2023-01-20T00:00:00+01:00" - # }, - # "solarmidnight": { - # "desc": "LOCAL DIURNAL MINIMUM SOLAR ELEVATION (Min= -50.33184)", - # "elevation": "-50.331839434", - # "time": "2023-01-20T00:27:46+01:00" - # }, - # "solarnoon": { - # "desc": "LOCAL DIURNAL MAXIMUM SOLAR ELEVATION (Max= 9.97480)", - # "elevation": "9.974802331", - # "time": "2023-01-20T12:28:23+01:00" - # }, - # "sunrise": { - # "desc": "LOCAL DIURNAL SUN RISE", - # "time": "2023-01-20T08:56:14+01:00" - # }, - # "sunset": { - # "desc": "LOCAL DIURNAL SUN SET", - # "time": "2023-01-20T16:00:36+01:00" - # } - # }, - # { - # "date": "2023-01-21", - # "moonposition": { - # "azimuth": "9.904412311", - # "desc": "LOCAL MOON POSITION Elv: -57.270 deg, Azi: 9.904, Rng: 362762.3 km", - # "elevation": "-57.27009424", - # "phase": "96.365027217", - # "range": "362762.2610191", - # "time": "2023-01-21T00:00:00+01:00" - # } - # } - # ] - # }, - # "meta": { - # "licenseurl": "https://api.met.no/license_data.html" - # } - # } + print(f"Sunrise will happen at {sunrise_time}") + print(f"Moonrise will happen at {moonrise_time}")