#!/bin/bash

# scale.central_europe2

testfile1="europe_pollutionrisk_day1_600_en.jpg"

if [ ! -e "$testfile1" ] || [ "`find "$testfile1" -mmin +1`" != "" ]
then
    ./maps
fi

testfile2="europe_pollutionrisk_day1_600_en.xpm.gz"

if [ ! -e $testfile2 ] || [ $testfile1 -nt $testfile2 ]
then
    for source in web_intl_europe_fcst*.jpg
    do
	destination=`echo $source | sed 's#.*/##;s#\.jpg$#.xpm.gz#'`
	if [ -e $destination ]
	then
	    rm $destination
	fi
    done
    for source in europe_pollutionrisk_day1_600_en.jpg \
	web_intl_europe_painindex_day1_600.jpg \
	web_intl_europe_winds_day1_600.jpg
    do
    destination=`echo $source | sed 's#.*/##;s#\.jpg$##'`
    touch $destination
    montage $source -crop 131x131+433+105 -background gray -colors 256 -geometry 54x54 -size 54x54 -unsharp 0.125 +adjoin "$destination.xpm.gz"
    done
fi

