added temperature correction
[zc] / www / cgi-bin / by_day.cgi
index c69f055..ccbd89c 100755 (executable)
@@ -9,16 +9,25 @@ echo
 
 #pn=$( basename $0 | sed 's/.cgi//' )
 test -z "$QUERY_STRING" && QUERY_STRING='.'
-pn=$( grep "$QUERY_STRING" $dir/../subvision-numbers.txt | head -1 | cut -d' ' -f2 )
+numbers=$( grep "$QUERY_STRING" $dir/../subvision-numbers.txt | head -1 )
+pn=$( echo $numbers | cut -d' ' -f2 )
+temp_corr=$( echo $numbers | cut -d' ' -f5 )
+test -z "$temp_corr" && temp_corr=0.00001
+
 offset=$( grep "^$pn" $dir/offset.txt )
 offset_x=$( echo $offset | cut -d' ' -f2 )
-offset_y=$( echo $offset | cut -d' ' -f3 )
 test -z "$offset_x" && offset_x=0
+offset_y=$( echo $offset | cut -d' ' -f3 )
 test -z "$offset_y" && offset_y=0
 
+
+set > /dev/shm/$pn.env
+
 cat $dir/by_day.sql | sed \
        -e "s/2008050087/$pn/" \
        -e "s/x_axis_angle/x_axis_angle + $offset_x/" -e "s/y_axis_angle/y_axis_angle + $offset_y/" \
+       -e "s/0.0001/$temp_corr/" \
+| tee /dev/shm/$pn.sql \
 | psql --username=dpavlin -A -F "," -t zc > /dev/shm/$pn.txt-by-day
 
 cat $dir/template.gnuplot | sed \