Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Main Support Categories > General Help
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

General Help
All your general support questions for Ubuntu, Kubuntu, Edubuntu and Xubuntu.

 
Thread Tools Display Modes
Old July 24th, 2008   #1
kaivalagi
Chocolate Ubuntu Mocha Blend
 
kaivalagi's Avatar
 
Join Date: Feb 2008
Location: 52°38'41.6"N/1°19'43.6"E
Beans: 1,916
Conky Weather Forecast Python Script

ArchLinux : Package support is present in the AUR. All my packages can be seen here: http://aur.archlinux.org/packages.php?SeB=m&K=kaivalagi

IMPORTANT NEWS

All the script packages have now been copied into the Conky Hardcore PPA. Any package updates will be provided by the team through this new ppa.

The ppa can be found here: https://launchpad.net/~conkyhardcore/+archive/ppa

To use this ppa first delete the old ppa files using this:
Code:
sudo rm /etc/apt/sources.list.d/m-buck*
Then follow the modified first post instructions for the scripts
__________________________________________________ __________________________________________________ ______________________________


Intro

I put together this python script to produce various bits of weather data on demand for use in Conky. This sort of thing has been done already by lvleph, a post for his contribution is here.

I wanted to create something, firstly to gain some experience with Python, and secondly so that there was no dependency on the yahoo weather website and it's formatting. This hopefully means that it will have a little longevity.

Some key features
  • Compliant with python 2.4 onwards
  • Utilises the weather.com XOAP service.
  • Caches fetched data to stop unnecessary web calls
  • Supports ranged forecast output, up to the next 5 days (cut's down on execi calls )
  • Optional spacing settings for ranged input
  • Supports imperial / metric / beaufort measurements
  • Supports day or night forecasts
  • Uses separate config file for key settings
  • Provides language support using gettext i18n functionality (English default, optional Spanish, French, Bulgarian, Czech, more if help provided)
  • Supports template files for complicated output in a single exec call! (cut's down on execi calls big time )
  • Template files can include the various conky variables such as $color, $font, $goto and $offset, and be formatted through the execp/exexpi commands
  • Obtainable through apt with a quite addition to your sources.list file
  • Uses custom font to display day and night based weather symbols (thanks Stancho!)

There is a README with the install and attached here, I suggest you give it atleast a quick once over!

Hope some of you find it useful

Any suggestions, please speak up.


Basic Install

Method 1: Using apt

1) Create the necessary list file for access to the repository by running one of these.

Karmic Koala:
Code:
sudo wget -q http://www.kaivalagi.com/ubuntu/ppa/conkyhardcore-karmic.list -O /etc/apt/sources.list.d/conkyhardcore-karmic.list
Jaunty Jackalope:
Code:
sudo wget -q http://www.kaivalagi.com/ubuntu/ppa/conkyhardcore-jaunty.list -O /etc/apt/sources.list.d/conkyhardcore-jaunty.list
Intrepid Ibex:
Code:
sudo wget -q http://www.kaivalagi.com/ubuntu/ppa/conkyhardcore-intrepid.list -O /etc/apt/sources.list.d/conkyhardcore-intrepid.list
Hardy Heron:
Code:
sudo wget -q http://www.kaivalagi.com/ubuntu/ppa/conkyhardcore-hardy.list -O /etc/apt/sources.list.d/conkyhardcore-hardy.list
2) Add the repository public key to your apt setup by running this:

Code:
wget -q http://www.kaivalagi.com/ubuntu/ppa/conkyhardcore-key.gpg -O- | sudo apt-key add -
3) Now that is done simply run the following to install

Code:
sudo apt-get update && sudo apt-get install conkyforecast
Method 2: Using deb file

Download and run latest .deb file for conkyforecast from the launchpad site here: https://launchpad.net/~conkyhardcore/+archive/ppa

Warning, this will not ensure you are kept up-to-date. Only method 1 will do that

Method 3: Using tar.gz file

Download the latest .tar.gz file for conkyforecast from the launchpad site here: https://launchpad.net/~conkyhardcore/+archive/ppa. Once downloaded extract all the contents to an appropriate folder, and edit the conkyForecast script to point to the correct location where conkyForecast.py is.

