#!/bin/sh # script to plot 10-min data from AWS for 2000, Theresa site # # each file contains 4466 lines corresponding to measurements # taken every 10 minutes for the entire month # # algorithm: cat the files together then pipe through an # awk script to add a decimal_day year column and # then send to xvgr to plot # # note: need to change day_start in awk script if [ -f "all.dat" ] then echo "all.dat already exists; overwrite (y/n)? " read answer fi if [ ! -f "all.dat" -o "$answer" = y ] then /usr/bin/rm all.dat # create all.dat echo "creating 10-minute file: all.dat" for i in ../raw/13580*.r.gz do gunzip -c --stdout $i | doit >> all.dat echo "gunzip -c --stdout" $i "| doit >> all.dat" done fi if [ -f "hr.dat" ] then echo "hr.dat already exists; overwrite (y/n)? " read answer fi if [ ! -f "hr.dat" -o "$answer" = y ] then /usr/bin/rm hr.dat # create hr.dat echo "creating hourly averages file: hr.dat" echo "newgreen all.dat > hr.dat" newgreen all.dat > hr.dat fi if [ -f "proc.dat" ] then echo "output will be placed in file: proc.dat" echo "proc.dat already exists; overwrite (y/n)?" read answer fi if [ ! -f "proc.dat" -o "$answer" = y ] then /usr/bin/rm proc.dat cat "hr.dat" | \ nawk 'BEGIN{ a0=6.107799961; b0=6.109177956 a1=4.436518521e-1; b1=5.034698970e-1 a2=1.428945805e-2; b2=1.886013408e-2 a3=2.650648471e-4; b3=4.176223716e-4 a4=3.3031240396e-6; b4=5.824720280e-6 a5=2.034080948e-8; b5=4.838803174e-8 a6=6.136820929e-11; b6=1.838826904e-10 eps=0.622 } # end BEGIN { esat=a0+$2*(a1+$2*(a2+$2*(a3+$2*(a4+$2*(a5+a6*$2))))) #sat Pv, mb e=esat*$6/100 # pressure of vapor, mb w=eps*e/($3-e) # mixing ratio, mass vapor/mass dry air q=1000*w/(1+w) # specific humidity, mass vapor/mass moist air (g/kg) printf("%4f %f %f %f %f %f %f %f\n", \ $1, $2, $3, $4, $5, $6, q, $7) }' > proc.dat fi # now plot it up echo "Plot graph (y/n)?" read answer if [ "$answer" = y ] then if [ -f "proc.dat" ] then xmgr -p theresa.par -source pipe -noredraw \ -graph 0 \ "nawk '{print "$"1, "$"2}' proc.dat" \ -graph 1 \ "nawk '{print "$"1, "$"3}' proc.dat" \ -graph 2 \ "nawk '{print "$"1, "$"4}' proc.dat" \ -graph 3 \ "nawk '{print "$"1, "$"5}' proc.dat" \ -graph 4 \ "nawk '{print "$"1, "$"6}' proc.dat" \ -graph 5 \ "nawk '{print "$"1, "$"8}' proc.dat" \ -graph 6 \ "nawk '{print "$"1, "$"7}' proc.dat" fi fi