#!/bin/sh

LISTFILES=$@


plot()
{
TITLE=$(echo $1|sed "s/dwtlog.\(....\)\(..\)\(..\)/Presión \3\/\2\/\1/")
(cat <<EOF
set terminal png
set output "png/$2"
set title "$TITLE"
set ylabel "Presión (Hectopascales)"
set xlabel "Tiempo (Hora Local Argentina)"
set grid
set xtics ("00" 00000, "01" 10000, "02" 20000, "03" 30000, "04" 40000, "05" 50000, "06" 60000, "07" 70000, "08" 80000, "09" 90000, "10" 100000, "11" 110000, "12" 120000, "13" 130000, "14" 140000, "15" 150000, "16" 160000, "17" 170000, "18" 180000, "19" 190000, "20" 200000, "21" 210000, "22" 220000, "23" 230000, "24" 240000) 
plot [0:240000] [] "$1" u 1:9 notitle w l
EOF
) |gnuplot
}

for f in ${@}; do
    OUTPUT=$(echo $f|sed "s/dwtlog.\([0-9]*\)/presion_\1.png/")
    if [ ! -f $OUTPUT ];then
	plot $f $OUTPUT
    fi
done;


