Radar Graphics in a Text World.

by Computothought in Circuits > Linux

3021 Views, 16 Favorites, 0 Comments

Radar Graphics in a Text World.

Screenshot from 2013-08-16 17:43:42.png
FWS.png
PICT0125.JPG
This is a continuation of the text in a graphics world instructable (https://www.instructables.com/id/graphics-in-a-text-world/) . Getting the weather is important. One nice thing about this instructable is that you can take graphical images and turn them into text. That saves a lot of disk space (depending on the resolution) (if you delete the image once it is converted).. You can then take the text images and simulate page flipping so that it seems as if you were looking at live radar. The images will not be as crisp as a real picture image, but if you look at all the converted images over time will give you a good idea of what is going on. The is especially true if a big storm is coming. 

Note: for some reason again. the original text was was wiped out, so am just winging this frame. There is also a step missing, I added. 

Get the Pics.

crontab1.png
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 d.sh in the bin directory because it is in the executable directory path.

d.sh:
[code]
DAY=$(date +"%m%d%y%H%M%S")
# picfn="pic$DAY.png"
# echo $picfn
wget http://radar.weather.gov/ridge/Thumbs/FWS.png -O fws$DAY.png
[/code]

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 d.sh

$ crontab -e to add d.sh to your cronfile.

Png to TXT Conversion.

Screenshot at 2012-04-23 04:09:37.png
Screenshot at 2012-04-23 04:16:55.png
 We are beginning to collect a few pictures. Now we need to convert the picture to a text file.

Convert.sh:
[code]
for g  in fws*.png
do
echo $g
img2txt -W 80 -f utf8 img2txt -W  80 -H 25 utf8 $g > $g.txt
done
[/code]

$ chmod +x convert.sh

$ ./convert.sh

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


Note: We used img2txt -W 80 -f utf8 img2txt -W  160 -H 60 utf8 $g > $g.txt

Showing the Results.

PICT0125.JPG
So far so good. Now we need to create a batch file to show the animation. This is a good start to a text based slide show.

show.sh:
[code]
for g  in fws*.txt
do
tput cup 0 0
 cat $g
done
[/code]

$ chmod +x show.sh

$ ./show.sh

Watch the show. If there is not much weather change or you have only collected a few frames as we have done here for sake of brevity, 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!!)

The Big Sign.

Screenshot from 2012-12-28 11:26:03.png
How interesting would it be to be able to show the ascii weather pictures on your business sign or even at a football stadium! many big signs display data via ascii. Makes it easier to display pictures with lower hardware requirements