Unless you are using a non-Debian based OS I don't suggest this. Users of Debian/Ubuntu flavour OS's should ideally use method 1.

Again you will not receive updates using this method. ONLY method 1 can do this for you

All further details on setup are orientated around the deb package based install, so may differ from what you choose your setup to be, if done using the tarball.


Weather.com XOAP Service Registration

Due to the risk of having the previously registered xoap weather.com account terminated because of high volumes of requests, I have upgraded the script to use a users own registered details.

A template config file exists which holds all the settings used by the script, and most importantly, stores the partner id and registration code for the weather.com xoap service.

It can be found here "/usr/share/conkyforecast/conkyForecast.config"

For a working script you NEED to define, in a user specific config file, a partner id and registration code for the weather.com xoap service. For this purpose the config file should be copied to "~/.conkyForecast.config" and setup as required.

To register and obtain the necessary codes you need to visit the following url and fill out the form: http://www.weather.com/services/xmloap.html

After successfully completing the form, you will then receive a couple of
emails providing you with the necessary codes to update these settings with, along with the software development kit and terms and conditions.

To copy and edit the config file, using the command line , run the following two commands in a terminal, one after the other:

Code:
cp /usr/share/conkyforecast/conkyForecast.config ~/.conkyForecast.config
nano ~/.conkyForecast.config

Location Code For Script Calls

To identify the location code for your town/city the following URL should be used, replacing NORWICH with the one you're looking up :

http://xoap.weather.com/search/search?where=NORWICH

The following xml is returned for the above url, from which the correct location code (loc id value) can be picked. Mine was UKXX0103.

Code:
<search ver="2.0">
  <loc id="USNY0428" type="1">East Norwich, NY</loc>
  <loc id="USNY1036" type="1">North Norwich, NY</loc>
  <loc id="USCT0155" type="1">Norwich, CT</loc>
  <loc id="UKXX0103" type="1">Norwich, United Kingdom</loc>
  <loc id="USKS0428" type="1">Norwich, KS</loc>
  <loc id="USND0266" type="1">Norwich, ND</loc>
  <loc id="USNY1044" type="1">Norwich, NY</loc>
  <loc id="USOH0716" type="1">Norwich, OH</loc>
  <loc id="USVT0175" type="1">Norwich, VT</loc>
</search>
Once you know your location code, use it when calling the script with the "--location=" option.

Example Use

In the /usr/share/conkyforecast/example folder you'll find 2 files, conkyrc and conkyForecast.template

Conky can be run using these example files as follows:

Code:
conky -c /usr/share/conkyforecast/example/conkyrc &
By running this you should see some output at the top right of your screen, detailing all sorts of weather information.

The important thing to note now is that the script is called using this in Conky:

Code:
{execi 1800 conkyForecast ...options...}
Rather than something like this as before:

Code:
{execi 1800 python /path/to/file/conkyForecast.py ...options...}

Usage Help

You can get the current help options at any time by running (change the path as necessary):

Code:
conkyForecast -h
or

Code:
conkyForecast --help
The usage is as follows:

