Author Topic: Metar overlay for GRlevel3  (Read 10541 times)

0 Members and 1 Guest are viewing this topic.

Offline Strgazr27

  • "The Cam Man"
  • Forecaster
  • *****
  • Posts: 590
    • Kings Park Weather
Metar overlay for GRlevel3
« on: November 19, 2009, 10:00:28 PM »
I was looking at the script over at Carter-Lake that allows METAR info to be overlayed on your GR2 radar image. I really like this script but am having a bit of a hard time trying to figure out where I would place it. I'm thinking it is it's own item and just needs to be configured and uploaded to my site but wanted a bit of info to see if I was correct first.

Does anybody here use it? How did you install it?

Thanks,

Bobby
Bobby M.
Davis VP2 6152 w Daylight FARS - Logitech C525 and C310
WD - WDLive - GRLevel3 - Image Salsa - VVP - Startwatch

"http://www.kingsparkweather.com"
KNYKINGS7 on WU



Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8884
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Metar overlay for GRlevel3
« Reply #1 on: November 20, 2009, 03:04:27 PM »
Tom's script from http://www.carterlake.org/metargrlevel3.php.txt uses a control file like
Code: [Select]
KGRI|Grand Island|NE|United States|41|-98.22|2|
KLNK|Lincoln|NE|United States|40.87|-96.58|2|
KOFK|Norfolk|NE|United States|42.09|-97.30|2|
KSUX|Sioux City|IA|United States|42.56|-96.32|2|
KCIN|Carroll|IA|United States|42.12|-94.78|2|
KCSQ|Creston|IA|United States|41.11|-94.23|2|
KSTJ|St. Joseph|MO|United States|39.83|-94.75|2|
KCNK|Concordia|KS|United States|39.64|-97.58|2|
KYKN|Yankton|OV|United States|42.92|-97.39|2|
KONL|O'Neill|NE|United States|42.47|-98.68|2|
KEBS|Webster City|IA|United States|42.433|-93.867|2|
in metars.txt to select which metars will be put in the GRLevel3 placefile for display.  You customize the metars.txt to ones in your region, then have your GRLevel3 load the placefile by putting the URL of the metargrlevel3.php on your site as the source of the placefile.

Upload the metargrlevel3.php script and the customized metars.txt file to the document root of your website.

I don't use the script since I subscribe to the AllisonHouse feeds, and one of them is the metar feed :)

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Strgazr27

  • "The Cam Man"
  • Forecaster
  • *****
  • Posts: 590
    • Kings Park Weather
Re: Metar overlay for GRlevel3
« Reply #2 on: November 24, 2009, 06:45:34 PM »
Ken,

First a big THANK YOU for your time and the scripts! I am actually proud of my site at this point :)

I appreciate the help and will see what I can come up with over the holiday break.

Have a great holiday!

Bobby
Bobby M.
Davis VP2 6152 w Daylight FARS - Logitech C525 and C310
WD - WDLive - GRLevel3 - Image Salsa - VVP - Startwatch

"http://www.kingsparkweather.com"
KNYKINGS7 on WU



Offline WeatherBeacon

  • Chief
  • Forecaster
  • *****
  • Posts: 1369
    • http://www.wxbeacon.com
Re: Metar overlay for GRlevel3
« Reply #3 on: November 25, 2009, 12:27:03 AM »
Tom's script from http://www.carterlake.org/metargrlevel3.php.txt uses a control file like
Code: [Select]
KGRI|Grand Island|NE|United States|41|-98.22|2|
KLNK|Lincoln|NE|United States|40.87|-96.58|2|
KOFK|Norfolk|NE|United States|42.09|-97.30|2|
in metars.txt to select which metars will be put in the GRLevel3 placefile for display.  You customize the metars.txt to ones in your region, then have your GRLevel3 load the placefile by putting the URL of the metargrlevel3.php on your site as the source of the placefile.

Ken:

What does the trailing |2| on each line represent?

I was able to get this to work when I used your metars.txt file (and I went to site KOAX). However, when I created a metars.txt file for locations in my area (and I went to site KDTX), it doesn't work. Any suggestions? (After changing the metars.txt file, I closed and restarted GRLevel3.)

Thanks!
Mae govannen!
Kevin  (Member AMS) http://www.wxbeacon.com               Genesee County, Michigan
Hardware:  Davis Vantage Pro Wireless, Midland WR-300
Software: VWS 14.01p43, WeatherFlash, & GRLevel3

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8884
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Metar overlay for GRlevel3
« Reply #4 on: November 25, 2009, 01:54:30 PM »
Looking at the code, the |2| field in the last position is for the font size for GRLevel3 to use to display the temperature.

Would you mind including a copy of your metars.txt file?
« Last Edit: November 25, 2009, 01:57:12 PM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline WeatherBeacon

  • Chief
  • Forecaster
  • *****
  • Posts: 1369
    • http://www.wxbeacon.com
