It is currently March 28th, 2024, 9:47 am

⭐ Weather.com - Parsing the V3 JSON

Our most popular Tips and Tricks from the Rainmeter Team and others
Post Reply
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm
Contact:

Re: ⭐ weather.com - Parsing the JSON

Post by SilverAzide »

Yincognito wrote: February 13th, 2020, 6:11 pm I might have poorly understood your case, but if you said the moon "was still up" when you looked at it, shouldn't it have to set before it could rise again? Therefore, set before next rise... :???:
Sorry for the confusion, I'm confused myself. How about an example: It's 1AM in the morning on Tuesday and the moon is shining brightly outside your window. You query the TWC data and see the moonrise is 9PM Tuesday and moonset is 4AM Wednesday.

But the moon's already UP. To know what time the moon sets NOW (it's 1 AM, remember), you actually have to know the rise-set values from the day before, Monday.

And what values do you want to see on your skin at 1 AM Tuesday? Monday's values are more correct, since the moon hasn't set yet. Once the moon HAS set, THEN the Tuesday values are correct.

It's entirely possible to calculate the rise-set times yourself. What you may find is that, if calculating the rise-set times at 1AM Tuesday, you'll see that the moon sets at 3 AM Tuesday and rises at 9 PM Tuesday. In other words, a day where it set before it rose.

Mixing solar cycles and lunar cycles gets... loony. ;)
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: ⭐ weather.com - Parsing the JSON

Post by balala »

jsmorley wrote: February 13th, 2020, 6:49 pm So tomorrow the moon will be taking a break and just not rising?
Well, not taking a break, just for our location (if I'm not wrong Yincognito and me are almost on the same location), on January 14, the Moon doesn't rise. In fact such situations exist and the reality is that it rises on January 13 right before the midnight, then sets on January 14 and next time it rises on January 15. So practically you can say it doesn't rise on January 14. This is correct and there is nothing wrong with this. Yincognito is right when he says the Moon doesn't rise for his location. For other locations this probably is different and the Moon rises even tomorrow, but not for any location around the world.
In such cases the skin should indeed not return a rise time. My SunMoon skin of the Mirage suite (sorry for the self promotion) calculates locally (not downloads it from internet) and shows the same situation for: on dates when there is no Moonrise (for instance for January 14 for our location) or Moonset (because such cases also exist) it indicates this fact: No rise, respectively No set.
User avatar
Yincognito
Rainmeter Sage
Posts: 7017
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ weather.com - Parsing the JSON

Post by Yincognito »

jsmorley wrote: February 13th, 2020, 6:49 pmSo tomorrow the moon will be taking a break and just not rising?
Haha, nope. Just checked, its rise is today (13 Feb) at 22:59 (roughly 11 PM) and then it sets on 14 Feb at 10:14 (roughly 10 AM). Its next rise is not until 00:17 (a quarter past midnight) on the 15th of Feb, so that's why 14 Feb has only a moonset time, but not a moonrise time. The cropped screenshot below explains it all (as well as SilverAzide's dilemma on how a moonset can happen before a moonrise on the same day):
Moon Stuff.jpg
It's easier to understand if you grasp the notion that moon rise and set times do not follow our day / night cycles or conventions. A moon rise or set can happen on a certain 24h day, while its complementary set or rise is left to happen on the following 24h day. We are so used with the sun rise and set times that we can find difficult to understand similar moon times, just because they have an (variable) offset compared to our daily routine / conventions.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ weather.com - Parsing the JSON

Post by jsmorley »

balala wrote: February 13th, 2020, 8:04 pm Well, not taking a break, just for our location (if I'm not wrong Yincognito and me are almost on the same location), on January 14, the Moon doesn't rise. In fact such situations exist and the reality is that it rises on January 13 right before the midnight, then sets on January 14 and next time it rises on January 15. So practically you can say it doesn't rise on January 14. This is correct and there is nothing wrong with this. Yincognito is right when he says the Moon doesn't rise for his location. For other locations this probably is different and the Moon rises even tomorrow, but not for any location around the world.
In such cases the skin should indeed not return a rise time. My SunMoon skin of the Mirage suite (sorry for the self promotion) calculates locally (not downloads it from internet) and shows the same situation for: on dates when there is no Moonrise (for instance for January 14 for our location) or Moonset (because such cases also exist) it indicates this fact: No rise, respectively No set.
I see... No, I don't see a bit, but... I see... I gave up depending on the moon when I got married. It failed me then, and no doubt would again.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: ⭐ weather.com - Parsing the JSON

Post by balala »

Yincognito wrote: February 13th, 2020, 8:04 pm It's easier to understand if you grasp the notion that moon rise and set times do not follow our day / night cycles or conventions. A moon rise or set can happen on a certain 24h day, while its complementary set or rise is left to happen on the following 24h day. We are so used with the sun rise and set times that we can find difficult to understand similar moon times, just because they have an (variable) offset compared to our daily routine / conventions.
In fact in some situations and at least for some locations, Moon can rise even twice a day: right after midnight, then again right before next midnight. But in this case it's the same date.
Weird, isn't it?
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: ⭐ weather.com - Parsing the JSON

Post by balala »

jsmorley wrote: February 13th, 2020, 8:06 pm I see... No, I don't see a bit, but... I see... I gave up depending on the moon when I got married. It failed me then, and no doubt would again.
Yep, what's going on with Moon can be weird in some cases. As Yincognito said:
Yincognito wrote: February 13th, 2020, 8:04 pm We are so used with the sun rise and set times that we can find difficult to understand similar moon times, just because they have an (variable) offset compared to our daily routine / conventions.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ weather.com - Parsing the JSON

Post by jsmorley »

So the trick is to not deal with matching "today" or "tomorrow" or any particular day of the week with the moon comings and goings, like you might do with the chance of precipitation and such.

The moon WILL set, and rise, one after the other, every 24 hours. What day and what time those fall on are something you can display, but don't bother trying to make the same kind of display you might do for the sun, with "today", "tomorrow", "Saturday", "day", "night", etc...
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ weather.com - Parsing the JSON

Post by jsmorley »

So the best display might be a chart of the next XX days, with a horizontal line through the middle, to represent the horizon. Then draw a sine wave over it, showing when the moon will be "up" and when it will be "down". Then just stick the icon in the middle of each "up" section, or maybe at 7:00am on each "day".
User avatar
Yincognito
Rainmeter Sage
Posts: 7017
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ weather.com - Parsing the JSON

Post by Yincognito »

SilverAzide wrote: February 13th, 2020, 8:02 pmAnd what values do you want to see on your skin at 1 AM Tuesday? Monday's values are more correct, since the moon hasn't set yet. Once the moon HAS set, THEN the Tuesday values are correct.
It's not about me, it's about the user. He would probably want to see the situation for the current day (i.e. today). He won't give a damn about yesterday, since that's past tense, it's done, it's dusted. He won't be able to see the Monday's moonrise anyway, as he's late to the party, so he'll care about whether a moonrise happens today or not. If not, when it's the next time jsmorley and his wife spend some quality time watching the moon rise? You guessed it, it's Tuesday! ;-)

Bottom line is, Monday's moonrise is "more correct" only when you see it as belonging to the same rise+set tuple. Otherwise, when we talk about today, the Tuesday rise is the one to show.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: ⭐ weather.com - Parsing the JSON

Post by balala »

jsmorley wrote: February 13th, 2020, 8:15 pm So the trick is to not deal with matching "today" or "tomorrow" or any particular day of the week with the moon comings and goings, like you might do with the chance of precipitation and such.

The moon WILL set, and rise, one after the other, every 24 hours. What day and what time those fall on are something you can display, but don't bother trying to make the same kind of display you might do for the sun, with "today", "tomorrow", "Saturday", "day", "night", etc...
Right! And note that the time of Moonrise and Moonset vary on the location as well.
Post Reply