Wanting to watch the weather on my computer while at work, many years ago I wrote a little program that would rotate the Windows background image through several current weather maps downloaded from NOAA and NWS websites. Honestly, it worked OK, but not stellar.
Living Las Vegas gave me very little drive to be informed with the weather; it was simply depressing. Hot... Hot... OMG Hot... WTF Hot... oh... one nice day. meh... FUUU HOT! I did NOT like the weather there.
Now, living back in the mid-west, I have been gaining interest in watching the weather again. Since watching any cable weather outlet while working is quite distracting, a weather screen saver is the next best thing. In this post I will detail how to setup a desktop Linux distribution (Debian "Jessie" to be exact) to download maps and radar images from the NWS and have the screen saver cycle through the images. Personally, this runs on my spare Linux box next to my work computer.
First, we need a directory to download the weather images into. I created a wx directory under Pictures. You can put this directory just about anywhere. In the wx directory I used the nano editor to create a file called getwx. (Really, any editor can be used.) Here is what I put in the file:
#!/bin/bash
#Get images for my weather Gallery.
curl http://www.goes.noaa.gov/GIFS/ECI8.JPG > /home/ken/Pictures/wx/EasternUSInfrared.jpg
curl https://radar.weather.gov/ridge/lite/N0R/DVN_0.png > /home/ken/Pictures/wx/DavenportRadar.png
curl https://radar.weather.gov/ridge/lite/N0R/ILX_0.png > /home/ken/Pictures/wx/CentralILRadar.png
curl https://radar.weather.gov/ridge/lite/N0R/DMX_0.png > /home/ken/Pictures/wx/DesMoinesRadar.png
curl https://radar.weather.gov/ridge/Conus/RadarImg/latest.gif > /home/ken/Pictures/wx/USRadar.png
curl http://www.wpc.ncep.noaa.gov//noaa/noaa.gif > /home/ken/Pictures/wx/Forecast.gif
curl https://graphical.weather.gov/images/uppermissvly/MaxT1_uppermissvly.png > /home/ken/Pictures/wx/ForecastHighTemps.png
curl https://graphical.weather.gov/images/uppermissvly/PoP121_uppermissvly.png > /home/ken/Pictures/wx/PrecipProbability.png
curl http://www.wpc.ncep.noaa.gov/basicwx/92fndfd.gif > /home/ken/Pictures/wx/12hourFronsPrecip.gif
curl http://www.spc.noaa.gov/products/exper/enhtstm/imgs/enh_0000.gif > /home/ken/Pictures/wx/TStorm0000z.gif
curl http://www.spc.noaa.gov/products/exper/enhtstm/imgs/enh_0400.gif > /home/ken/Pictures/wx/TStorm0400z.gif
curl http://www.spc.noaa.gov/products/exper/enhtstm/imgs/enh_1200.gif > /home/ken/Pictures/wx/TStorm1200z.gif
curl http://www.spc.noaa.gov/products/exper/enhtstm/imgs/enh_1600.gif > /home/ken/Pictures/wx/TStorm1600z.gif
curl http://www.spc.noaa.gov/products/exper/enhtstm/imgs/enh_2000.gif > /home/ken/Pictures/wx/TStorm2000z.gif
[Be certain to use the proper file paths. The above example is what I entered. Unless your username is ken, you will likely want to use another path.]
Run chmod a+x getwx from a terminal window to make the file en executable batch file.
Now, add a cron rule to run the script every 15 minutes. crontab -e allows you to edit your own personal cron schedule file. Add the following line to the file [using the path where you saved getwx.]:
0,15,30,45 * * * * /home/ken/Pictures/wx/getwx >/home/ken/Pictures/wx/lastWX 2&>1
Before we go on, you should run getwx from a shell prompt just to be certain it works by itself and properly downloads the files and places them where you want them.The last step is to configure the screen saver. I selected the GLSlideshow because I know it works and is pretty simple. After selecting the desired screen saver, go to the advanced tab of the Screensaver Preferences page, select Chose Random Image and then enter the directory where the images are downloaded. In my case, /home/ken/Pictures/wx/
Once that is working, you can change the files you download by changing the getwx script file. For that matter, you don't need to download weather images; they can be funny cat pictures or internet comics or just about any graphic content.
Enjoy & have fun with your new screen saver thing. :-)
No comments:
Post a Comment