Skip to content
Joel Pitt edited this page Feb 6, 2014 · 1 revision

This page shows how to create an animated GIF from a series of population distribution maps overlaid on a background map, with the year of simulation printed on each.

You need the ImageMagick utility convert.

#!/usr/bin

# expects first parameter to be first part of name (will append year and "_prob")
# second parameter = start year
# third year = end year
# Note: you may want to change the text commands!

for i in `seq $2 $3`
do
 mapname=${1}${i}_prob
 d.mon png1 #x0
 d.erase
 d.vect nzcoast_low type=area fcolor=black
 r.colors map=${mapname} color=byr
 d.rast $mapname -o
 d.legend $mapname at=5,50,85,90
 d.text at=2,90 size=3 text="B. davidii"
 d.text text="Null model" at=2,87 size=3
 d.text text=$i at=2,93
 d.out.png output=$mapname
done

convert -delay 100 ${1}* ${1}.gif