getClouds
getClouds -- return several sky / cloud information out of METAR or TAF Code
Description
Array getClouds (string $METAR_TAF, int $CLOUDLAYER, string $LANGUAGE);
getClouds returns information about the sky / cloud coverage for the given cloud layer.
It expects the number of the inquired layer as an integer ($CLOUDLAYER) starting from 0
(for the 1st cloud layer). The 3rd parameter $LANGUAGE is expected either as "EN" ("en") for
english or "DE" ("de") for german. Other languages are currently not provided.
If a specified layer is not quoted in $METAR_TAF or the METAR
or TAF code is incorrect getClouds will return false.
getClouds returns an array with 6 elements and the following indexes:
- "cov1" contains the minimum level of cloud coverage in the indexed cloudlayer measured in parts of eight e.g. (3/8)
- "cov2" contains the maximum level of cloud coverage measured in parts of eight.
e.g. 3/8 to 4/8 cloud coverage, then "cov1" is 3 and "cov2" is 4. If sky is clear
both "cov1" and "cov2" will be 0, and if the sky is overcast both will be 8.
Note: there is a special coding for "NSC": "cov1" and "cov2" both will return 9
and that means: no significant clouds below 5,000 ft.
- "feet" contains the height of the cloudbase of the indexed cloud layer measured in feet
- "meters" same as above measured in meters
- "cumulus" contains the status of cumulus clouds which is either "no" for no cumulus clouds in that layer,
"yes" for having cumulus clouds in that layer or "towering" for towering cumulus clouds
- "sky" contains a whole sentence in the selected language ($LANGUAGE) describing the sky conditions
Example:
<?
include ("phpmyeasyweather.inc.php");
$METAR = "GCRR 281200Z 31011KT 8000 FEW030 BKN400TCU 20/16 A3016 NOSIG";
$cloudlayer = 0;
while ($clouds = getClouds ($METAR, $cloudlayer++, "en")) {
echo $clouds["sky"] . "<br>";
echo "coverage " . $clouds["cov1"] . "/8 to " . $clouds["cov2"] . "/8 at ";
echo $clouds["meters"] . "m (" . $clouds["feet"] . "ft)";
echo "cumulus clouds: " . $clouds["cumulus"] ."<br><br>";
}
?>
will display all indicated cloud layers as follows:
few clouds at 3,000 feet
coverage 1/8 to 2/8 at 1000m (3000ft) cumulus clouds: no
mostly cloudy at 40,000 feet with towering Cumulus clouds
coverage 5/8 to 7/8 at 13000m (40000ft) cumulus clouds: towering
|