Code:
Usage: conkyForecast [options]
Options:
  -h, --help            show this help message and exit
  -l CODE, --location=CODE
                        location code for weather data [default: UKXX0103],Use
                        the following url to determine your location code by
                        city name:
                        http://xoap.weather.com/search/search?where=Norwich
  -d DATATYPE, --datatype=DATATYPE
                        [default: HT] The data type options are: DW (Day of
                        Week), WF (Weather Font output), WI (Weather Icon
                        Path), LT (Forecast:Low Temp,Current:Feels Like Temp),
                        HT (Forecast:High Temp,Current:Current Temp), CC
                        (Current Conditions), CT (Conditions Text), PC
                        (Precipitation Chance), HM (Humidity), VI
                        (Visibility), WD (Wind Direction), WA (Wind Angle - in
                        degrees), WS (Wind Speed), WG (Wind Gusts), BF
                        (Bearing Font), BI (Bearing Icon Path), BS (Bearing
                        font with Speed), CN (City Name), CO (Country), OB
                        (Observatory), SR (SunRise), SS (SunSet), DL
                        (DayLight), MP (Moon Phase), MF (Moon Font), MI (Moon
                        Icon Path), BR (Barometer Reading), BD (Barometer
                        Description), UI (UV Index), UT (UV Text), DP (Dew
                        Point), LU (Last Update at weather.com), LF (Last
                        Fetch from weather.com). Not applicable at command
                        line when using templates.
  -s NUMBER, --startday=NUMBER
                        define the starting day number, if omitted current
                        conditions are output. Not applicable at command line
                        when using templates.
  -e NUMBER, --endday=NUMBER
                        define the ending day number, if omitted only starting
                        day data is output. Not applicable at command line
                        when using templates.
  -S NUMBER, --spaces=NUMBER
                        [default: 1] Define the number of spaces between
                        ranged output. Not applicable at command line when
                        using templates.
  -t FILE, --template=FILE
                        define a template file to generate output in one call.
                        A displayable item in the file is in the form
                        [--datatype=HT --startday=1]. The following are
                        possible options within each item: --location,--
                        datatype,--startday,--endday,--night,--shortweekday,--
                        imperial,--beaufort,--hideunits,--hidedegreesymbol,--
                        spaces,--minuteshide. Note that the short forms of the
                        options are not supported! If any of these options is
                        set from the commandline, it sets the default value of
                        the option for all template items.
  -L LOCALE, --locale=LOCALE
                        override the system locale for language output
                        (bg=bulgarian, cs=czech, de=german, es=spanish,
                        en=english, es=spanish, fj=fijian, fr=french,
                        it=italian, nl=dutch, pl=polish, ro=romanian,
                        sk=slovak, more to come)
  -i, --imperial        request imperial units, if omitted output is in
                        metric.
  -b, --beaufort        request beaufort scale for wind speeds, if omitted
                        output is either metric/imperial.
  -n, --night           switch output to night data, if omitted day output
                        will be output.
  -w, --shortweekday    Shorten the day of week data type to 3 characters.
  -u, --hideunits       Hide units such as mph or C, degree symbols (°) are
                        still shown.
  -x, --hidedegreesymbol
                        Hide the degree symbol used with temperature output,
                        this is only valid if used in conjunction with
                        --hideunits.
  -m NUMBER, --minuteshide=NUMBER
                        Works only with LU and LF. If present, hides the date
                        part of the LU or LF timestamp if the day of the
                        timestamp is today. The time part is also hidden, if
                        the timestamp is older than minutes specified in this
                        argument. If set to 0, the time part is always shown.
                        If set to -1, the value EXPIRY_MINUTES from the config
                        file is used.
  -c WIDTH, --centeredwidth=WIDTH
                        If used the output will be centered in a string of the
                        set width, padded out with spaces, if the output width
                        is greater than the setting it will have no effect
  -r, --refetch         Fetch data regardless of data expiry.
  -v, --verbose         Request verbose output, not a good idea when running
                        through conky!
  -V, --version         Displays the version of the script.
  --errorlogfile=FILE   If a filepath is set, the script appends errors to the
                        filepath.
  --infologfile=FILE    If a filepath is set, the script appends info to the
                        filepath.
Note: For current conditions the temperature is "measured" using the HT datatype and "feels like" using the LT datatype.

Notes On Fonts

There are several fonts included in the release, these are located in /usr/share/fonts/truetype/conkyforecast

They should be used as follows:
  • ConkyWeather font should be used in conjunction with the WF (weather font) datatype.
  • Arrows font can used in conjunction with the BF (bearing font) datatype, to display a simple wind direction arrow
  • ConkyWind, ConkyWindN and ConkyWindNESW fonts should be used in conjunction with either the BF (bearing font) or BS (bearing font with speed) datatypes.
  • Moon Phases font should be used in conjunction with the MF (moon font) datatype

Notes On Images

There are now three datatype options which provide image paths to be used with the new $image parameter in Conky 1.7.1+

The data types are WI (Weather icons), MI (Moon icons) and BI (Bearing icons).

For more help and guidance on the $image parameter needed in conjunction with these datatype options visit the Conky Hardcore website, specifically this page: http://conky.linux-hardcore.com/?page_id=2487

Notes On Conky Config Files

I recommend using the test files as a templates when creating your own conkyrc file. Note that if the location of the python script is different to the example given, please ensure the conkyrc-test* file, or your own, is amended to point to the correct location.

A quick example of use in conky config:

Code:
Conditions: ${execi 3600 conkyForecast --location=UKXX0103 --datatype=CC}
${font ConkyWeather:size=36}${execi 3600 conkyForecast --location=UKXX0103 --datatype=WF}${font}
Temp: ${execi 3600 conkyForecast --location=UKXX0103 --datatype=HT}
More conky documentation can be found on the conky sourceforge site, and thanks to Bruce M, in a HOWTO thread in these forums. Links below:

Notes On Template Files

Recently the use of templates was added, so that a single exec call can be made to retrieve a multitude of data.

An example template file is included in the install, and the usage text also explains the options available.

Note that you can combine standard font output with weather fonts in a single template by using the execp and execpi commands in conky. The example uses this so to see how this works take a look at that.

A quick example of template file options and layout:

Code:
   [--datatype=DW --startday=1 --shortweekday]

[--datatype=HT --startday=1 --hideunits]/[--datatype=LT --startday=1 --hideunits]
Anything inside the square brackets are options, outside of the brackets is standard text that will be output as conky would normally handle it.

Notes On Script Config File Values

The conkyForecast.config which accompanies the script has a few config values worthy of a mention.

Code:
CACHE_FOLDERPATH = /tmp/
This setting dictates where the "pickled" weather data is cached for further use by the script. There will be one pickled file per location with the name .conkyForecast-LOCATION.cache, with LOCATION replace with your used location codes.

Pickling the information retrieved means that it can be reused without needing a round trip to the weather.com XOAP service each time something is displayed through a script call.

The default folder used is /tmp which is fine in most cases. However it should be noted that the /tmp folder is emptied on reboot, so data will not be kept in this case and a will needs refetching from the web again.

In situations where reboots are common, you could change the path to your own home folder if desired, meaning that cached data will never be lost.

Code:
CONNECTION_TIMEOUT = 5
This setting is just that, it defines the timeout period for the connection establishment. This setting probably will not need changing, however with poor connectivity a higher value may be required.

Code:
EXPIRY_MINUTES = 30
This setting defines how long the cached weather data remains valid for.
When the script is called, if the datetime of the cached files is older than this setting in minutes, the script will refetch the weather data required, and refresh the cache.

Code:
TIME_FORMAT = %H:%M
DATE_FORMAT = %Y-%m-%d
These settings define the formatting of both time and date output.
They follow standard strftime formatting conventions.

For more details, see the section on strftime here: http://docs.python.org/lib/module-time.html

Code:
LOCALE =
This setting defines the locale to use. It is optional as the script will determine your systems locale if this is not set. You also have the option to define locale via command line arguments, if these are set then this setting is ignored. The locales currently supported are listed against the --locale option in the command options help below.

Code:
XOAP_PARTNER_ID = 
XOAP_LICENCE_KEY =
These settings are required for a working script, they are used when
fetching data from the weather.com XOAP service.

As mentioned before above to register and obtain the necessary codes you need to visit this url: http://www.weather.com/services/xmloap.html and fill out the form

Gotchas

1) Conky has a default limitation of 128 bytes for any text output from a variable (such as execi). If you are creating large templates with more characters than the default buffer size can handle, the output will get truncated. If this happens you can override the default behaviour by setting as new buffer size before the TEXT section in your conkyrc file, as follows:

Code:
text_buffer_size 1024
2) There is a limit to the maximum range for forecasts, the startday and endday options cannot be set greater than 4, otherwise the script breaks...the following are the options to use to get the maximum forecast of high temps (including forecast data for today):

