It is currently June 27th, 2024, 6:19 pm

⭐ Weather.com - Parsing the V3 JSON

Our most popular Tips and Tricks from the Rainmeter Team and others
User avatar
jsmorley
Developer
Posts: 22642
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by jsmorley »

Mirage wrote: June 5th, 2020, 11:23 pm How did you know OnyxBlack? :) Which measures are you referring to? I don't seem to see anything for Moon times?
Just @Include WeatherComJSONMoon.inc in your skin.


1.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
Mirage
Posts: 23
Joined: September 11th, 2012, 3:36 am

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by Mirage »

Yeah, I feel stupid. Finally got 5 minutes to look at exactly how things are working with this change and of course the first thing I noticed was the Moon.inc file. Duuuhhh! Thanks. Just another case of RTFM. ( Read the f'n manual) :) You guys are awesome. Thanks a bunch, all of you!
EeK
Posts: 12
Joined: January 28th, 2020, 1:26 am

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by EeK »

Hey, y'all. I need some help updating my weather skin.

I use a heavily modified version of SysDash, hacking together a bunch of code from forums (including the previous weather "fix") and editing it myself, to my taste. Basically, it displays the current weather and a forecast for the next few days, using custom icons. It currently looks like this (broken):

Image

The weather portion of the skin includes three .ini files:

Weather.ini
Weather_Forecast.ini
WeatherMOD.ini

Under @Resources, there are five .inc files (aside from Base.ini and Variables.ini):

WeatherCom36Hours.inc
WeatherComCurrent.inc
WeatherComForecast.inc
WeatherComRegExp.inc
WeatherComVariables.inc

Everything is already configured with the correct location ID and whatnot. How do I go on about modifying only the necessary portion in order to make the skin fetch the updated weather info?
User avatar
VClouds
Posts: 78
Joined: April 7th, 2010, 2:34 pm

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by VClouds »

Hi jsmorley, I'm in the process of fixing my weather skin using your templates. I have noticed something strange with the current weather conditions.
Sometimes the weather conditions doesn't match the weather icon and also won't match the conditions on the actual weather.com website.

In the picture below you can see that my VClouds Weather and your weather.com skin (with red dots) shows the same wrong conditions, the icon is for the 'Fair' weather condition but the text shows 'Partly Cloudy'.

The weather.com website on the right side and the weather skin by xxenium shows identical conditions. also the update times for all the skins are the same.

I saw this happen a few times ever since I started fixing my skin using your template yesterday with both day and night conditions.
Wrong-Weather.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22642
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by jsmorley »

VClouds wrote: June 7th, 2020, 12:08 pm Hi jsmorley, I'm in the process of fixing my weather skin using your templates. I have noticed something strange with the current weather conditions.
Sometimes the weather conditions doesn't match the weather icon and also won't match the conditions on the actual weather.com website.

In the picture below you can see that my VClouds Weather and your weather.com skin (with red dots) shows the same wrong conditions, the icon is for the 'Fair' weather condition but the text shows 'Partly Cloudy'.

The weather.com website on the right side and the weather skin by xxenium shows identical conditions. also the update times for all the skins are the same.

I saw this happen a few times ever since I started fixing my skin using your template yesterday with both day and night conditions.

Wrong-Weather.jpg
I'm not sure there is any certain or standard correlation between the conditions text and the icon number they use. I think all you can do is display the conditions text and display the icon. It's the best information at the time.

xxenium is with some of his still parsing the HTML from the site, and I expect there could be some subtle differences between the HTML and the JSON.
User avatar
jsmorley
Developer
Posts: 22642
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by jsmorley »

For instance, right now my local conditions are "Clear" in the JSON, but "Sunny" in the HTML. That is a distinction without much difference I guess, but all I think we can do is go with the JSON.


1.jpg


To me at least, "Clear" feels more like a "nighttime" condition, analogous to "Sunny" in the "daytime". Since it is quite early morning here, the JSON might just be a tad behind the HTML in that sense.
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7545
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by Yincognito »

VClouds wrote: June 7th, 2020, 12:08 pm Hi jsmorley, I'm in the process of fixing my weather skin using your templates. I have noticed something strange with the current weather conditions.
Sometimes the weather conditions doesn't match the weather icon and also won't match the conditions on the actual weather.com website.

In the picture below you can see that my VClouds Weather and your weather.com skin (with red dots) shows the same wrong conditions, the icon is for the 'Fair' weather condition but the text shows 'Partly Cloudy'.

The weather.com website on the right side and the weather skin by xxenium shows identical conditions. also the update times for all the skins are the same.

I saw this happen a few times ever since I started fixing my skin using your template yesterday with both day and night conditions.

Wrong-Weather.jpg
jsmorley wrote: June 7th, 2020, 12:12 pm

I'm not sure there is any certain or standard correlation between the conditions text and the icon number they use. I think all you can do is display the conditions text and display the icon. It's the best information at the time.

xxenium is with some of his still parsing the HTML from the site, and I expect there could be some subtle differences between the HTML and the JSON.
jsmorley wrote: June 7th, 2020, 12:20 pm For instance, right now my local conditions are "Clear" in the JSON, but "Sunny" in the HTML. That is a distinction without much difference I guess, but all I think we can do is go with the JSON.
Another possibility is how the parsing matches the "phrase" string, since there are more such strings in the observation section (notice the 'Partly Cloudy' in cloud cover and the 'Sunny' in the wx phrase long, it's the latter one that we should be interested in):

Code: Select all

                            data: {
                                cloudCeiling: null,
                                cloudCoverPhrase: "Partly Cloudy",
                                dayOfWeek: "Friday",
                                dayOrNight: "D",
                                expirationTimeUtc: 1590136315,
                                iconCode: 32,
                                iconCodeExtend: 3200,
                                obsQualifierCode: null,
                                obsQualifierSeverity: null,
                                precip1Hour: 0,
                                precip6Hour: 0,
                                precip24Hour: 0,
                                pressureAltimeter: 1021,
                                pressureChange: -0.34,
                                pressureMeanSeaLevel: 1020.5,
                                pressureTendencyCode: 2,
                                pressureTendencyTrend: "Falling",
                                relativeHumidity: 36,
                                snow1Hour: 0,
                                snow6Hour: 0,
                                snow24Hour: 0,
                                sunriseTimeLocal: "2020-05-22T05:27:12+0300",
                                sunriseTimeUtc: 1590114432,
                                sunsetTimeLocal: "2020-05-22T20:55:35+0300",
                                sunsetTimeUtc: 1590170135,
                                temperature: 13,
                                temperatureChange24Hour: -3,
                                temperatureDewPoint: -2,
                                temperatureFeelsLike: 12,
                                temperatureHeatIndex: 13,
                                temperatureMax24Hour: 17,
                                temperatureMaxSince7Am: 13,
                                temperatureMin24Hour: 6,
                                temperatureWindChill: 12,
                                uvDescription: "Moderate",
                                uvIndex: 5,
                                validTimeLocal: "2020-05-22T11:21:55+0300",
                                validTimeUtc: 1590135715,
                                visibility: 8,
                                windDirection: 310,
                                windDirectionCardinal: "NW",
                                windGust: 23,
                                windSpeed: 14,
                                wxPhraseLong: "Sunny",
                                wxPhraseMedium: null,
                                wxPhraseShort: null,
                            },
Yet another possibility are the subtle differences between the en-US and the en-GB languages I mentioned earlier, although that seems to apply more on the forecast data and less on the current conditions.
Last edited by Yincognito on June 7th, 2020, 12:47 pm, edited 1 time in total.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Pflosch
Posts: 39
Joined: May 24th, 2020, 7:04 am
Location: Switzerland

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by Pflosch »

With the JSON files of SilveAzide on pg23, I get weather data again, however I noticed 2 things:
- Pressure shows 33887mb, that's plenty :???:
- Wind comes in mph, i thought with en-GB it should be in km/h. Value however is correct in mph.

Do I make smthg wrong?

Thanks all of you to put your time into these parsers.
I think maybe no problem.
User avatar
Yincognito
Rainmeter Sage
Posts: 7545
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by Yincognito »

Pflosch wrote: June 7th, 2020, 12:31 pm With the JSON files of SilveAzide on pg23, I get weather data again, however I noticed 2 things:
- Pressure shows 33887mb, that's plenty :???:
- Wind comes in mph, i thought with en-GB it should be in km/h. Value however is correct in mph.

Do I make smthg wrong?

Thanks all of you to put your time into these parsers.
The hybrid (i.e. UK, or en-GB) units for speed are mph, not km/h.
EDIT: Regarding the pressure, the highest altimeter pressure ever recorded is 1085 mb, so some checking on how things are matched by the regex could help.

EDIT2: The pressure thing might have something to do with how OnyxBlack decided to handle commas in values. You can check his replies earlier, I believe having 33887mb for the pressure is likely related to this - just speculating, of course.
Last edited by Yincognito on June 7th, 2020, 12:50 pm, edited 3 times in total.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22642
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by jsmorley »

Yeah, the whole en-GB thing throws a new wrinkle into this. Before, it felt safest to use en-GB to get "metric" instead of en-US to get "imperial", as the language-based text should be pretty similar. With the new "hybrid" units of measure they use for en-GB, it might be much safer to use en-CA or en-AU or something, to get pure "metric", while having some hope that the text and phrases used will be familiar to a US English speaker.

Again, the Brits still use miles and miles per hour for distance (visibility) and speed (wind) in common practice, including in how they talk about the weather. Weather.com has now acknowledged this, and created this new "hybrid" units of measure type.

Britain is struggling even more than the US with the whole "metric" deal. In the US, we pretty much just said, "Yeah, I don't think so Tim", and unless you are working in the sciences, metric is entirely ignored. In the UK, it's much more confused. Officially the country has converted to metric years ago, but in common practice, in day-to-day life, it is hit or miss. Depends on what you are talking about, as the weight of a person is still measured in "stones", and the height of a horse is still measured in "hands". It also depends somewhat on what the ages are of the people doing the talking. Older folks like "imperial" for a lot of things, younger folks like "metric". However, they know both, and just adjust based on the audience.