The weather.

Screenshot from 2013-08-16 17:43:42
A while back I had developed a way to download weather maps and then convert them to ascii for use on text only terminal or character lcd’s Made a modification or two in some of the code.
As you remember we modified the crontab file so the system would download radar images once a minute.
Crontab:
Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use ‘*’ in these fields (for ‘any’).#
# Notice that tasks will be started based on the cron’s system
# daemon’s notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
*/1 * * * * /home/eddie/bin/d.sh
Then we used d.sh to brab the radar pictures
d.sh
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
Then each picture needed to be converted. Instead of redoing every picture, the command file only redoes the pictures that have not already been converted.
convert.sh
.for g in Fws*.png
do
if [ -f $g.txt ];
then
echo $g.txt already written
else
echo $g.txt not written yet
img2txt -W 80 -f utf8 img2txt -W 160 -H 50 utf8 $g > $g.txt
fi
done
Then lastly we needed a command file to display the data to the screen like a radar would displaying each picture on after the other.
show.sh
clear
for g in Fws*.txt
do
tput cup 0 0
cat $g
done

Comments

Popular posts from this blog

Guiless?

Web.com and Network Solutions, the Walmart of the internet.

MSOffice vs Libreoffice