Packageindex Classtrees Modulegroups Elementlist Report XML Files

File: /www/gimpster.com/php/phpweather/metar_parser.php
PHP Weather - PHP Weather

metar_parser

base_object
   |
  +-- db_layer
     |
    +-- data_retrieval
       |
      +-- metar_parser

This class understands how to parse a raw METAR.

 

private class metar_parser extends data_retrieval

This class understands how to parse a raw METAR.
The decoded METAR is saved in $decoded_metar, in a language-neutral format.

See Also$decoded_metar
AuthorsMartin Geisler <gimpster@gimpster.com>
Versionmetar_parser.html,v 1.6 2001/06/27 11:35:43 gimpster Exp

 
Direct known subclasses: phpweather

Methods inherited from data_retrieval

data_retrieval, get_icao, set_icao, get_metar, get_metar_from_db, get_metar_from_web, get_location

Methods inherited from db_layer

db_layer, set_db_type, get_db_type

Methods inherited from base_object

base_object, error, debug, print_properties

Public Method Summary

void

metar_parser(array $input)

This constructor does nothing besides passing the input down the hierarchy.
array

decode_metar()

Decodes a raw METAR.

Private Method Summary

void

store_temp(string $temp, integer &$temp_c, integer &$temp_f)

Helper-function used to store temperatures.
void

store_speed(float $value, string $windunit, float &$knots, float &$meterspersec, float &$milesperhour)

Helper-function used to store speeds.

Fields inherited from data_retrieval

$metar, $location

Fields inherited from db_layer

$db

Fields inherited from base_object

$properties, $version

Private Field Summary

array

$decoded_metar

The decoded METAR is stored here.

Public Method Details

metar_parser

public void metar_parser( array $input )

  This constructor does nothing besides passing the input down the hierarchy.

Parameter
array $input
initial properties of the object.
Returns void


decode_metar

public array decode_metar( )

  Decodes a raw METAR.
This function loops over the various parts of the raw METAR, and stores the different bits in $decoded_metar. It uses get_metar() to retrieve the METAR, so it is not necessary to connect to the database before you call this function.

Returns array

The decoded METAR.

See Also $decoded_metar

Private Method Details

store_temp

private void store_temp( string $temp, integer &$temp_c, integer &$temp_f )

  Helper-function used to store temperatures.
Given a numerical temperature $temp in Celsius, coded to tenth ofdegree, store in $temp_c, convert to Fahrenheit and store in$temp_f

Parameter
string $temp
temperature to convert, coded to tenth of degree, like 1015
integer &$temp_c
temperature measured in degrees Celsius
integer &$temp_f
temperature measured in degrees Fahrenheit
Returns void


store_speed

private void store_speed( float $value, string $windunit, float &$knots, float &$meterspersec, float &$milesperhour )

  Helper-function used to store speeds.
$value is converted and stored based on $windunit.

Parameter
float $value
value one seeks to convert.
string $windunit
unit of $value.
float &$knots
After $value has been converted into knots, it will be stored in this variable.
float &$meterspersec
After $value has been converted into meters per second, it will be stored in this variable.
float &$milesperhour
After $value has been converted into miles per hour, it will be stored in this variable.
Returns void


Private Field Details

$decoded_metar

private array $decoded_metar

>><<

The decoded METAR is stored here.
$decoded_metar is an array of arrays. Each sub-array corresponds to a group of related weather-info. We have cloud-groups, visibility-groups and so on.



Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta