Welcome to the most active Linux Forum on the web.
Go Back > Blogs > peonuser
User Name


Rate this Entry

Radar maps gone retro.

Posted 04-24-2012 at 05:26 PM by peonuser

Once in a while I sort of come up with a neat idea. At least it is to me. Just because you have an old system, does not mean you can not teach it new tricks. Done a lot of page scraping to get weather details, but it would be nice to use radar screens from the command line. So details in this case are not so necessary. The overall view of the weather to see what kinds of weather fronts are approching is.

Here we go. We need to collect some historical data (i.e. radar screens). You can get these from the using the 3 letter designation for the area you are interested in. For example, I beleive the Dallas Fort Worth area is supposed to be FWS. You do not have to collect data just for your area. Collect data for several areas and get an overview of the weather all around.

You need to collect data. Cron is the perfect tool for the job. We need to create a batch file that will collect the pictures using cron. You will need to find the three letter designation of your area. You can get that from the national weather service. Note we put in the bin directory because it is in the executable directory path.
DAY=$(date +"%m%d%y%H%M%S")
# picfn="pic$DAY.png"
# echo $picfn
wget -O fws$DAY.png
*/1 * * * * /home/eddie/bin/

We will set it to grab a picture once a minute. AT most once a hour is fine unless you know you have inclement weather coming. Set the collection at 1 per minute for our example. That will fill up a hard drive quickly so be careful.

$ chmod +x

$ crontab -e to add to your cronfile.

You should be collecting radar images once you have that set up. We are beginning to collect a few pictures. Now we need to convert the picture(s) to a text file.
for g  in fws*.png
echo $g
img2txt -W 80 -f utf8 img2txt -W  80 -H 25 utf8 $g > $g.txt
Note: We used img2txt -W 80 -f utf8 img2txt -W 160 -H 60 utf8 $g > $g.txt

$ chmod +x

$ ./

You see the file names to be converted on the screen as they are processed. Then you should be able to to list the generated text.files.

$ ls fws*.txt

We could examine each txt file to see what the weather was at the moment, but that is time consuming. Better to have sort of a page flipping to see how the weather was over time. So far so good. Now we need to create a batch file to show the animation. This is also a good start to a text based slide show.
for g  in fws*.txt
tput cup 0 0
 cat $g
$ chmod +x

$ ./

Watch the show. If there is not much weather change or you have only collected a few frames, you not see the whiz boom you might want to. Definitely try it when a storm is coming your way (if it is safe to do so!!)

Posted in Uncategorized
Views 398 Comments 0
« Prev     Main     Next »
Total Comments 0




All times are GMT -5. The time now is 06:35 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration