Page 1 of 1

PartnerStation Block - Fixes for WU API Changes (and radarUSBlock modification too)

Posted: Wed Nov 27, 2019 2:00 am
by MonyMony
Hello All,

While I cringe with what has become of WeatherUnderground these days, there was one block I did like to use on my homepage that pulled WU data to show both my dad and father-in-law weatherstations. The PartnerStation block was a quick way to show this information so I spend a little time and reworked a bit of Jachym's code to make it compatible with the recent changes. The changes update the URL the codes uses along with changes for the new XML format WU puts out. I also added to the path the required API key variable you now need to gather the data.

To use this you can just replace your existing v3.0 version of the partnerStationBlock.php file with the attached update (other files in the block remain the same). Just remember that you need to make sure that in your Meteotemplate Main Setup configuration settings that you include your WU API key. If you upload your data to WU then this key is free and available under your account information.

Maybe this might be of use to someone. Enjoy!

p.s. To see an example of this block 'in action' check out my site (www.cecilweather.com) and look to the bottom-left of the page.

Re: PartnerStation Block - Fixes for WU API Changes

Posted: Thu Nov 28, 2019 1:25 am
by John B
Blimey, MonyMony, IF it helps someone? It certainly did for this little black duck.

Thank you, sir, for your time and trouble in researching the WU site and then amending the Meteotemplate file to suit. Your amended file worked 'out of the box' for me. I have only two 'partner' stations, one of which is that of my son (who lives about 750 metres above me farther up the mountains) and an old acquaintance's site (who runs one of the local official sites for the Australian Bureau of Meteorology); I am ever so pleased to regain access to their data within Meteo Template.

Again, my thanks.

Re: PartnerStation Block - Fixes for WU API Changes

Posted: Sat Dec 07, 2019 3:05 pm
by MonyMony
John B,

Glad my edits were helpful for someone!

It sounds like you just as I have two partner sites you typically display. While not included in my original upload, I did make a small edit so that the block shows both of my partner sites by default (i.e. the 'ALL' option). I did this by going to the end of the partnerStationBlock.php code and making the following changes:

Original Code:

Code: Select all

	<script>
		$("#partnerStationSelector").change(function(){
			id = $("#partnerStationSelector").val();
			if(id != "all"){
				$(".partnerStationClass").hide();
				$("#partnerStation" + id).show();
			}
			else{
				$(".partnerStationClass").show();
			}
		})
		$("#partnerStationSelector").val(0);
		$("#partnerStation0").show();
	</script>
Updated Code:

Code: Select all

	<script>
		$("#partnerStationSelector").change(function(){
			id = $("#partnerStationSelector").val();
			if(id != "all"){
				$(".partnerStationClass").hide();
				$("#partnerStation" + id).show();
			}
			else{
				$(".partnerStationClass").show();
			}
		})
		$("#partnerStationSelector").val('all');
		$(".partnerStationClass").show();
	</script>

The key points are to change the line $("#partnerStationSelector").val(0); to $("#partnerStationSelector").val(all); (This is the drop-down list entry) and to change the next line from $("#partnerStation0").show(); to $(".partnerStationClass").show();.

Figured I would pass this on as well.

Jay

After Code Update
After Code Update
Screen Shot 2019-12-07 at 10.01.31 AM.png (91.11 KiB) Viewed 16207 times

Re: PartnerStation Block - Fixes for WU API Changes

Posted: Fri Feb 07, 2020 2:10 pm
by MJW
Thanks for this, I will be implementing it on my site soon. Quick question - are you using a custom RadarUS block? I like how yours includes the WU and visible satellite images but that does not appear in the stock block. If so, do you mind sharing?

thx

Mike
MonyMony wrote: Wed Nov 27, 2019 2:00 am Hello All,

...

Maybe this might be of use to someone. Enjoy!

p.s. To see an example of this block 'in action' check out my site (www.cecilweather.com) and look to the bottom-left of the page.

Re: PartnerStation Block - Fixes for WU API Changes

