willasm / obsidian-open-weather

Obsidian plugin for OpenWeather API
MIT License
47 stars 3 forks source link

Support for MoonPhase #23

Closed Crazypedia closed 7 months ago

Crazypedia commented 7 months ago

I saw that openweather api has support for moonphase information which is something I'm trying to include on my notes.

https://www.visualcrossing.com/resources/documentation/weather-api/how-to-include-sunrise-sunset-and-moon-phase-data-into-your-api-requests/

essentially, it just returns a value from 0-1 related to when the moon is new(0) or Full(0.5). From the website:

Moon phase number The moon phase number represents the fractional portion through the current moon lunation cycle ranging from 0 (the new moon) to 0.5 (the full moon) and back to 1 (the next new moon). These numbers are similar to other Weather API providers such as Dark Sky so converting existing applications is easy.

Traditional, western moon cycles are therefore represented by the following values:

0 – new moon 0-0.25 – waxing crescent 0.25 – first quarter 0.25-0.5 – waxing gibbous 0.5 – full moon 0.5-0.75 – waning gibbous 0.75 – last quarter 0.75 -1 – waning crescent Moon phases are reported at midday local time. On days where a quarterly phase occurs (new moon, first quarter, full moon and last quarter) the values are rounded to the quarterly phase value (0, 0.25, 0.5, 0.75). Therefore you can identify the quarterly days by identifying days with these values.

If we could just get access to that, it should be easy to add to our weather reports and even replace the values with a moon phase emoji.

willasm commented 7 months ago

First I have to tell you that is a different API that you linked to. You can find the OpenWeather API here.

OpenWeather and I'm using this API which is completely free and offers 60 calls a minute and up to 1,000,000 calls a month.

OpenWeather does offer the One Call API which does have the moon phases and it does offer 1000 free calls per day but you are billed if you go over that. It also requires a credit card to subscribe to the API. I want to avoid that as most of the plugin's users are not likely to want to subscribe to an API that requires a payment method.

The one you linked to does look interesting though. It does offer a 15 day forecast which would be nice to have. The problem is that I would essentially need to write another plugin to use the API, it is not a simple matter to add another API to the existing plugin. The format in which the data is returned by both is completely different. I will have a longer look at what it has to offer though. The only downside I see so far is the call limit on the API but I will take a deeper look at it.

Thanks, William.

Crazypedia commented 7 months ago

oh whoops, i got lost going down a rabbit hole. thank you for taking a look all the same!