Re: 1.9.1 (some minor stuff)

2001-03-18 Thread Fred Wunderlich

At 11:48 AM +0100 3/18/01, Martin Geisler wrote:

>> Right now it's gonna take quite a bit of editing, no?
>
>Actually not. To demonstrate, I've made a very rough print_table()
>function. It's not very pretty at the moment, but I hope that someone
>could make it better. For example, you should be able to specify the
>direction of the table, perhaps someone wants the headings to be in
>the left column, and then have the data in the right one. To do this,
>you would have to extend the defaults with something like
>'table_direction'. There should also be set and get function for this.
>
>You'll find the rought print_table in beta-1.9.3.
>

Ahhh. I see! I was going about something like:

$myarray = $obj->decode_metar();

while (list($key,$val)=each($myarray)) {
if ($key == "wind") {
  $windarray = $val;
  while (list($key,$val)=each($windarray)) {
  echo $key." ---> ".$val."";
  }
  }

Your solution is much more elegant! The only thing I found so far when
looping through a bunch of metars was I need to add the following to the
print_table($data):

  if (!in_array('rel_humidity', $this->properties['exclude']) &&
!empty($rel_humidity)) {
$humidity = $rel_humidity . '%';
  }else{
$humidity = "NA";
  }

Thanks, Martin!

-fred





Re: 1.9.1 (some minor stuff)

2001-03-18 Thread Martin Geisler

Fred Wunderlich <[EMAIL PROTECTED]> writes:

> At 9:30 PM +0100 3/17/01, Martin Geisler wrote:
> >...
> >
> >I've made a beta-1.9.2 for you to play with :-)
> >
> 
> Wow! That is so cool. Thanks tons.
> 
> Let's just say we wanted to display (pretty-print) the data like:
> 
> 
>   
>Station
>Age (minutes)
>Wind/Direction
>Temperature
>
>Humidity
>   
>   
> KFLL
> 13
> 15/SE
> 84
> 30.01
> 853% //sorry, it's really muggy down here. ;)
>   
> 
> 
> Right now it's gonna take quite a bit of editing, no?

Actually not. To demonstrate, I've made a very rough print_table()
function. It's not very pretty at the moment, but I hope that someone
could make it better. For example, you should be able to specify the
direction of the table, perhaps someone wants the headings to be in
the left column, and then have the data in the right one. To do this,
you would have to extend the defaults with something like
'table_direction'. There should also be set and get function for this.

You'll find the rought print_table in beta-1.9.3.

> Or can we easily extract from metar_parser.php and stick the data
> anywhere we want?

Yes, actually :-)
 
> Very cool stuff, Martin.
> 
> -fred
> 
> 
> 
> 
> 
> 

-- 
Best regards,
Martin Geisler

Checkout http://www.gimpster.com for:
PHP Weather => Shows the current weather on your webpages.
PHP Shell   => A telnet-connection (almost :-) in a PHP page.



Re: 1.9.1 (some minor stuff)

2001-03-17 Thread Fred Wunderlich

At 9:30 PM +0100 3/17/01, Martin Geisler wrote:
>...
>
>I've made a beta-1.9.2 for you to play with :-)
>

Wow! That is so cool. Thanks tons.

Let's just say we wanted to display (pretty-print) the data like:


  
   Station
   Age (minutes)
   Wind/Direction
   Temperature
   
   Humidity
  
  
KFLL
13
15/SE
84
30.01
853% //sorry, it's really muggy down here. ;)
  


Right now it's gonna take quite a bit of editing, no? Or can we easily
extract from metar_parser.php and stick the data anywhere we want?

Very cool stuff, Martin.

-fred







Re: 1.9.1 (some minor stuff)

2001-03-17 Thread Martin Geisler

Fred Wunderlich <[EMAIL PROTECTED]> writes:

> A few undefined indexes in the language file:
> 
> Undefined index: varying
> Undefined index: greater_than
> Undefined index: wind_calm
> 
> No biggee.
> 
> Also, some minor spacing needs adjusting to avoid crashing words
> like: "scatteredtowering cumulus"
> 
> Again, no biggee.

Thanks for checking this anyway :-)
 
> A slightly bigger problem is dealing with a garbled or human induced
> messed up metar, like KTIX:
> 
> KTIX 171350Z 34009KT 7SM OVC025 19/ A3008
> 
> 1.9.1 breaks with:
> 
> Warning: Undefined index: dew_c in
> /home/httpd/html/wx/phpwx2_beta/metar_parser.php on line 494
> Warning: Undefined index: dew_c in
> /home/httpd/html/wx/phpwx2_beta/metar_parser.php on line 495
> Warning: Undefined index: dew_c in
> /home/httpd/html/wx/phpwx2_beta/metar_parser.php on line 496
> Warning: Undefined index: dew_c in
> /home/httpd/html/wx/phpwx2_beta/metar_parser.php on line 497
> Warning: Undefined index: dew_c in
> /home/httpd/html/wx/phpwx2_beta/metar_parser.php on line 498
> 
> I think we need to try and ignore that which phpweather doesn't understand
> or doesn't make sense?

This is already done - everything that isn't catched by the regular
expresions are considered a remark. In this case, the problem is, that
I just tried to calculate the relative humidity, without checking that
botht the temperature and dew-point is present.

I've made a beta-1.9.2 for you to play with :-) 

> I found an easy way to test 1.9.1 was to build a simple array of a
> bunch of station ids and let 'er rip.
> 
> BTW, Martin...great job! Very fast ripping through a dozen or so ids
> and spitting 'em back! :)

Great! I've also found that it's pretty quick at decoding the METARs.
On my P200 MMX it takes about 7-12 miliseconds to decode a METAR. It
takes about the same to do a pretty-print.

When I use a local MySQL database, it takes about 5-8 miliseconds to
retrieve the METAR.

It's actually the initial inclusion and parsing of the files that
takes longest - 120 miliseconds on my machine.
 
> Also, I did find a proposed XML spec at:
> 
> http://zowie.metnet.navy.mil/~spawar/JMV-TNG/XML/OMF.html
> 
> I think, though, I might build a custom one (XML export) that makes
> a bit more sense to me. :)

That would be cool - good luck. :-)
 
> -fred
> 
> 
> 
> 
> 

-- 
Best regards,
Martin Geisler

Checkout http://www.gimpster.com for:
PHP Weather => Shows the current weather on your webpages.
PHP Shell   => A telnet-connection (almost :-) in a PHP page.