Setting up the METAR weather block The documentation on the METAR weather block as well as the PEAR Services_Weather module is not too extensive and user-friendly. Here is how it works: Prerequisites: install Services_Weather You install the PEAR Services_Weather module as root from the command line:
pear install Services_Weather
then you change to your pear directory (usually /usr/share/php) and look for the data/Services_Weather directory
php buildMetarDB.php -a -u horde_db_user -p horde_db_pass -d horde_db
php buildMetarDB.php -l -u horde_db_user -p horde_db_pass -d horde_db
If database is not on localhost, you might add options -h
php buildMetarDB.php -a -u horde_db_user -p horde_db_pass -d horde_db
php buildMetarDB.php -l -u horde_db_user -p horde_db_pass -d horde_db
You may receive the error message:
Services_Weather: Sourcefile nsd_cccc not found!
The reason is that the file downloaded by buildMetarDB.php script is empty (0 byte file size) as of August,2 2010.
if (extension_loaded("zlib")) {
to:
if (extension_loaded("zlibXXXX")) {
This way the file will be downloaded as TXT format which is not empty, and you metar tables will be filled with appropriate data.
-- Mathieu RV
I found that the script appeared to just silently fail downloading the files. Creates the db structures fine, but doesn't populate them, even with the change noted by Mathieu. I then went to the NOAA site mentioned above, wget the files, and once they are in the directory where buildMetarDB.php is, the script then works fine.
-- Simon W.
Rather than editting the php file, you can specify the NOAA file to use directly. So,
php buildMetarDB.php -a -u horde_db_user -p horde_db_pass -d horde_db -f "http://weather.noaa.gov/data/nsd\_cccc.txt"