Code:
--datatype=HT --startday=0 --endday=4
3) For certain characters used in this script, such as degree symbols, it is required that the UTF8 character set is configured for use in Conky. If UTF8 is not enabled you can end up seeing something like 66ð rather than 66°. To enable UTF8 the following should be added before the TEXT section in your conkyrc file:

Code:
# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes
4) Make sure you do not have this setting below:

Code:
uppercase yes
The included fonts which support certain datatypes, are case sensitive so any use of them requires lower case as well as upper case.

Further Help

If you have an issue and are not sure, try running the same conkyForecast command in the terminal window and add the option --verbose, you should then see lots of information about what the script is doing, any warnings or errors should also be displayed.

If after doing the above you are still stuck, further help relating to conkyForecast can be got on this thread.

Note that it is best to post --verbose (hint on the option to use) output of your script call, as well as the conkyrc you are using. This way the issue can be understood quickly and easily.

The README is attached to this post also, take a look at this is you want to know more. Most of it's contents are here but there is some useful info there.

For any updates you receive you can view the readme file by running this in the terminal:

Code:
gunzip -c /usr/share/doc/conkyforecast/README.gz | less

Development History

Created: 13/04/2008

Noteworthy thanks go, in alphabetical order, to benpaka, Bruce M., El_Belgicano, HippyRandall, jjgomera, Nite, stancho and vasilub1 for their contributions to the script and it's rollouts over the past few months.

Development history going forwards can be seen here https://code.launchpad.net/~m-buck/+junk/conkyforecast

All packages available from me can be found here: https://launchpad.net/~conkyhardcore/+archive/ppa

I have also created a new website, for now it is relatively sparse, but it does details my conky scripts to a certain degree. You can find it here: http://www.kaivalagi.com
Attached Images
File Type: jpg conkyForecast.jpg (248.6 KB, 4947 views)
Attached Files
File Type: txt README.txt (17.7 KB, 286 views)
__________________

Last edited by kaivalagi; 4 Weeks Ago at 08:01 PM.. Reason: updated script, see development history
kaivalagi is offline   Reply With Quote
Old July 24th, 2008   #2
Bruce M.
Chocolate Ubuntu Mocha Blend
 
Bruce M.'s Avatar
 
Join Date: Sep 2007
Location: 34°35'S - 58°21'W
My beans are hidden!
Re: Conky Weather Forecast Python Script

Hi kaivalagi,

OK, I'm here and will spread the word.
I would have though as long as it was active it would be OK. Little do I know.

