PDA

View Full Version : Dirty Gnome Weather-applet hack.


Omnios
July 7th, 2007, 10:47 PM
Hi I have been using Ubuntu for a long time and have used gnome-applet with a entry for a town that is about 50 or so clicks away. Anyways got mad today and did a bunch of searching and hacking for a solution.

This is not a cut and past hack!

Warning Back up your Locations.xml before tweeking it may get Borked

Hacking the Gnome-applet is very dirty as there is nothing straight forward about it.
Forget using web local codes as the applet uses the aviation TAF and METAR standards.

There is a lot of info in the two wiki links provided.

http://en.wikipedia.org/wiki/METAR

http://en.wikipedia.org/wiki/Terminal_Aerodrome_Forecast

there is also a weather radar map standard but have not played with that yet.

Now the hardest part of this is searching for the code for your local area which will be any local airport thought it is only easy to find big airports so you might have to do some digging for the code.

Basiclly so far I have only copied an existing city and changed the town name / names and changed the <CODE> ....... </CODE> which gives working weather. I still have to figure out the
<coordinates>45-19N 075-40W</coordinates>

and the codes for the radar and am hoping for some help on this. I tried doing this hack a long time ago and found nothing on it till now as I figured out the aviation standard used. SO so far TAF is the main weather code for the location. METAR seems to be the coordinates but what I have seen online for my city looks different from the examples from the config file.

Now this is the dirty part which consists of tweeking the the following config file.
/usr/share/gnome-applets/gweather
Locations.xml is the file that is modified. You will have to open it as gedit-root etc to save it.

I copied an existing entry in the province I live in starting at <location> and ending at </location>

<location>

<name>Ottawa</name>
<name xml:lang="ar">أوتاوا</name>
<name xml:lang="az">Ottawa</name>
<name xml:lang="bg">Отава</name>
<name xml:lang="bn">ওটাওয়া</name>
<name xml:lang="bn_IN">ওটাওয়া</name>
<name xml:lang="bs">Otava (Ottawa)</name>
<name xml:lang="ca">Ottawa</name>
<name xml:lang="cs">Ottawa</name>
<name xml:lang="cy">Ottawa</name>
<name xml:lang="da">Ottawa</name>
<name xml:lang="de">Ottawa</name>
<name xml:lang="dz">ཨོ་ཊ་ཝ།</name>
<name xml:lang="el">Οττάβα</name>
<name xml:lang="en_CA">Ottawa</name>
<name xml:lang="en_GB">Ottawa</name>
<name xml:lang="es">Ottawa</name>
<name xml:lang="et">Ottawa</name>
<name xml:lang="eu">Ottawa</name>
<name xml:lang="fa">اوتاوا</name>
<name xml:lang="fi">Ottawa</name>
<name xml:lang="fr">Ottawa</name>
<name xml:lang="gl">Ottawa</name>
<name xml:lang="gu">ઓટાવા</name>
<name xml:lang="he">Ottawa</name>
<name xml:lang="hi">ओटावा</name>
<name xml:lang="hr">Ottawa</name>
<name xml:lang="hu">Ottawa</name>
<name xml:lang="id">Ottawa</name>
<name xml:lang="it">Ottawa</name>
<name xml:lang="ja">オタワ</name>
<name xml:lang="ka">ოტავა</name>
<name xml:lang="ko">오타와</name>
<name xml:lang="ky">Оттава</name>
<name xml:lang="lt">Otava</name>
<name xml:lang="lv">Ottawa</name>
<name xml:lang="mg">Ottawa</name>
<name xml:lang="mk">Ottawa</name>
<name xml:lang="ml">ഓട്ടാവാ</name>
<name xml:lang="mn">Ottawa</name>
<name xml:lang="mr">ओटावा</name>
<name xml:lang="nb">Ottawa</name>
<name xml:lang="ne">ओट्टावा</name>
<name xml:lang="nl">Ottawa</name>
<name xml:lang="nn">Ottawa</name>
<name xml:lang="or">ଓଟାଓ୍ବା</name>
<name xml:lang="pa">ਉਟਾਵਾ</name>
<name xml:lang="pl">Ottawa</name>
<name xml:lang="pt">Ottawa</name>
<name xml:lang="pt_BR">Ottawa</name>
<name xml:lang="ro">Ottawa</name>
<name xml:lang="ru">Оттава</name>
<name xml:lang="sl">Ottawa</name>
<name xml:lang="sq">Ottawa</name>
<name xml:lang="sr">Отава</name>
<name xml:lang="sr@Latn">Otava</name>
<name xml:lang="sv">Ottawa</name>
<name xml:lang="ta">ஒட்டாவா</name>
<name xml:lang="te">ఓటావా</name>
<name xml:lang="th">ออตตาวา</name>
<name xml:lang="tr">Ottawa</name>
<name xml:lang="uk">Оттава</name>
<name xml:lang="vi">Ottawa</name>
<name xml:lang="zh_CN">渥太华</name>
<name xml:lang="zh_HK">渥太華</name>
<name xml:lang="zh_TW">渥太華</name>
<code>CYOW</code>
<radar>tyx</radar>
<coordinates>45-19N 075-40W</coordinates>
</location> Now this is what I ended up inserting a copy and modding it.