Re: Metar overlay for GRlevel3
« Reply #5 on: November 25, 2009, 02:04:31 PM »
Looking at the code, the |2| field in the last position is for the font size for GRLevel3 to use to display the temperature.

Would you mind including a copy of your metars.txt file?

Ken, I tried this in metars.txt:

Code: [Select]
KARB|Ann Arbor|MI|United States|42.22|-83.74|2|
KAZO|Kalamazoo|MI|United States|42.23|-85.55|2|
KBAX|Bad Axe|MI|United States|43.78|-82.99|2|
KFNT|Flint|MI|United States|42.97|-83.75|4|
KHYX|Saginaw|MI|United States|43.43|-83.86|2|
KLAN|Lansing|MI|United States|42.78|-84.58|2|
KMBS|Saginaw|MI|United States|43.53|-84.08|2|
KPTK|Pontiac|MI|United States|42.66|-83.41|2|
KRNP|Owosso|MI|United States|42.99|-84.14|2|
KTTF|Monroe|MI|United States|41.94|-83.43|2|
KVLL|Troy|MI|United States|42.54|-83.18|2|
KDTX|Detroit|MI|United States|42.24|-83.53|2|
Mae govannen!
Kevin  (Member AMS) http://www.wxbeacon.com               Genesee County, Michigan
Hardware:  Davis Vantage Pro Wireless, Midland WR-300
Software: VWS 14.01p43, WeatherFlash, & GRLevel3

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8884
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Metar overlay for GRlevel3
« Reply #6 on: November 25, 2009, 02:19:28 PM »
Kevin,
The file looks good.
Did you put it in the document root of the website (along with the metargrlevel3.php script)?  The script (as written) cannot be used in a subdirectory on the site.. must be in the document root.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline WeatherBeacon

  • Chief
  • Forecaster
  • *****
  • Posts: 1369
    • http://www.wxbeacon.com
Re: Metar overlay for GRlevel3
« Reply #7 on: November 25, 2009, 02:26:01 PM »
Kevin,
The file looks good.
Did you put it in the document root of the website (along with the metargrlevel3.php script)?  The script (as written) cannot be used in a subdirectory on the site.. must be in the document root.

No. I have both in a subfolder called GRLevel3. I changed this line in metargrlevel3.php

Quote
$metarfilename = getenv('DOCUMENT_ROOT') . "/metars.txt";

to this:

Quote
$metarfilename = getenv('DOCUMENT_ROOT') . "/GRLevel3/metars.txt";

and when I used your metars.txt file (and went to KOAX), it worked; however, when I put my metars.txt file in (and went to KDTX or KGRR), it doesn't work.

I'll try putting both in the root anyway and see if it works.
Mae govannen!
Kevin  (Member AMS) http://www.wxbeacon.com               Genesee County, Michigan
Hardware:  Davis Vantage Pro Wireless, Midland WR-300
Software: VWS 14.01p43, WeatherFlash, & GRLevel3

Offline WeatherBeacon

  • Chief
  • Forecaster
  • *****
  • Posts: 1369
    • http://www.wxbeacon.com
Re: Metar overlay for GRlevel3
« Reply #8 on: November 25, 2009, 02:59:36 PM »

Well, I'm stumped.

I placed the metargrlevel3.php file in the root folder. I went to the placefile manager in GRL3 and gave it the new path to the metargrlevel3.php file.

  • I tested it by putting your metars.txt file in the root folder. I closed and restarted GRL3, went to KOAX and it worked.
  • Then I put my metars.txt file in the root folder and checked to make sure they were my regional metars. I then closed and restarted GRL3, and went to KDTX and KGRR, and it doesn't work.

The only difference is the matars.txt files.

Does the metargrlevel3.php file require any changes?

I'm stumped.
Mae govannen!
Kevin  (Member AMS) http://www.wxbeacon.com               Genesee County, Michigan
Hardware:  Davis Vantage Pro Wireless, Midland WR-300
Software: VWS 14.01p43, WeatherFlash, & GRLevel3

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8884
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Metar overlay for GRlevel3
« Reply #9 on: November 25, 2009, 10:14:57 PM »
Hi Kevin,

I think the issue may be that your PHP is set to disallow fopen('http://....');

Try putting

allow_url_fopen = on

in your php.ini in your document root directory.  Running the metargrlevel3.php script on your site returns
Quote
<br />
<b>Warning</b>:  fopen(http://weather.noaa.gov/pub/data/observations/metar/stations/KDTX.TXT) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
 in <b>/home/wxbeacon/domains/wxbeacon.com/public_html/metargrlevel3.php</b> on line <b>59</b><br />
<br />
<b>Warning</b>:  feof(): supplied argument is not a valid stream resource in <b>/home/wxbeacon/domains/wxbeacon.com/public_html/metargrlevel3.php</b> on line <b>60</b><br />
 ...

I think that KDTX is not a valid (current) METAR .. a 404 return means it's not found on the noaa site.

Try deleting that line, and run the script in your browser .. when you see a valid placefile with no PHP messages embedded, it should work fine again :)

Hope this helps...
Best regards,
Ken
« Last Edit: November 25, 2009, 10:18:14 PM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline WeatherBeacon

  • Chief
  • Forecaster
  • *****
  • Posts: 1369
    • http://www.wxbeacon.com
Re: Metar overlay for GRlevel3
« Reply #10 on: November 26, 2009, 12:03:24 AM »
Hi Kevin,

I think that KDTX is not a valid (current) METAR .. a 404 return means it's not found on the noaa site.

Try deleting that line, and run the script in your browser .. when you see a valid placefile with no PHP messages embedded, it should work fine again :)

Hope this helps...
Best regards,
Ken

That appeared to be the problem. I changed KDTX to KDTW, and it worked. I didn't have to do anything to a php.ini file.

Thanks much, Ken!

Regards,

Kevin...

EDIT:  Aha! I also determined that it fails when the last line in the metars.txt file is blank!
« Last Edit: November 26, 2009, 12:41:41 AM by WeatherBeacon »
Mae govannen!
Kevin  (Member AMS) http://www.wxbeacon.com               Genesee County, Michigan
Hardware:  Davis Vantage Pro Wireless, Midland WR-300
Software: VWS 14.01p43, WeatherFlash, & GRLevel3

Offline WeatherBeacon

  • Chief
  • Forecaster
  • *****
  • Posts: 1369
    • http://www.wxbeacon.com
Re: Metar overlay for GRlevel3
« Reply #11 on: November 28, 2009, 09:02:49 AM »

Question: is running this script a bandwidth hog? I just now noticed that on Wednesday my bandwidth use was 160 times my normal daily average. That was the same day I ran this script from early evening till the next morning. That alone took almost half my monthly allotted bandwidth.

Anyone else using this scripting seeing similar behavior?
Mae govannen!
Kevin  (Member AMS) http://www.wxbeacon.com               Genesee County, Michigan
Hardware:  Davis Vantage Pro Wireless, Midland WR-300
Software: VWS 14.01p43, WeatherFlash, & GRLevel3

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8884
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Metar overlay for GRlevel3
« Reply #12 on: December 01, 2009, 02:11:42 PM »
Hmmm... every time the script runs, it fetches metar data (small file) from each metar in your list.  When your GRLevel3 pulls the placefile generated, it runs the script on your webserver, so yes, it can add traffic to your website's traffic meter.  You can reduce the impact be setting the placefile 'fetch/reload' times to every 15 minutes or so.. metars are generally updated only once an hour.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline WeatherBeacon

  • Chief
  • Forecaster
  • *****
  • Posts: 1369
    • http://www.wxbeacon.com
Re: Metar overlay for GRlevel3
« Reply #13 on: December 01, 2009, 08:55:59 PM »
Hmmm... every time the script runs, it fetches metar data (small file) from each metar in your list.  When your GRLevel3 pulls the placefile generated, it runs the script on your webserver, so yes, it can add traffic to your website's traffic meter.  You can reduce the impact be setting the placefile 'fetch/reload' times to every 15 minutes or so.. metars are generally updated only once an hour.

Okay. Thanks, Ken! I see it.

Kevin...
Mae govannen!
Kevin  (Member AMS) http://www.wxbeacon.com               Genesee County, Michigan
Hardware:  Davis Vantage Pro Wireless, Midland WR-300
Software: VWS 14.01p43, WeatherFlash, & GRLevel3

Offline Russell797

  • Senior Member
  • **
  • Posts: 78
    • Lowell Highlands Weather
Re: Metar overlay for GRlevel3
« Reply #14 on: December 17, 2009, 12:03:19 PM »
This is a re-post of one from last August:

I have received this e-mail message from my hosting service:

---------------

Hi,

I want to notify you that your average CPU usage is very high for several weeks, and you need to optimize your software or move to another web host

lowellhi lowellhighlandsweather.com
Top Process %CPU 107 /usr/bin/php /home/lowellhi/public_html/metargrlevel3.php
Top Process %CPU 98.8 /usr/bin/php /home/lowellhi/public_html/metargrlevel3.php
Top Process %CPU 97.9 /usr/bin/php /home/lowellhi/public_html/metargrlevel3.php



wait for your feed back

Norman

---------

I have been forced to cease running the script on their server. I was loading 17 METARs, why would this be using excessive resources on the server in the form of cpu usage?

I'm I the first to report this problem?


-----

I set the refresh to 1 hour to see if I get any feedback from them at that rate.
Lowell Highlands Current Weather Conditions


