It is currently March 29th, 2024, 7:17 am

⭐ Weather.com - Parsing the V3 JSON

Our most popular Tips and Tricks from the Rainmeter Team and others
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 »

Hackit wrote: April 2nd, 2020, 9:04 pm Balala's skin is sick,
What you mean by sick?
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: April 3rd, 2020, 6:52 am What you mean by sick?
He means it's gnarly, bitchin, the bomb, all that and a bag of Fritos....

You know how Eskimos have 1,000 ways to say "snow"? American slang has 100,000 ways to say "good", and that's the cat's pajamas.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ weather.com - Parsing the JSON

Post by Yincognito »

balala wrote: April 3rd, 2020, 6:52 am What you mean by sick?
He means it's amazing / outstanding. And what jsmorley said, of course... :rofl:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
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 »

jsmorley wrote: April 3rd, 2020, 12:32 pm He means it's gnarly, bitchin, the bomb, all that and a bag of Fritos....

You know how Eskimos have 1,000 ways to say "snow"? American slang has 100,000 ways to say "good", and that's the cat's pajamas.
Yincognito wrote: April 3rd, 2020, 12:47 pm He means it's amazing / outstanding. And what jsmorley said, of course... :rofl:
Yeah, thanks both of you. Unfortunately for me this American slang tells nothing.
User avatar
Hackit
Posts: 85
Joined: May 19th, 2010, 9:05 pm
Location: North of the Border

Re: ⭐ weather.com - Parsing the JSON

Post by Hackit »

balala wrote: April 3rd, 2020, 6:52 am What you mean by sick?
sorry i'm north of 50 and i'm sure my slang is outdated.
should consult my teens before i try and sound hip.lol :Whistle
“Whether you think you can, or you think you can't – you're right”

DeviantArt Profile
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 »

Hackit wrote: April 3rd, 2020, 7:21 pm sorry i'm north of 50 and i'm sure my slang is outdated.
should consult my teens before i try and sound hip.lol :Whistle
No, that probably isn't. But because I'm not an "American" speaker, I don't fully understand the slang. My fault, but that's it...
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: ⭐ weather.com - Parsing the JSON

Post by fonpaolo »

Thanks jsmorley for the clarification... I've to admit that by opening your inc files with those "@" measures, you scared me, and also instilled a good deal of doubts about my knowledge of Rainmeter coding after this long break...

However, I managed to do what I wanted, I modified my skin and limited the download to only what I need, now it's up and running smoothly. :D
Probably, if and when they change something I'll have to change it again, but I hope they won't do it too often.

...and now I've more data than before! :17good

Losing the old wxdata, isn't that bad, in the end.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: ⭐ weather.com - Parsing the JSON

Post by fonpaolo »

A couple of questions about the "new" data source...

