Template Feature: A Meteohub => Meteoplug conversion example

Discussion about generation of graphs and tables
skyewright
Posts: 69
Joined: Tue Mar 16, 2010 12:05 pm
Location: Isle of Skye
Contact:

Template Feature: A Meteohub => Meteoplug conversion example

Post by skyewright » Fri Apr 09, 2010 10:21 am

I've just converted a basic Meteohub template to an equivalent using the new Meteoplug feature.

Meteohub version

Meteoplug version

The Meteohub version is updated every 15 minutes. The Meteoplug one is generated on demand from the latest data.

The template for the Meteoplug version can be found at http://www.isleofskyeweather.org.uk/24e ... lback.html

Template conversion was straight forward and logical. It was essentially a matter of taking a copy of the Meteohub template then doing bunch of "search and replace" operations.

I was making things up as I went along, and second time rould I could perhaps do it more efficiently, but in case it's useful to others here is a summary of the changes I needed to make:

First Meteohub template variables for the time and date when the template was last populated:
[actual_date0_time_local] => [actual_day1_misc_uploadlocaltime_11_8]

[actual_date0_puredate_local] => [actual_day1_misc_uploadlocaltime_8_2]/[actual_day1_misc_uploadlocaltime_5_2]/[actual_day1_misc_uploadlocaltime_0_4] (for UK format date)

[actual_date0_time_utc] => [actual_day1_misc_uploadutctime_11_8]

[actual_date0_puredate_utc] => [actual_day1_misc_uploadutctime_8_2]/[actual_day1_misc_uploadutctime_5_2]/[actual_day1_misc_uploadutctime_0_4] (for UK format date)
Now for the rest:
[actual_ => [actual_min5_

[day1_ => [actual_day1_

[last60m_ => [actual_hour1_

[month1_ => [actual_month1_

_c] => _1] (or _0] if you want zero decimal places)

If you use Fahrenheit you'll need to apply a factor and an offset, e.g. _f] => _1_1.8_32]

_time => time

N.B. Meteohub template time was YYYYMMDDhhmmss, but Meteoplug template time is YYYY-MM-DD hh:mm:ss, so Meteohub template code for 'splitting up' time changes as follows:

#AD => _0_4
#EF => 5_2
#GH => _8_2
#IJ => _11_2
#KL => _14_2

hum_rel] => hum_rel_0] (for zero decimal places)

_hpa] => _1] (or _0] if you want 0 decimal places)

_sealevel => _seapress

_mph] -> _1_2.37] (i.e. 1 decimal, then a conversion factor for m/s => mph)

_speed => _wind

_gustspeed => _gust

_dir_en] => _maindirtext]
OR if you want degrees,
_dir_en] => _maindir_0_22.5]°

_maxspeeddir_en] => _highdirtext]
OR if you want degrees
_maxspeeddir_en] => _highdir_0_22.5]° (but that is degrees rather than "English")

_rate_mm] => _rate_1]

total_mm] => total_1]

_ratemax_mm] => _ratemax_1]
That's it.

With a different set of variables a few other changes might be needed too, but the general idea would be the same.
Last edited by skyewright on Thu Apr 15, 2010 10:31 am, edited 2 times in total.
David

skyewright
Posts: 69
Joined: Tue Mar 16, 2010 12:05 pm
Location: Isle of Skye
Contact:

Re: Template Feature: A Meteohub => Meteoplug conversion example

Post by skyewright » Fri Apr 09, 2010 12:46 pm

I just added a link to the modified template file itself to the above post.
David

oliverb
Posts: 38
Joined: Wed Mar 31, 2010 8:38 am
Location: Kenley Surey UK
Contact:

Re: Template Feature: A Meteohub => Meteoplug conversion example

Post by oliverb » Fri Apr 09, 2010 4:43 pm

Thanks, this is really useful. I will convert my old meteohub version ASAP.
Brett.

oliverb
Posts: 38
Joined: Wed Mar 31, 2010 8:38 am
Location: Kenley Surey UK
Contact:

Re: Template Feature: A Meteohub => Meteoplug conversion example

Post by oliverb » Sat Apr 10, 2010 6:17 am

I have been playing around with Davids template and found if I used my domain name in the Meteohub define chart it would not work.