Posted: Tue Feb 25, 2020 2:39 pm
by MonyMony
MJW wrote: Fri Feb 07, 2020 2:10 pm Quick question - are you using a custom RadarUS block?
Hi Mike,

The answer is 'kind of'. I changed a bunch of the links back with the new GOES satellites went online and got creative with some of the other links. Its been a while but I take a look at what I changed and try and post my suggestions soon.

Jay

Re: PartnerStation Block - Fixes for WU API Changes

Posted: Wed Feb 26, 2020 1:27 pm
by MonyMony
Hi Mike,

I am attaching my modified radarUSBlock.php file to use as a reference. If you look to lines 86 thru 116 you can see the modifications I made for the drop-down lists. Most of the images come from https://cdn.star.nesdis.noaa.gov which if you poke around has a lot of options to pick from. The only non-public link I have is one from WeatherUnderground but as I still contribute data to them I believe it is still 'kosher' to link to (at least it used to be unless they changed something).

The odd thing with this block file is you have to made these modifications four times in the code as there are separate entries for each possible position/layout of the block. If you scroll down you will see things repeating and just have to repeat the same modifications for each section.

Hope this helps!

Jay

Re: PartnerStation Block - Fixes for WU API Changes

Posted: Sat Mar 07, 2020 2:42 am
by John B
MonyMony wrote: Sat Dec 07, 2019 3:05 pm I did this by going to the end of the partnerStationBlock.php code and making the following changes:

Original Code:

Code: Select all

	<script>
		$("#partnerStationSelector").change(function(){
			id = $("#partnerStationSelector").val();
			if(id != "all"){
				$(".partnerStationClass").hide();
				$("#partnerStation" + id).show();
			}
			else{
				$(".partnerStationClass").show();
			}
		})
		$("#partnerStationSelector").val(0);
		$("#partnerStation0").show();
	</script>
Updated Code:

Code: Select all

	<script>
		$("#partnerStationSelector").change(function(){
			id = $("#partnerStationSelector").val();
			if(id != "all"){
				$(".partnerStationClass").hide();
				$("#partnerStation" + id).show();
			}
			else{
				$(".partnerStationClass").show();
			}
		})
		$("#partnerStationSelector").val('all');
		$(".partnerStationClass").show();
	</script>

The key points are to change the line $("#partnerStationSelector").val(0); to $("#partnerStationSelector").val(all); (This is the drop-down list entry) and to change the next line from $("#partnerStation0").show(); to $(".partnerStationClass").show();.
It's taken some months to get around to this modification, Jay, but it works like a charm. Thanks again for your efforts.

John

Re: PartnerStation Block - Fixes for WU API Changes (and radarUSBlock modification too)

Posted: Sun Mar 08, 2020 6:42 pm
by PCW
HI Jay,
Really like the modified radarUS block!! I think I made all the proper changes so it would display Geos 17 PNW satellite image/data.
I tried to modify the WU radar image so it would display the Seattle area rather than Dover. Can't seem to find the correct syntax. Need some help please.
How do you get the drop down menu to display "Visible Satellite-Pacific NW" since this is the default image?
When you have time.
Thanks
Paul

Re: PartnerStation Block - Fixes for WU API Changes (and radarUSBlock modification too)

Posted: Thu Mar 12, 2020 12:59 pm
by MonyMony
PCW wrote: Sun Mar 08, 2020 6:42 pm When you have time.
Hi Paul,

When I can I will look at this. Crazy times with cancelling work trips due to CoVID-19 and dealing with the ramifications.

Jay

Re: PartnerStation Block - Fixes for WU API Changes

Posted: Thu Apr 02, 2020 1:29 pm
by MJW
Thanks Jay, I will take a look at this and get it implemented on my site soon.
MonyMony wrote: Wed Feb 26, 2020 1:27 pm Hi Mike,

I am attaching my modified radarUSBlock.php file to use as a reference.
...
Hope this helps!

Jay

Re: PartnerStation Block - Fixes for WU API Changes (and radarUSBlock modification too)

Posted: Mon Sep 14, 2020 7:55 pm
by Milt
Here is a little different look for Partner stations you might like!

https://www.mpgj.com/template/indexDesktop.php