I doubt there are weather alerts for Europe (...and I've a better source) but other than pollen, do you know how they're structured?
I'll have to admit I haven't seen one.

Checking if what I did was correct, I compared what was displayed in my skin and on the site, is it possible there's a difference of 1° C in all temperatures?
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ weather.com - Parsing the JSON

Post by Yincognito »

fonpaolo wrote: April 3rd, 2020, 8:25 pm A couple of questions about the "new" data source...

I doubt there are weather alerts for Europe (...and I've a better source) but other than pollen, do you know how they're structured?
I'll have to admit I haven't seen one.

Checking if what I did was correct, I compared what was displayed in my skin and on the site, is it possible there's a difference of 1° C in all temperatures?
There are weather alerts for Europe, and they look like this:

Code: Select all

                "Alerts": {
                    "geocode:47.96,26.40:language:en-GB": {
                        "loading": false,
                        "loaded": true,
                        "data": {
                            "metadata": {
                                "next": null
                            },
                            "alerts": [{
                                "detailKey": "446a000f-0935-3e16-a11e-3d6828459829",
                                "messageTypeCode": 2,
                                "messageType": "Update",
                                "productIdentifier": "IWW",
                                "phenomena": "TWA",
                                "significance": "S",
                                "eventTrackingNumber": "RO005:TWA:S:2020:02:06",
                                "officeCode": "EURO",
                                "officeName": "National Meteorological Administration - Romania",
                                "officeAdminDistrict": null,
                                "officeAdminDistrictCode": "",
                                "officeCountryCode": "RO",
                                "eventDescription": "Potential disruption due to wind",
                                "severityCode": 4,
                                "severity": "Minor",
                                "categories": [{
                                    "category": "Met",
                                    "categoryCode": 2
                                }],
                                "responseTypes": [{
                                    "responseType": "Avoid",
                                    "responseTypeCode": 5
                                }],
                                "urgency": "Unknown",
                                "urgencyCode": 5,
                                "certainty": "Unknown",
                                "certaintyCode": 5,
                                "effectiveTimeLocal": "2020-02-06T01:00:00+02:00",
                                "effectiveTimeLocalTimeZone": "EET",
                                "expireTimeLocal": "2020-02-06T08:00:00+02:00",
                                "expireTimeLocalTimeZone": "EET",
                                "expireTimeUTC": 1580968800,
                                "onsetTimeLocal": "2020-02-06T01:00:00+02:00",
                                "onsetTimeLocalTimeZone": "EET",
                                "flood": null,
                                "areaTypeCode": "Z",
                                "latitude": 47.86,
                                "longitude": 26.76,
                                "areaId": "RO005",
                                "areaName": "Botosani",
                                "ianaTimeZone": "Europe\u002FBucharest",
                                "adminDistrictCode": " ",
                                "adminDistrict": null,
                                "countryCode": "RO",
                                "countryName": "ROMANIA",
                                "headlineText": "Potential disruption due to wind from THU 01:00 EET until THU 08:00 EET",
                                "source": "EUMETNET - MeteoAlarm",
                                "disclaimer": "Time delays between this website and \u003Ca href=http:\u002F\u002Fmeteoalarm.eu\u002F\u003EMeteoalarm.eu\u003C\u002Fa\u003E are possible. For the most up-to-date information about alert levels as published by the participating National Meteorological Services, please visit \u003Ca href=http:\u002F\u002Fmeteoalarm.eu\u002F\u003EMeteoalarm\u003C\u002Fa\u003E.",
                                "issueTimeLocal": "2020-02-05T13:26:05+02:00",
                                "issueTimeLocalTimeZone": "EET",
                                "identifier": "d3241ece2002746fef420908be5c1915",
                                "processTimeUTC": 1580902323
                            }, {
                                "detailKey": "6f6e3212-e368-3340-866f-767c8a3b0ded",
                                "messageTypeCode": 2,
                                "messageType": "Update",
                                "productIdentifier": "IWW",
                                "phenomena": "TWA",
                                "significance": "S",
                                "eventTrackingNumber": "RO005:TWA:S:2020:02:05",
                                "officeCode": "EURO",
                                "officeName": "National Meteorological Administration - Romania",
                                "officeAdminDistrict": null,
                                "officeAdminDistrictCode": "",
                                "officeCountryCode": "RO",
                                "eventDescription": "Potential disruption due to wind",
                                "severityCode": 4,
                                "severity": "Minor",
                                "categories": [{
                                    "category": "Met",
                                    "categoryCode": 2
                                }],
                                "responseTypes": [{
                                    "responseType": "Avoid",
                                    "responseTypeCode": 5
                                }],
                                "urgency": "Unknown",
                                "urgencyCode": 5,
                                "certainty": "Unknown",
                                "certaintyCode": 5,
                                "effectiveTimeLocal": "2020-02-05T11:30:00+02:00",
                                "effectiveTimeLocalTimeZone": "EET",
                                "expireTimeLocal": "2020-02-06T00:59:00+02:00",
                                "expireTimeLocalTimeZone": "EET",
                                "expireTimeUTC": 1580943540,
                                "onsetTimeLocal": "2020-02-05T11:30:00+02:00",
                                "onsetTimeLocalTimeZone": "EET",
                                "flood": null,
                                "areaTypeCode": "Z",
                                "latitude": 47.86,
                                "longitude": 26.76,
                                "areaId": "RO005",
                                "areaName": "Botosani",
                                "ianaTimeZone": "Europe\u002FBucharest",
                                "adminDistrictCode": " ",
                                "adminDistrict": null,
                                "countryCode": "RO",
                                "countryName": "ROMANIA",
                                "headlineText": "Potential disruption due to wind from WED 11:30 EET until THU 00:59 EET",
                                "source": "EUMETNET - MeteoAlarm",
                                "disclaimer": "Time delays between this website and \u003Ca href=http:\u002F\u002Fmeteoalarm.eu\u002F\u003EMeteoalarm.eu\u003C\u002Fa\u003E are possible. For the most up-to-date information about alert levels as published by the participating National Meteorological Services, please visit \u003Ca href=http:\u002F\u002Fmeteoalarm.eu\u002F\u003EMeteoalarm\u003C\u002Fa\u003E.",
                                "issueTimeLocal": "2020-02-05T13:26:05+02:00",
                                "issueTimeLocalTimeZone": "EET",
                                "identifier": "d3241ece2002746fef420908be5c1915",
                                "processTimeUTC": 1580902323
                            }]
                        },
                        "ttl": 60,
                        "date": 1580936590000
                    }
                },
Their location in the page source's JSON is between the "Location":{...} section and "HourlyForecast":{...} one, if the URL is for today (which still includes all the 14 other forecasted days). Like always, bear in mind that what I post is formatted for clarity, and that the carriage returns / line feeds, tabs and the spaces after : don't really exist in the actual source - there, it's just one long line of stuff.

EDIT: Also, there is a limited "alert type" field in each forecast day section. It is called "qualifier", and it can have values like "Hard freeze expected.", sometimes regarding stronger winds, etc. Personally, I prefer displaying this instead of messing around with the enormous (and in some places, confusing) amount of data in the "Alerts" section of the JSON.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: ⭐ weather.com - Parsing the JSON

Post by fonpaolo »

Thanks Yincognito.
Probably it's the wrong time, since the weather is almost always good, so, no alerts, however in the old wxdata the alerts were gone long ago and looking at the web page every now and then, I haven't seen any.

This slowed me down a lot in developing of the new version of my skins... :(