[jdev] Re: weather data over Jabber

Tijl Houtbeckers thoutbeckers at splendo.com
Sat Jan 8 05:01:22 CST 2005


On Sat, 8 Jan 2005 17:43:46 +1100, Trejkaz Xaoza <trejkaz at trypticon.org>  
wrote:

> Part of the problem with the existing XML weather formats is that there  
> are
> four of the damn things now, and that's just in the US.  The other  
> problem is
> that their formats are completely unusable for our simpler needs, due to
> complexity.  Seriously, have a look at this file and tell me how  
> comfortable
> you'd be sending it around XMPP:
>
>     http://www.nws.noaa.gov/forecasts/xml/DWMLgen/schema/latest_DWML.txt

I dunno, but without looking at any schema and just starting to read from  
the top I can get:

at location
<point latitude="38.99" longitude="-77.99" />
(quite normal location, easy to map to jabber)

between
<start-valid-time>2005-01-07T07:00:00-05:00</start-valid-time>
and
<end-valid-time>2005-01-07T19:00:00-05:00</end-valid-time>
(quite normal timestamps)

max temp. will be in Fahrenheit:
<value>43</value>

between
<start-valid-time>2005-01-07T19:00:00-05:00</start-valid-time>
and
<end-valid-time>2005-01-08T08:00:00-05:00</end-valid-time>
the minimum temp. will be
<value>37</value>

between
<start-valid-time>2005-01-07T07:00:00-05:00</start-valid-time>
and
<end-valid-time>2005-01-07T13:00:00-05:00</end-valid-time>
there will be
<value>0</value>
no "Liquid Precipitation" (or rain)

between
<start-valid-time>2005-01-07T07:00:00-05:00</start-valid-time>
and
<end-valid-time>2005-01-07T13:00:00-05:00</end-valid-time>
there will be
<value>0</value>
no snow

etc.

I suppose the "tricky" thing is they use those different times, this is  
done because some data is available only in the day, only in the night,  
every hour, etc. But it's still quite easy to read, just look at the  
time-layout attribute. At the beginning of the document the different  
times are given, for each different time-layout. Then available data is  
given for it's appropriate time layout.

HOWEVER, if that's still too complicated.. look at the file starting after  
cloud-amount. Suddenly we have the very simple "weather" element. It uses  
only one time layout.. every 3 hours.

and gives some very simple data:

<weather-conditions>
	<value coverage="slight chance" intensity="light" weather-type="rain"  
qualifier="none">
       	<visibility xsi:nil="true" />
	</value>
</weather-conditions>

Then below that it gives you a link to a nice little icon for it
<icon-link>http://www.nws.noaa.gov/weather/images/fcicons/sct.jpg</icon-link>

Too simple you cry! (perhaps). Well that's the problem with a simple  
format. That's why they invented the extended one I imagine ;) But if we  
look back we see it's rather easy to get lot's of data for the SAME time  
layout. Including the more important ones like temperature.

You could make some rather intresting weather bots with this.. poll this  
XML file every once in a while, see if any predictions have changed and  
alert the user if they have. I mean, that's what I hate about weather  
predictions, you watch one on TV or on a website, but you know they always  
change anyway. So you feel like you have to watch again, and again, and  
again, to see if it suddenly changed or not. Jabber could solve that  
problem using these files.

It's not quite a cut 'n paste job for a simple "what's the weather,  
weatherbot?" service. Then again, read this document into a DOM tree and  
it's not exactly rocketscience to make that out of it. In the end I'd say  
it's pretty human readable.. they avoided "schema hell" pretty well for  
one. But it's not like your user has to glare over this XML in the first  
place.



More information about the JDev mailing list