Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv22999
Modified Files:
data_retrieval.php
Log Message:
Added set_metar() for testing etc
Index: data_retrieval.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/data_retrieval.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- data_retrieval.php 19 Dec 2001 09:12:46 -0000 1.17
+++ data_retrieval.php 15 Mar 2002 11:22:33 -0000 1.18
@@ -112,6 +112,29 @@
}
/**
+ * Sets the metar directly, for testing etc
+ *
+ * It loads and decodes the metar if it is
+ * different from the old one. If the new metar is the same as
+ * the old one, nothing is changed.
+ *
+ * Also sets the ICAO to be correct for this metar
+ *
+ * @access public
+ * @param string The METAR we want decoded.
+ */
+ function set_metar($new_metar) {
+
+ if ($new_metar != $this->get_metar()) {
+ $this->debug('Loading a METAR manually.');
+ $this->properties['icao'] = strtoupper(substr($new_metar,0,4));
+ $this->location = '';
+ $this->metar = $new_metar;
+ $this->decoded_metar = decode_metar();
+ }
+ }
+
+ /**
* Tries to get a METAR from the database.
*
* It looks in the database, and fetches a new METAR if necessary.
|