But it's here now. Thanks.
BTW, you might want to consider grabbing the post about your e-mail script (# 154 or 156) from the old thread and start that up as a "new" thread too. Be a shame to loose that.

CHIMO!
Bruce
Bruce M. is offline   Reply With Quote
Old July 25th, 2008   #3
kaivalagi
Chocolate Ubuntu Mocha Blend
 
kaivalagi's Avatar
 
Join Date: Feb 2008
Location: 52°38'41.6"N/1°19'43.6"E
Beans: 1,916
Re: Conky Weather Forecast Python Script

Quote:
Originally Posted by Bruce M. View Post
Hi kaivalagi,

OK, I'm here and will spread the word.
I would have though as long as it was active it would be OK. Little do I know.

But it's here now. Thanks.
BTW, you might want to consider grabbing the post about your e-mail script (# 154 or 156) from the old thread and start that up as a "new" thread too. Be a shame to loose that.

CHIMO!
Bruce
Thanks for reminding me. I will sort it out when I get some time, probably over the weekend.

I also want to add another thread about rtorrent integration into conky, but that's going to take some explaining...

Edit: thread added for the email script - http://ubuntuforums.org/showthread.php?p=5454877
__________________

Last edited by kaivalagi; July 25th, 2008 at 05:36 AM..
kaivalagi is offline   Reply With Quote
Old July 25th, 2008   #4
Crinos512
Gee! These Aren't Roasted!
 
Crinos512's Avatar
 
Join Date: Jul 2007
Location: The U. S. of A.
Beans: 155
Kubuntu Development Release
Send a message via AIM to Crinos512 Send a message via MSN to Crinos512 Send a message via Yahoo to Crinos512
Re: Conky Weather Forecast Python Script

Does this script check for network connectivity / internet access?

if not do you know of any way to force conky to check? ...I am currently using {if_running } to only load my weather if Thunderbird is open.
__________________
| Kubuntu 10.04 (amd64) | KDE 4.4 RC1 |
| Biostar TForce7050-M2 5.x | 4GB OCZ PC2-6400 Platinum Rv.2 RAM | Athlon 64 X2 4000+ |
| Razer Lachesis Gaming Mouse | Logitech G15 Gaming Keyboard |

Conky: ... no such configuration: 'normal'
Crinos512 is offline   Reply With Quote
Old July 25th, 2008   #5
kaivalagi
Chocolate Ubuntu Mocha Blend
 
kaivalagi's Avatar
 
Join Date: Feb 2008
Location: 52°38'41.6"N/1°19'43.6"E
Beans: 1,916
Re: Conky Weather Forecast Python Script

Quote:
Originally Posted by Crinos512 View Post
Does this script check for network connectivity / internet access?

if not do you know of any way to force conky to check? ...I am currently using {if_running } to only load my weather if Thunderbird is open.
It should handle it...although I am never without a connection.

The script tries to connect to weather.com before doing it's thing, if unsuccessful it then checks for cached weather data from a previously successful connection, and uses that. If none of this works out a fairly short error message is displayed instead.

Let me know how you get on
__________________
kaivalagi is offline   Reply With Quote
Old July 26th, 2008   #6
killerwhale65
Just Give Me the Beans!
 
Join Date: Oct 2007
Location: Belgium
Beans: 73
Ubuntu 8.04 Hardy Heron
Re: Conky Weather Forecast Python Script

hello,

I have a problem with my template, as you can see the precipitaion and lower temperatures are not completely displayed.

Also i have a question about the variable LT for the current day. I suppose this displays the temperature of the upcoming night? As you can see this is not currect, following my weather.com screenlet this should display 17°C.

Here is my template:
Code:
 {--datatype=DW --startday=1 --shortweekday}            {--datatype=DW --startday=2 --shortweekday}           {--datatype=DW --startday=3 --shortweekday}         {--datatype=DW --startday=4 --shortweekday}
{--datatype=HT --startday=1}          {--datatype=HT --startday=2}           {--datatype=HT --startday=3}        {--datatype=HT --startday=4}
{--datatype=LT --startday=1}          {--datatype=LT --startday=2}           {--datatype=LT --startday=3}       {--datatype=LT --startday=4}
 {--datatype=PC --startday=1}     {--datatype=PC --startday=2}     {--datatype=PC --startday=3}
      {--datatype=PC --startday=4}
ans here is the relevant conky code:
Code:
${alignc 20}${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=CC}${alignr}${color1}tonight: ${color}${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=LT}???
${font Weather:size=45}${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=WF}
${alignc 4}${voffset -45}${font size=15}${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=HT}
$font${voffset -75}${alignr}${color1}Wind: $color${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=WS}
${alignr}${color1}Vochtigheid: $color${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=HM}
${alignr}${color1}Neerslag: ${color}${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=PC}
${alignr}${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=BR} - ${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=BD}$color$font


${color1}Zon op: ${color3}${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=SR}${alignr}${color1}onder: ${color}${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=SS}$color
${voffset 12}${color1}Maan: ${color}${voffset -3}${color}${font moon phases:size=15}${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=MF}$font$color
${stippled_hr}
${font weather:size=30}${execi 3600 python /home/matt/conky/conkyForecast.py --location=BEXX0008 --startday=1 --endday=4 --datatype=WF --spaces=5}$font$color
${execi 3600 python /home/matt/conky/conkyForecast.py --location=BEXX0008 --template=/home/matt/conky/conky3Days.template}
What is wrong?

thanks!

Matt
Attached Images
File Type: png Screenshot.png (25.8 KB, 1729 views)
killerwhale65 is offline   Reply With Quote
Old July 26th, 2008   #7
kaivalagi
Chocolate Ubuntu Mocha Blend
 
kaivalagi's Avatar
 
Join Date: Feb 2008
Location: 52°38'41.6"N/1°19'43.6"E
Beans: 1,916
Re: Conky Weather Forecast Python Script

Quote:
Originally Posted by killerwhale65 View Post
hello,

I have a problem with my template, as you can see the precipitaion and lower temperatures are not completely displayed.

Also i have a question about the variable LT for the current day. I suppose this displays the temperature of the upcoming night? As you can see this is not correct, following my weather.com screenlet this should display 17°C.
The precipitation datatype, although available for current conditions, is only populated by the weather.com feed for forecast data. I guess you could use --startday=0 to obtain the forecast equivalent. I just tried it for myself:

--location=UKXX0103 --datatype=PC <-- N/A (current conditions, default to N/A always)
--location=UKXX0103 --datatype=PC --startday=0 <-- 20% (today's forecast)

For forecasts LT is the lowest temperature forecasted, for current conditions it is the feels like temperature rather than the night time one. I ended up using the LT datatype for this in current conditions as it served no purpose previously...as with precipitation you might find it more appropriate using --startday=0 --datatype=LT to get todays forecast low temp, this is likely to be night time temperature.

I hope that's answered your questions, if you have suggestions for any changes based on this let me know. For now it is a simple case of xml for current goes into current class data, xml for forecasts goes in forecast class data...
__________________
kaivalagi is offline   Reply With Quote
Old July 27th, 2008   #8
killerwhale65
Just Give Me the Beans!
 
Join Date: Oct 2007
Location: Belgium
Beans: 73
Ubuntu 8.04 Hardy Heron
Re: Conky Weather Forecast Python Script

hello,

thanks. I understand it better now.

But you forgot to answer why the low temps in the 4-day forecast are not completely displayed (see screenshot).

Thanks!

Matt
killerwhale65 is offline   Reply With Quote
Old July 27th, 2008   #9
kaivalagi
Chocolate Ubuntu Mocha Blend
 
kaivalagi's Avatar
 
Join Date: Feb 2008
Location: 52°38'41.6"N/1°19'43.6"E
Beans: 1,916
Re: Conky Weather Forecast Python Script

Quote:
Originally Posted by killerwhale65 View Post
hello,

thanks. I understand it better now.

But you forgot to answer why the low temps in the 4-day forecast are not completely displayed (see screenshot).

Thanks!

Matt
Looks like that's a conky thing, running out of text buffer for the exec call. When your returning large amounts of data from a single exec this can be a problem.

You should be able to sort out that issue by including the following in your conkyrc before the TEXT section:

Code:
text_buffer_size 1024
Change the value to suit, conky defaults to 128 I think, which is far too low for stuff like this.

Hope that helps
__________________
kaivalagi is offline   Reply With Quote
Old July 27th, 2008   #10
killerwhale65
Just Give Me the Beans!
 
Join Date: Oct 2007
Location: Belgium
Beans: 73
Ubuntu 8.04 Hardy Heron
Re: Conky Weather Forecast Python Script

OK,

The text-buffer thingy worked, thanks!

Now i am having an issue with the wind direction arrows (see screenshot).

Conky:
Code:
${alignc 20}${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=CC}${alignr}${color1}tonight: ${color}${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=LT}???
${font Weather:size=45}${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=WF}
${alignc 4}${voffset -45}${font size=15}${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=HT}
$font${voffset -75}${alignr}${color1}Wind: $color${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=WS}
${alignr}${color1}Vochtigheid: $color${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=HM}
${alignr}${color1}Neerslag: ${color}${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=PC}
${alignr}${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=BR} - ${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=BD}$color$font


${color1}Zon op: ${color3}${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=SR}${alignr}${color1}onder: ${color}${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=SS}$color
${voffset 12}${color1}Maan: ${color}${voffset -3}${color}${font moon phases:size=15}${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=MF}$font$color${font arrows:size=15}${execi 3600 python conky/conkyForecast.py --location=BEXX0008 --datatype=WD}
Attached Images
File Type: png Screenshot.png (32.0 KB, 1294 views)
killerwhale65 is offline   Reply With Quote

Bookmarks

Tags
conky, forecast, python, script, weather

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:59 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry