|
|
|
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.
|
| |
|
Direct known subclasses: phpweather
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Fields inherited from db_layer |
| $db |
|
|
|
Private Field Summary |
| array |
$decoded_metarThe 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.
|
|
|
|
|
|
| PHPDoc 1.0beta |