It is currently March 28th, 2024, 5:58 pm

⭐ Weather.com - Parsing the V3 JSON

Our most popular Tips and Tricks from the Rainmeter Team and others
User avatar
Yincognito
Rainmeter Sage
Posts: 7025
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ weather.com - Parsing the JSON

Post by Yincognito »

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...
I say just stick on things that are happening during the day in question (whether it's today, tomorrow or any forecasted day). Forget about what moonrise time is a moonset time's pair or viceversa. If a moonrise or moonset time happens today, show it. If it doesn't, that's it. It will be shown on the day it is happening, period (even if its pair doesn't belong to the day in question).
User avatar
balala
Rainmeter Sage
Posts: 16110
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:34 pm I say just stick on things that are happening during the day in question (whether it's today, tomorrow or any forecasted day). Forget about what moonrise time is a moonset time's pair or viceversa. If a moonrise or moonset time happens today, show it. If it doesn't, that's it. It will be shown on the day it is happening, period (even if its pair doesn't belong to the day in question).
That's it! :thumbup:
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, 8:26 pm 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.
Well, I think you missed part of my point. Yes, you've got the "rise" part right, but what about the "set"?

jsmorley and his lovely wife are watching the moon set over the lovely ramparts of Fort Hunt, and she asks "What time does the moon set?" He looks at his handy Rainmeter widget and says, "It's not gonna set today, TWC says it sets Wednesday." At which point he gets "the look", since it's setting right now. Re-read my post and you'll see what I'm referring to. The setting is the problem, not the rising, in this example. Forget the "rise-set" pairs, because they don't sync with the sun. You need to get the rise and set on that day, which can be one in which the "set" happens before the "rise".
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 »

All of this is going to be a problem, due to the restraining order. That reminds me, what is the language code for "jackal" on weather.com?
User avatar
Yincognito
Rainmeter Sage
Posts: 7025
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ weather.com - Parsing the JSON

Post by Yincognito »

balala wrote: February 13th, 2020, 8:04 pmWell, 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.
balala wrote: February 13th, 2020, 8:09 pmIn 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?
Indeed - you are correct. I don't see it as "weird", though; it's just that we're not used with such so called "anomalies", despite the fact that these "anomalies" have a perfectly reasonable astronomical explanation.
User avatar
balala
Rainmeter Sage
Posts: 16110
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:44 pm Indeed - you are correct. I don't see it as "weird", though; it's just that we're not used with such so called "anomalies", despite the fact that these "anomalies" have a perfectly reasonable astronomical explanation.
Exactly, they have. For "usual" people (who are not thinking about how Moon does "work"), it might be looking weird. But it's just the nature...
User avatar
Yincognito
Rainmeter Sage
Posts: 7025
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:39 pmWell, I think you missed part of my point. Yes, you've got the "rise" part right, but what about the "set"?

jsmorley and his lovely wife are watching the moon set over the lovely ramparts of Fort Hunt, and she asks "What time does the moon set?" He looks at his handy Rainmeter widget and says, "It's not gonna set today, TWC says it sets Wednesday." At which point he gets "the look", since it's setting right now. Re-read my post and you'll see what I'm referring to. The setting is the problem, not the rising, in this example. Forget the "rise-set" pairs, because they don't sync with the sun. You need to get the rise and set on that day, which can be one in which the "set" happens before the "rise".
I see what you mean. However, I don't think TWC will provide the Wednesday moonset time on Tuesday. I believe it will provide the Tuesday moonset time (which occurs earlier than the moonrise time). See an example below for Cape Town, South Africa - the displayed moonset is the one today (13 Feb), despite the rise occuring later, similar to your example. On the center of the image, timeanddate.com data and graphic; on the top, my skins, with the weather one diplaying its tooltip on the top-right side of the screen:
Silver Moon.jpg
So jsmorley will be able to tell his lovely wife when the moon will set right now (and not the moonset time on Wednesday). :thumbup:

EDIT: Ha! Just discovered a little bug in my geocode coordinate conversion, LOL. Nothing too serious, just forgot to include a regex to truncate the decimals before I format and space the numerical string properly.
User avatar
Yincognito
Rainmeter Sage
Posts: 7025
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ weather.com - Parsing the JSON

Post by Yincognito »

Two questions:
- does anyone know what it the maximum length in chars of the phrase field in Observation and DailyForecast?
- what does DailyForecast's cloudPct mean: is it the probability percent of having clouds in the sky, or the percent of the sky filled with clouds?
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, 10:49 pm Two questions:
- does anyone know what it the maximum length in chars of the phrase field in Observation and DailyForecast?
- what does DailyForecast's cloudPct mean: is it the probability percent of having clouds in the sky, or the percent of the sky filled with clouds?
For the first one, I don't know the exact number but I've seen some really long ones. Not sure if it is possible to know the exact number.
For the second item, I think it is the percentage of the sky filled with clouds. Dark Sky has a similar value, where 0 is clear and 1 is completely overcast. Dark Sky leaves it up to you to figure out the difference between clear, fair, partly cloudy, mostly cloudy, and cloudy. This percentage probably drives their description generator, and there's no documentation on what the percentage ranges are for each condition.
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 »

Thanks for the links Yincognito.

Here are the weather.com icon numbers and what they mean:
0 : Tornado : Day & Night
1 : Tropical Storm : Day & Night
2 : Hurricane : Day & Night
3 : Strong Storms : Day & Night
4 : Thunderstorms : Day & Night
5 : Rain / Snow : Day & Night
6 : Rain / Sleet : Day & Night
7 : Wintry Mix : Day & Night
8 : Freezing Drizzle : Day & Night
9 : Drizzle : Day & Night
10 : Freezing Rain : Day & Night
11 : Showers : Day & Night
12 : Rain : Day & Night
13 : Flurries : Day & Night
14 : Snow Showers : Day & Night
15 : Blowing / Drifting Snow : Day & Night
16 : Snow : Day & Night
17 : Hail : Day & Night
18 : Sleet : Day & Night
19 : Blowing Dust / Sandstorm : Day & Night
20 : Foggy : Day & Night
21 : Haze : Day & Night
22 : Smoke : Day & Night
23 : Breezy : Day & Night
24 : Windy : Day & Night
25 : Frigid / Ice Crystals : Day & Night
26 : Cloudy : Day & Night
27 : Mostly Cloudy : Night
28 : Mostly Cloudy : Day
29 : Partly Cloudy : Night
30 : Partly Cloudy : Day
31 : Clear : Night
32 : Sunny : Day
33 : Fair / Mostly Clear : Night
34 : Fair / Mostly Sunny : Day
35 : Mixed Rain and Hail : Day
36 : Hot : Day
37 : Isolated Thunderstorms : Day
38 : Scattered Thunderstorms : Day
39 : Scattered Showers : Day
40 : Heavy Rain : Day & Night
41 : Scattered Snow Showers : Day
42 : Heavy Snow : Day & Night
43 : Blizzard : Day & Night
44 : Not Available (N/A) : Day & Night
45 : Scattered Showers : Night
46 : Scattered Snow Showers : Night
47 : Scattered Thunderstorms : Night
And a .zip of the official 200x200 icons from the site, which can be used as a reference when you create your own:

SiteIcons.zip
(177.49 KiB) Downloaded 35 times
Post Reply