It is currently February 3rd, 2023, 5:05 am

⭐ Weather.com - Parsing the V3 JSON

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

Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!

Post by jsmorley »

It does mean this data isn't a great fit for a skin designed with a "current", "today/tonight", "tomorrow" flavor. This pollen stuff needs to kinda stand alone with the data driving the "day" instead of the day driving the "data". There is no real easy way to ask "what is the pollen stuff for tomorrow night"? I mean, you can, but it's going to take some String measures and IfMatch on the "D/N" stuff.
User avatar
Yincognito
Rainmeter Sage
Posts: 4842
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!

Post by Yincognito »

jsmorley wrote: August 4th, 2020, 1:10 am So I'm looking at keeping it simple.
[...]
Damn, that looks really simple and efficient. :sly: I think you're on the right track there. :thumbup:
Just for reference, I can get the historical V3 pollen using an URL like (my location doesn't work with this one, I'm assuming it's US only or something):

Code: Select all

https://api.weather.com/v3/wx/indices/pollen/historical/1month?geocode=33.33,-83.22&format=json&language=en-CA&yearMonth=202007&apiKey=<ApiKey>
but a pollen forecast like:

Code: Select all

https://api.weather.com/v3/wx/indices/pollen/daypart/3day?geocode=33.33,-83.22&format=json&language=en-CA&apiKey=<ApiKey>
doesn't work, despite trying various ways to write or permutate the wx/indices/pollen/daypart/3day part. This part is key (unless some other parameter is needed in the URL, like for the historical pollen above) - I leave this here maybe someone else wil have better luck guessing the right syntax for this.

EDIT: By the way, I checked a wunderground.com page for links regarding pollen forecast, and they also seem to request only V1 and V2 data, no V3 one. So it might just be that the V3 option is for some reason unavailable (or maybe in the process of being built)...
User avatar
jsmorley
Developer
Posts: 22558
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!

Post by jsmorley »

Yincognito wrote: August 4th, 2020, 1:24 am Damn, that looks really simple and efficient. :sly: I think you're on the right track there. :thumbup:
Just for reference, I can get the historical V3 pollen using an URL like (my location doesn't work with this one, I'm assuming it's US only or something):

Code: Select all

https://api.weather.com/v3/wx/indices/pollen/historical/1month?geocode=33.33,-83.22&format=json&language=en-CA&yearMonth=202007&apiKey=<ApiKey>
but a pollen forecast like:

Code: Select all

https://api.weather.com/v3/wx/indices/pollen/daypart/3day?geocode=33.33,-83.22&format=json&language=en-CA&apiKey=<ApiKey>
doesn't work, despite trying various ways to write or permutate the wx/indices/pollen/daypart/3day part. This part is key (unless some other parameter is needed in the URL, like for the historical pollen above) - I leave this here maybe someone else wil have better luck guessing the right syntax for this.

EDIT: By the way, I checked a wunderground.com page for links regarding pollen forecast, and they also seem to request only V1 and V2 data, no V3 one. So it might just be that the V3 option is for some reason unavailable (or maybe in the process of being built)...
Yeah, could very well be. There is also apparently an "aggregate" form where it could be obtained along with the other data in one go, but it seems you can't mix and match V3 "products" with V2 "products".
User avatar
Yincognito
Rainmeter Sage
Posts: 4842
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!

Post by Yincognito »

jsmorley wrote: August 4th, 2020, 1:37 am Yeah, could very well be. There is also apparently an "aggregate" form where it could be obtained along with the other data in one go, but it seems you can't mix and match V3 "products" with V2 "products".
Yes. The aggregate form is from what I did read (didn't try though) available for V3 historical pollen. Generally, the / becomes - in the aggregate URL, with some very rare exceptions.
User avatar
jsmorley
Developer
Posts: 22558
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!

Post by jsmorley »

BTW, on an unrelated topic, you had questioned the "scale" used with "Air Quality", they are:

United States EPA
China HJ6332012
France ATMO
Germany UBA
United Kingdom of Great Britain and Northern Ireland (the) DAQI
India NAQI
Mexico IMECA
Spain CAQI

It has to do with which bureau of jack-booted thugs is responsible for lying to the public in the different countries. The recommendation on the site is to indeed just use EPA.

It doesn't seem to be "scale" in the sense of "units of measure", which always seems to be "μg/m3", but rather "scale" in the sense of "how much of that is ... bad?"
User avatar
Yincognito
Rainmeter Sage
Posts: 4842
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!

Post by Yincognito »

jsmorley wrote: August 4th, 2020, 1:41 am BTW, on an unrelated topic, you had questioned the "scale" used with "Air Quality", they are:

United States EPA
China HJ6332012
France ATMO
Germany UBA
United Kingdom of Great Britain and Northern Ireland (the) DAQI
India NAQI
Mexico IMECA
Spain CAQI

It has to do with which bureau of jack-booted thugs is responsible for lying to the public in the different countries. The recommendation on the site is to indeed just use EPA.
Yeah, figured out that part afterwards, browsing the docs - but thanks anyway. :D I congratulate myself with each day passing by that I don't have to (and I never will) grab the alerts, pollen, air quality stuff, as there are just too many possibilities there (I assume EPA wouldn't work for say China and viceversa HJwhatever wouldn't work for the US, although I might very well be mistaken). O.O
User avatar
jsmorley
Developer
Posts: 22558
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!

Post by jsmorley »

Yincognito wrote: August 4th, 2020, 1:48 am Yeah, figured out that part afterwards, browsing the docs - but thanks anyway. :D I congratulate myself with each day passing by that I don't have to (and I never will) grab the alerts, pollen, air quality stuff, as there are just too many possibilities there (I assume EPA wouldn't work for say China and viceversa HJwhatever wouldn't work for the US, although I might very well be mistaken). O.O
As far as I can tell, all of the scales work everywhere. Now mind you, it could be that if you access a location in a country that doesn't support China's HJ6332012 agency, it just defaults to either EPA or whatever agency IS supported in that location, but at least it doesn't seem to "fail" with any combination of language, location or scale.
User avatar
jsmorley
Developer
Posts: 22558
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!

Post by jsmorley »

I literally just think that "scale" is a lookup on the terms used for good and bad. If I use the Chinese scale on my US location, the air quality is "excellent" instead of "good". The "values" all seem to be the same.

They always seem to have the "source" of:

"Contains Copernicus Atmosphere Monitoring Service information 2020 and/or modified Copernicus Atmosphere Monitoring Service information 2020"
User avatar
Yincognito
Rainmeter Sage
Posts: 4842
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!

Post by Yincognito »

jsmorley wrote: August 4th, 2020, 1:53 am As far as I can tell, all of the scales work everywhere. Now mind you, it could be that if you access a location in a country that doesn't support China's HJ6332012 agency, it just defaults to either EPA or whatever agency IS supported in that location, but at least it doesn't seem to "fail" with any combination of language, location or scale.
Ah, I see - good to know. ;-)
User avatar
Yincognito
Rainmeter Sage
Posts: 4842
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!

Post by Yincognito »

jsmorley wrote: August 4th, 2020, 1:56 amIf I use the Chinese scale on my US location, the air quality is "excellent" instead of "good".
LOL, although I doubt air quality in urban China is "excellent", that ("excellent" in China vs just "good" in the US) might be the case for other things besides the air quality nowadays... :Whistle