Thread: Re: 'Bug' with weather icons (images.inc)
Brought to you by:
iridium
From: Ray v. B. <r_v...@ho...> - 2002-03-12 20:26:21
|
Hi Kevin, >Using the following METAR: > >KMTO 112053Z AUTO 18009KT 10SM OVC090 06/M04 A3007 RMK AO2 SLP190 T00561039 >56031 > >the images.inc (get_sky_image) function returns the 0cloud.gif image >instead >of the 4cloud_norain.gif image. The cloud_layer1_condition is 'overcast' >(OVC), and the weather is null. Hmmmm, I glued your metar in my own script (down below) and it shows ok (overcast). Maybe I did something wrong with scope of variables, more than one include files or something in that direction.... >I will dig through to code a bit more later on. Good idea, I'm sorry I can't help from here right now. Please let us know what you find (either good or bad). >I'm glad someone else write it, though! :) No problem, let me know when it's operational (and the URL). >Thanks! Thank you! Ray <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title></title> </head> <body topmargin="4"> <?php include('./locale_en.inc'); include('./images.inc'); include('./phpweather.inc'); //$metar = get_metar('EHEH'); $metar = 'KMTO 112053Z AUTO 18009KT 10SM OVC090 06/M04 A3007 RMK AO2 SLP190 T00561039 56031'; $decoded_metar = process_metar($metar); ?> <table class=weather bgcolor="#FEF9B8" cellpadding=4 cellspacing=0 width=100%> <tr valign=top> <td> <table class=weather cellpadding=2 cellspacing=0 width=120> <tr bgcolor="#C4BF06"> <td colspan=3 ><b>Temperatuur:</b></td> </tr> <tr height=1px bgcolor="#FEF9B8"></tr> <tr height=59 valign=top bgcolor="#C4BF06"> <td> </td> <td><? printf("%4.1f",$decoded_metar['temp_c']) ?> °C</td> <td><img src="<? get_temp_image($decoded_metar) ?>" height="50" width="20" border=1></td> </tr> </table> </td> <td> <table class=weather cellpadding=2 cellspacing=0 width=120> <tr bgcolor="#C4BF06"> <td colspan=3><b>Wind:</b></td> </tr> <tr height=1px bgcolor="#FEF9B8"></tr> <tr height=59 valign=top bgcolor="#C4BF06"> <td> </td> <td> <? printf(get_beaufort()) ?> Bft, <? printf($decoded_metar['wind_dir_text_short']) ?><br> <? printf("%3.1f",$decoded_metar['wind_meters_per_second']) ?> m/s<br> <? printf("%3.1f",$decoded_metar['wind_meters_per_second']*3600/1000) ?> km/h </td> <td> <img src="<? get_winddir_image($decoded_metar) ?>" height="40" width="40" border=1> </td> </tr> </table> </td> <td> <table class=weather cellpadding=2 cellspacing=0 width=120> <tr bgcolor="#C4BF06"> <td colspan=3><b>Bewolking:</b></td> </tr> <tr height=1px bgcolor="#FEF9B8"></tr> <tr height=59 valign=top bgcolor="#C4BF06"> <td> </td> <td colspan=2> <img src="<? get_sky_image($decoded_metar) ?>" height="50" width="80" border=1> </td> </tr> </table> </td> <td width=100%> </td> </tr> </table> </body> </html> _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx |
From: Ray v. B. <r_v...@ho...> - 2002-03-13 21:01:17
|
>My mistake! I was passing the actual metar string to your function instead >of the array. In other words, I was doing this: Glad you found it! >That's what I get for not reading the comments/instructions very carefully. >:) Yep, that's true... >Well, my web site is here: http://www.moulton-udell.k12.ia.us/ The >weather >is located in the navigation column on the left-hand side (at the bottom). >It looks okay in IE, but for some reason, my columns get squished in >Netscape. I'm still trying to work on that. I found it. Great! Do you mind if I reference your site on my 'Online weather' project page http://www.devolder.nl ? >To print the current weather string, I'm doing something like this: > > $metar = get_metar('KOTM'); > > $data = process_metar($metar); > > $condition = ucfirst($data['cloud_layer1_condition']); > $weather = $data['weather']; > > // if there is no current weather, use the cloud condition instead > if (strlen($weather) == 0) { > echo "$condition<br>\n"; > } else { > echo "$weather<br>\n"; > }; > >This way if there is no current weather data in the metar, it will fall >back >on the cloud condition. Hope this helps. That *is* a good idea. Now Kevin, I like the today's specials for lunch. Maybe I'll drop by :-) Greetz, Ray _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com |
From: Kevin G. <go...@ae...> - 2002-03-13 22:29:02
|
'allo! on 3/13/02 3:01 PM, Ray van Beek at r_v...@ho... wrote: >> Well, my web site is here: http://www.moulton-udell.k12.ia.us/ The >> weather >> is located in the navigation column on the left-hand side (at the bottom). >> It looks okay in IE, but for some reason, my columns get squished in >> Netscape. I'm still trying to work on that. > > I found it. Great! Do you mind if I reference your site on my 'Online > weather' project page http://www.devolder.nl ? Be my guest! I found it extraordinarily easy to use the phpweather.inc and images.inc files. Works marvelously! >>This way if there is no current weather data in the metar, it will fall >>back >>on the cloud condition. Hope this helps. > > That *is* a good idea. Well, I don't know if most weather stations report current weather conditions frequently or not. But the station I'm using doesn't appear to use them very often, so instead of printing nothing, I decided to print the cloud conditions. It's a little more useful that way. > Now Kevin, I like the today's specials for lunch. Maybe I'll drop by :-) <grin> Well then, you won't want to miss tomorrow's lunch -- we're having turkey fritters and hash browns! Thanks again for the script and graphics -- they look great! ---- Kevin Godby <go...@ae...> Technology Coordinator Moulton-Udell Community School District 305 E. Eighth St. Phone: (641) 642-8131 Moulton, Iowa 52572 Fax: (641) 642-3461 |
From: Kevin G. <go...@ae...> - 2002-03-13 16:42:43
|
on 3/12/02 2:25 PM, Ray van Beek at r_v...@ho... wrote: > Hmmmm, I glued your metar in my own script (down below) and it shows ok > (overcast). Maybe I did something wrong with scope of variables, more than > one include files or something in that direction.... My mistake! I was passing the actual metar string to your function instead of the array. In other words, I was doing this: $metar = get_metar('KOTM'); // station in Ottumwa, Iowa $data = process_metar($metar); $image = get_sky_image($metar); // <-- this is not the right way! instead of this: $image = get_sky_image($data); // <-- this is the correct way! That's what I get for not reading the comments/instructions very carefully. :) > No problem, let me know when it's operational (and the URL). Well, my web site is here: http://www.moulton-udell.k12.ia.us/ The weather is located in the navigation column on the left-hand side (at the bottom). It looks okay in IE, but for some reason, my columns get squished in Netscape. I'm still trying to work on that. To print the current weather string, I'm doing something like this: $metar = get_metar('KOTM'); $data = process_metar($metar); $condition = ucfirst($data['cloud_layer1_condition']); $weather = $data['weather']; // if there is no current weather, use the cloud condition instead if (strlen($weather) == 0) { echo "$condition<br>\n"; } else { echo "$weather<br>\n"; }; This way if there is no current weather data in the metar, it will fall back on the cloud condition. Hope this helps. Thanks again for the script! ---- Kevin Godby <go...@ae...> Technology Coordinator Moulton-Udell Community School District 305 E. Eighth St. Phone: (641) 642-8131 Moulton, Iowa 52572 Fax: (641) 642-3461 |