Offline ELDoradoWx

  • El Dorado Weather
  • Senior Contributor
  • ****
  • Posts: 298
  • Gentoo X = Complete_Control
    • El Dorado Weather
Re: Metar overlay for GRlevel3
« Reply #15 on: December 20, 2009, 03:20:04 AM »
Hi Norman,

That can be really frustrating when things like that happen! Did you just recently start running the script and ran into this problem, or have you been running the script for awhile and the problem just cropped up with your web host contacting you about the issue?

Did you happen to see Ken True's advice concerning the same kind of problem a couple posts up?

The problem you describe sounds like the kind of behavior of a constantly running script to be taking up that much bandwidth.

Besides trying a different approach on running the script to solve this issue, there is another very similar placefile available for free, if you're not aware of it already, found at:  http://www.grlevelxmods.com/placefiles/

It puts the same metars as you on the map and many more.. It's just an alternative that you may or may not be interested in looking into.

Here a few u.s. weather element placefiles you can plug right into your grlevel3:

http://www.grlevelxmods.com/placefiles/placefile.php?placefile=METARS_(Wind)
http://www.grlevelxmods.com/placefiles/placefile.php?placefile=METARS_(Metars)
http://www.grlevelxmods.com/placefiles/placefile.php?placefile=METARS_(Temperature)
http://www.grlevelxmods.com/placefiles/placefile.php?placefile=METARS_(Dewpoint)
http://www.grlevelxmods.com/placefiles/placefile.php?placefile=METARS_(Humidity)
http://www.grlevelxmods.com/placefiles/placefile.php?placefile=METARS_(Flight_Rules)

From - http://www.grlevelxmods.com/

Danny


« Last Edit: December 20, 2009, 03:23:11 PM by eldoradowx »
-Danny
-root is everything

Offline WeatherBeacon

  • Chief
  • Forecaster
  • *****
  • Posts: 1369
    • http://www.wxbeacon.com
Re: Metar overlay for GRlevel3
« Reply #16 on: December 20, 2009, 02:33:57 PM »

Norman:

Russ:

I was having what I believe was a problem similar to yours, although mine hogged bandwidth (and probably CPU, too). FYI, I have not run mine since I changed the refresh rate, so I don't know if that change improve my situation or not. I usually run mine only when we get some heavy precip.

Kevin...
« Last Edit: December 21, 2009, 08:38:03 AM by WeatherBeacon »
Mae govannen!
Kevin  (Member AMS) http://www.wxbeacon.com               Genesee County, Michigan
Hardware:  Davis Vantage Pro Wireless, Midland WR-300
Software: VWS 14.01p43, WeatherFlash, & GRLevel3

Offline Russell797

  • Senior Member
  • **
  • Posts: 78
    • Lowell Highlands Weather
Re: Metar overlay for GRlevel3
« Reply #17 on: December 20, 2009, 07:33:55 PM »
WOOW,

Thanks eldoradowx!

I am Russ, Norman was a representative from my web host I was responding to. Sorry for the confusion.

I was adding my problem to that experienced by WeatherBeacon. I had run the script for a couple months before my hosting service contacted me with the CPU usage issue. I ceased using the script until I noticed this thread and Ken's suggestion to lengthen the refresh rate. I have been using a 1 hour refresh rate to see if it would cause a problem and if not I was going to reduce the rate to something more appropriate.

I will switch to http://www.grlevelxmods.com/ thanks to your suggestion.

There are a wealth of various free placefiles over there for our use. I will consider a donation for their efforts and generosity if it works out.

Thanks again,
Russ
 
« Last Edit: December 20, 2009, 07:58:29 PM by Russell797 »
Lowell Highlands Current Weather Conditions


Offline weather01089

  • Member
  • *
  • Posts: 6
Re: Metar overlay for GRlevel3
« Reply #18 on: January 20, 2023, 10:25:46 AM »
I know this post is old, the php script will no longer download for this, and the "contact" email bounces.
Anyone have this php script?

Thanks!!!

RAy

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8884
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Metar overlay for GRlevel3
« Reply #19 on: January 20, 2023, 11:13:49 AM »
I have a copy from 2007, but Iíll need to update it for modern PHP.  Tomís version was for PHP 4, and a bunch has changed since then. Iíll post a modernized version later today.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline weather01089

  • Member
  • *
  • Posts: 6
Re: Metar overlay for GRlevel3
« Reply #20 on: January 20, 2023, 11:33:27 AM »
great thanks.

Offline weather01089

  • Member
  • *
  • Posts: 6
Re: Metar overlay for GRlevel3
« Reply #21 on: January 20, 2023, 11:34:46 AM »
looking to code it to generate placefiles from some local meso weather stations in house. Thanks!
« Last Edit: January 20, 2023, 11:48:06 AM by weather01089 »