added by_day with temperature componesation
[zc] / www / cgi-bin / by_day.cgi
1 #!/bin/sh
2
3 dir=/home/dpavlin/zc/gnuplot/
4
5 set > /dev/shm/cgi.env
6
7 echo "Content-type: image/svg+xml"
8 echo
9
10 #pn=$( basename $0 | sed 's/.cgi//' )
11 test -z "$QUERY_STRING" && QUERY_STRING='.'
12 pn=$( grep "$QUERY_STRING" $dir/../subvision-numbers.txt | head -1 | cut -d' ' -f2 )
13 offset=$( grep "^$pn" $dir/offset.txt )
14 offset_x=$( echo $offset | cut -d' ' -f2 )
15 offset_y=$( echo $offset | cut -d' ' -f3 )
16 test -z "$offset_x" && offset_x=0
17 test -z "$offset_y" && offset_y=0
18
19 cat $dir/by_day.sql | sed \
20         -e "s/2008050087/$pn/" \
21         -e "s/x_axis_angle/x_axis_angle + $offset_x/" -e "s/y_axis_angle/y_axis_angle + $offset_y/" \
22 | psql --username=dpavlin -A -F "," -t zc > /dev/shm/$pn.txt-by-day
23
24 cat $dir/template.gnuplot | sed \
25         -e "s,axes.txt,/dev/shm/$pn.txt-by-day," \
26         -e "s,^set terminal.*$,set terminal svg," \
27         -e "s,^set output.*$,set output," \
28 > /dev/shm/$pn.gnuplot
29
30 gnuplot /dev/shm/$pn.gnuplot
31
32 #rm /dev/shm/axes.txt.$$ /dev/shm/axes.gnuplot.$$