\documentclass{article}
\usepackage{ulem}
\usepackage{graphicx}
\usepackage{hyperref}
\pagestyle{headings}
\begin{document}
\section{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:

\subsection{Prerequisites: install Services\_Weather}
You install the PEAR Services\_Weather module as root from the command line:

<pre><code>
pear install Services\_Weather
</code></pre>
then you change to your pear directory (usually \texttt{/usr/share/php}) and look for the \texttt{data/Services\_Weather} directory<br />
It contains a file \texttt{buildMetarDB.php}.

I assume you have the command line PHP interpreter installed and it's called "php" (some distributions call it "php5").

<pre><code>
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
</code></pre>
If database is not on localhost, you might add options \texttt{-h <hostname>} and \texttt{-r tcp}.

Note: I haven't yet found a way to use the METAR block if you use another database than the horde database.<br />
The horde\_db\_user is often called "horde" and the horde\_db is also often called "horde". If I knew all your passwords, I wouldn't tell you ;)

Now login to horde, go to the portal, choose METAR block and click the edit button in the upper right of the block.<br />
The rest is self-explanatory click-and-play.

--Ralf Lang

+++Error message: Services\_Weather: Sourcefile nsd\_cccc not found!

While executing the above commands:

<pre><code>
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
</code></pre>
You may receive the error message:

<pre><code>
Services\_Weather: Sourcefile nsd\_cccc not found!
</code></pre>
The reason is that the file downloaded by \texttt{buildMetarDB.php} script is empty (0 byte file size) as of August,2 2010.<br />
Fortunately, there are alternate working links to this file on this page as TXT or ZIP format instead of the 0 file size GZIP one: <a href="http://weather.noaa.gov/tg/site.shtml">http://weather.noaa.gov/tg/site.shtml</a>

So, you should modify line 273 in \texttt{buildMetarDB.php} file from:

<pre><code>
if (extension\_loaded("zlib")) \{ 
</code></pre>
to:

<pre><code>
if (extension\_loaded("zlibXXXX")) \{ 
</code></pre>
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 "<a href="http://weather.noaa.gov/data/nsd\_cccc.txt">http://weather.noaa.gov/data/nsd\textbackslash\{\}\_cccc.txt</a>"<br />
php buildMetarDB.php -l -u horde\_db\_user -p horde\_db\_pass -d horde\_db -f "<a href="http://weather.noaa.gov/data/nsd\_bbsss.txt">http://weather.noaa.gov/data/nsd\textbackslash\{\}\_bbsss.txt</a>"

--- Mike H.

\end{document}