eg
template=http://www.brettoliver.org.uk/weather.html does not work

template=http://home.btconnect.com/brettoliver1/weather.html works fine

Brett.

User avatar
admin
Site Admin
Posts: 332
Joined: Sun Feb 07, 2010 9:22 pm

Re: Template Feature: A Meteohub => Meteoplug conversion example

Post by admin » Sat Apr 10, 2010 7:58 am

I did a manual simulation of retrieving data via a "wget" from command line. It works for both urls.
Are you sure was not a typo in the url when trying?

If the error persists, please post a link to the not working graph definition, so that I can use that for a drill down.

oliverb
Posts: 38
Joined: Wed Mar 31, 2010 8:38 am
Location: Kenley Surey UK
Contact:

Re: Template Feature: A Meteohub => Meteoplug conversion example

Post by oliverb » Sat Apr 10, 2010 8:09 am

I have made a test template using http://www.brettoliver.org.uk/weather.html see address below.
https://www.meteoplug.com/cgi-bin/meteo ... ddc1dfd9db

Meteohub displays the page showing only the code.

Brett.

User avatar
admin
Site Admin
Posts: 332
Joined: Sun Feb 07, 2010 9:22 pm

Re: Template Feature: A Meteohub => Meteoplug conversion example

Post by admin » Sat Apr 10, 2010 9:54 am

Problem with content on " http://www.brettoliver.lrg.uk/weather.html" is, that it returns following html data, which sets up a frame in which another link that contains the templates to be replaced is mentioned.

Code: Select all

<html><head>
<title></title></head>
<!-- Redirection Services SJL01WRED02 H1 -->
<frameset rows='100%, *' frameborder=no framespacing=0 border=0>
<frame src="http://home.btconnect.com/brettoliver1/weather.html" name=mainwindow frameborder=no framespacing=0 marginheight=0 marginwidth=0></frame>
</frameset>
<noframes>
<h2>Your browser does not support frames.  We recommend upgrading your browser.</h2><br><br>
<center>Click <a href="http://home.btconnect.com/brettoliver1/weather.html">here</a> to enter the site.</center>
Meteoplug replaces variables in the html code of " http://www.brettoliver.lrg.uk/weather.html" but this has not the expected result. If "http://www.brettoliver.lrg.uk/weather.html" would be a properly set up HTTP-redirect to "http://home.btconnect.com/brettoliver1/weather.html", then wget would follow this redirect and would replace the expected data. Following frame sets defined in a HTML page is out of scope for wget.

oliverb
Posts: 38
Joined: Wed Mar 31, 2010 8:38 am
Location: Kenley Surey UK
Contact:

Re: Template Feature: A Meteohub => Meteoplug conversion example

Post by oliverb » Sat Apr 10, 2010 10:04 am

Thanks for looking into this.
It is not really a problem as I can just use http://home.btconnect.com/brettoliver1/weather.html in the graph definition.
Just thought is was worth a mention in case someone else has a similar issue.

I have my domain set to hide http://home.btconnect.com/brettoliver1/ and always display http://www.brettoliver.org.uk/ perhaps this could be the cause of it?

oliverb
Posts: 38
Joined: Wed Mar 31, 2010 8:38 am
Location: Kenley Surey UK
Contact:

Re: Template Feature: A Meteohub => Meteoplug conversion example

Post by oliverb » Sun Apr 11, 2010 11:05 am

On my old Meteohub template site I had a time and date stamp [actual_utcdate2] so I could see the actual date and time of upload from Meteohub and confirm it was upto date data.

Can I do this with the Meteoplug template as well?

Thanks.
Brett.

skyewright
Posts: 69
Joined: Tue Mar 16, 2010 12:05 pm
Location: Isle of Skye
Contact:

Re: Template Feature: A Meteohub => Meteoplug conversion example

Post by skyewright » Sun Apr 11, 2010 2:24 pm

oliverb wrote:On my old Meteohub template site I had a time and date stamp [actual_utcdate2] so I could see the actual date and time of upload from Meteohub and confirm it was upto date data.
Can I do this with the Meteoplug template as well?
Not yet...

I should have mentioned that the date stamp was the one part of my Meteohub template that I could not transalate to Meteoplug. I believe that a solution for this is on Boris' wish list... :)
David

Post Reply