#!/bin/bash # create a graph of number of wind observations distributed by time of day. # create the distributions for each station let "totname = 0" for name in midland big-spring lubbock roswell carlsbad hobbs clovis do let "totname = totname +1" staname[totname]=${name} #echo "station number ${totname} is ${staname[totname]}" done let "totsta = 0" for stanum in 722650 722657 722670 722680 722687 722688 722689 do #./ncdc2weru < wnd2/${stanum}.wnd2 > ${stanum}.org #colex 4 < ${stanum}.org | desc -fp -m -0.5 -M 23.5 -i 1 > ${stanum}.hfp let "totsta = totsta +1" let "station[totsta] = stanum" echo "station number ${totsta} is ${station[totsta]}" done if [[ totname -ne totsta ]] then echo "Count of names and station numbers doesn't match" echo "Please Check and try again" exit fi # create gnuplot script to graph the hourly frequencies and proportions plotfile="hourfreq.plt" outfile="hourfreq.ps" echo "# GNUPLOT commands to plot wind station data records" > ${plotfile} echo "set terminal postscript color font 'Helvetica,5'" >> ${plotfile} echo "set output '${outfile}'" >> ${plotfile} echo "set xlabel 'Hour of Observation'" >> ${plotfile} echo "set ylabel 'Frequency'" >> ${plotfile} boxwidth=$( echo "scale=4; 1/(${totsta}+1)" | bc -l ) echo "set boxwidth ${boxwidth} absolute" >> ${plotfile} echo "set style fill solid 1.00 border -1" >> ${plotfile} #echo "set grid nopolar" >> ${plotfile} echo "set grid noxtics nomxtics ytics nomytics noztics nomztics \\" >> ${plotfile} echo "nox2tics nomx2tics noy2tics nomy2tics nocbtics nomcbtics" >> ${plotfile} echo "set xrange [0.5:25.5]" >> ${plotfile} echo "set yrange [0:]" >> ${plotfile} echo "plot \\" >> ${plotfile} for nsta in $( seq 1 ${totsta} ) do let "staidx = nsta - 1" boxloc=$( echo "scale=4; -0.5+${nsta}*${boxwidth}" | bc -l ) if [ ${nsta} -eq ${totsta} ] then echo "'${station[nsta]}.hfp' using (\$0+${boxloc}):2:xticlabels(1) with boxes title '${staname[nsta]}'" >> ${plotfile} else echo "'${station[nsta]}.hfp' using (\$0+${boxloc}):2 with boxes title '${staname[nsta]}', \\" >> ${plotfile} fi done echo "set ylabel 'Proportion'" >> ${plotfile} echo "set yrange [0:]" >> ${plotfile} echo "plot \\" >> ${plotfile} for nsta in $( seq 1 ${totsta} ) do let "staidx = nsta - 1" boxloc=$( echo "scale=4; -0.5+${nsta}*${boxwidth}" | bc -l ) if [ ${nsta} -eq ${totsta} ] then echo "'${station[nsta]}.hfp' using (\$0+${boxloc}):3:xticlabels(1) with boxes title '${staname[nsta]}'" >> ${plotfile} else echo "'${station[nsta]}.hfp' using (\$0+${boxloc}):3 with boxes title '${staname[nsta]}', \\" >> ${plotfile} fi done gnuplot ${plotfile}