Update of /cvsroot/phpweather/phpweather/output
In directory sc8-pr-cvs1:/tmp/cvs-serv17699/output
Modified Files:
pw_text.php
Log Message:
Added hour-by-hour decoding of the taf. test2.php was modified to show that. Interpolation is done in BECMG periods and PROB periods are not added to the hour-by-hour report.
Index: pw_text.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/output/pw_text.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- pw_text.php 2 Sep 2003 17:57:20 -0000 1.20
+++ pw_text.php 13 Sep 2003 02:38:49 -0000 1.21
@@ -1185,6 +1185,89 @@
}
+ function print_taf() {
+ $taf = $this->weather->decode_taf();
+
+ echo "<b>location</b>: ".$taf["location"]."<br>\n";
+ echo "<b>icao</b>: ".$taf["icao"]."<br>\n";
+ echo "<b>time_emit</b>: ".$taf["time_emit"]."<br>\n";
+ echo "<b>time_use</b>: ".$taf["time_use"]."<br>\n";
+
+ echo "<b>periods</b>:<br><br>";
+ echo "All periods:";
+ $this->print_taf_period($taf["periods2"]);
+ echo "Each hour:";
+ $this->print_taf_period($taf["periods3"]);
+ }
+
+ function print_taf_period($period_array) {
+ echo "<table border=1>\n";
+ echo "<tr><th>type</th><th>from</th><th>to</th><th>wind</th><th>visi</th><th>clouds</th><th>other</th></tr>\n";
+ while(list($i,$period) = each($period_array)) {
+ echo "<tr>\n";
+ echo "<td>".$period["type"]."</td>\n";
+ echo "<td>".$period["time_from"]."</td>\n";
+ echo "<td>".$period["time_to"]."</td>\n";
+ echo "<td>";
+ if(isset($period['desc']["wind"])) {
+ if($period['desc']["wind"]["deg"]=="VRB") echo "VRB";
+ else echo round($period['desc']["wind"]["deg"],1);
+ echo " @ ".round($period['desc']["wind"]["knots"],1)." kt";
+ }
+ echo "</td>\n";
+ echo "<td>";
+ if(isset($period['desc']["visibility"])) {
+ for($j=0;$j<count($period['desc']["visibility"]);$j++) {
+ $visi = & $period['desc']["visibility"][$j];
+ if($visi["prefix"]==1) echo " > ";
+ else if($visi["prefix"]==-1) echo " < ";
+ else echo " ";
+ echo $visi["miles"]." SM";
+ }
+ }
+ echo "</td>\n";
+ echo "<td>";
+ if(isset($period['desc']["clouds"])) {
+ for($j=0;$j<count($period['desc']["clouds"]);$j++) {
+ $cloud = & $period['desc']["clouds"][$j];
+ $condition = $cloud["condition"];
+ if($j!=0) echo " - ";
+ echo $condition;
+ if($condition=="SKC") {
+ }
+ else if($condition=="VV") {
+ echo " ".$cloud["ft"]." ft";
+ }
+ else {
+ echo " at ".$cloud["ft"]." ft";
+ }
+ }
+ }
+ echo "</td>\n";
+
+ echo "<td>";
+ if(isset($period['desc']['weather'])) {
+ for($j=0;$j<count($period['desc']['weather']);$j++) {
+ $wx = & $period['desc']['weather'][$j];
+ if($j!=0) echo " - ";
+ echo 'weather: '.$wx['proximity'].' '.$wx['intensity'].' '.$wx['descriptor'].' '.$wx['precipitation'].' '.$wx['obscuration'].' '.$wx['other'];
+ }
+ }
+ if(isset($period['desc']["wind_shear"])) {
+ for($j=0;$j<count($period['desc']["wind_shear"]);$j++) {
+ $ws = & $period['desc']["wind_shear"][$j];
+ echo " wind shear at ".$ws["ft"]." ft ";
+ echo $ws["wind"]["deg"]." @ ".$ws["wind"]["knots"]." kt ";
+ }
+ }
+ echo "</td>\n";
+ echo "</tr>\n";
+ }
+ echo "</table><br>\n";
+ }
+
+
+
/**
* Makes a short weather-report in a table.
*
@@ -1209,9 +1292,9 @@
$humidity = $this->print_pretty_rel_humidity($data['rel_humidity']);
- if ($this->properties['orientation'] == 'vertical') {
+ if ($this->properties['orientation'] == 'vertical') {
- } else {
+ } else {
echo '<table border="1">';
echo "\n <tr>\n";
|