<location>

<name>Oshawa</name>
<name xml:lang="ar">Oshawa</name>
<name xml:lang="az">Oshawa</name>
<name xml:lang="bg">Oshawa</name>
<name xml:lang="bn">ওটাওয়া</name>
<name xml:lang="bn_IN">ওটাওয়া</name>
<name xml:lang="bs">Oshawa</name>
<name xml:lang="ca">Oshawa</name>
<name xml:lang="cs">Ottawa</name>
<name xml:lang="cy">Ottawa</name>
<name xml:lang="da">Ottawa</name>
<name xml:lang="de">Ottawa</name>
<name xml:lang="dz">ཨོ་ཊ་ཝ།</name>
<name xml:lang="el">Οττάβα</name>
<name xml:lang="en_CA">Oshawa</name>
<name xml:lang="en_GB">Oshawa</name>
<name xml:lang="es">Oshawa</name>
<name xml:lang="et">Ottawa</name>
<name xml:lang="eu">Oshawa</name>
<name xml:lang="fa">اوتاوا</name>
<name xml:lang="fi">Ottawa</name>
<name xml:lang="fr">Oshawa</name>
<name xml:lang="gl">Ottawa</name>
<name xml:lang="gu">ઓટાવા</name>
<name xml:lang="he">Ottawa</name>
<name xml:lang="hi">ओटावा</name>
<name xml:lang="hr">Ottawa</name>
<name xml:lang="hu">Ottawa</name>
<name xml:lang="id">Ottawa</name>
<name xml:lang="it">Ottawa</name>
<name xml:lang="ja">オタワ</name>
<name xml:lang="ka">ოტავა</name>
<name xml:lang="ko">오타와</name>
<name xml:lang="ky">Оттава</name>
<name xml:lang="lt">Otava</name>
<name xml:lang="lv">Ottawa</name>
<name xml:lang="mg">Ottawa</name>
<name xml:lang="mk">Ottawa</name>
<name xml:lang="ml">ഓട്ടാവാ</name>
<name xml:lang="mn">Ottawa</name>
<name xml:lang="mr">ओटावा</name>
<name xml:lang="nb">Ottawa</name>
<name xml:lang="ne">ओट्टावा</name>
<name xml:lang="nl">Ottawa</name>
<name xml:lang="nn">Ottawa</name>
<name xml:lang="or">ଓଟାଓ୍ବା</name>
<name xml:lang="pa">ਉਟਾਵਾ</name>
<name xml:lang="pl">Ottawa</name>
<name xml:lang="pt">Ottawa</name>
<name xml:lang="pt_BR">Ottawa</name>
<name xml:lang="ro">Ottawa</name>
<name xml:lang="ru">Оттава</name>
<name xml:lang="sl">Ottawa</name>
<name xml:lang="sq">Ottawa</name> <name xml:lang="en_CA">Oshawa</name>
<name xml:lang="en_GB">Oshawa</name>
<name xml:lang="sr">Отава</name>
<name xml:lang="sr@Latn">Otava</name>
<name xml:lang="sv">Ottawa</name>
<name xml:lang="ta">ஒட்டாவா</name>
<name xml:lang="te">ఓటావా</name>
<name xml:lang="th">ออตตาวา</name>
<name xml:lang="tr">Ottawa</name>
<name xml:lang="uk">Оттава</name>
<name xml:lang="vi">Ottawa</name>
<name xml:lang="zh_CN">渥太华</name>
<name xml:lang="zh_HK">渥太華</name>
<name xml:lang="zh_TW">渥太華</name>
<code>CYKZ</code>
<radar>tyx</radar>
<coordinates>45-19N 075-40W</coordinates>
</location>
<location>
K now there are a few tweeks here one of which is the city name
<name>Oshawa</name>
Also to make it so you can choose your new town entry you must modify the name for the language you are using.

I need someone to give the US language abbreviation as I live in Canada.

<name xml:lang="en_CA">Oshawa</name>
<name xml:lang="en_GB">Oshawa</name>


Now this is the part to get your local weather

<code>CYKZ</code>

This is the TAF code you need to look up on the net which may be difficult. You could also possibly phone your local airport for the info you need.

Warning Back up your Locations.xml before tweeking it may get Borked

Happy Hacking!

Omnios
July 9th, 2007, 02:18 PM
K my dad is a pilot with a light aircraft and I was talking to him yesterday and got Tar and METAR sorted. TAR is the location code for an airport. Every official airport has one which means you should be able to get weather specific to your area, even rural USA/Canada.

METAR deals with coordinates and may cover a small are or even up to 500 miles. It also used for getting weather from one area to another. The problem I had with Metar is that the coordinates I got where may more than I saw in the config file.

Also i am still trying to figure out how to get the local radar weather code also.

Yet another hack by omnios

colo505
July 25th, 2007, 03:51 AM
You can find the weather code by installing kweather, and finding your city in /usr/share/apps/kweatherservice/stations.dat

_Stevie_
January 5th, 2008, 11:22 AM
hmm this looks cool, but i guess i'm still dependent on what data www.weather.com provides, right?
cos i wanted to add the data of a german city. but weather.com has only a
limited amount of german cities so i guess this wont work, right?

Omnios
January 5th, 2008, 08:09 PM
hmm this looks cool, but i guess i'm still dependent on what data www.weather.com (http://www.weather.com) provides, right?
cos i wanted to add the data of a german city. but weather.com has only a
limited amount of german cities so i guess this wont work, right?

This might help.

http://en.allmetsat.com/metar-taf/germany.php

_Stevie_
January 9th, 2008, 07:53 AM
hi Omnios!

ahh, so the data is relying on allmetsat.com?

6205
February 20th, 2008, 07:36 AM
Hmm...i wonder why cannot default GNOME weather applet use Weather.com for collecting forecast where are much more cities to choose from :confused:

Sealbhach
November 30th, 2008, 04:00 PM
I'm outside the US so I can't get a radar map from weather.com

Also, in 8.10, there is no /usr/share/gnome-applets/gweather

There is no gweather file in there.

Anyone know how I can get a radar map for the UK? I tried entering URLs but it dodn't work, I want to see how the urls from weather.com look like...


.

kyphi
December 13th, 2008, 06:56 PM
In 8.04 the path is: /usr/share/gnome/help/gweather

If it is different in 8.10, try "gweather" in "Search for files" under the "Places" menu.

For radar maps, you will have to search for a local weather station in your area that provides radar images and link to their co-ordinates.

This thread was started one and a half years ago - if you need answers it would be best to start a new thread.

tamccullough
December 15th, 2010, 02:44 PM
So what's the code for Oshawa? :)