#! /bin/bash # invoke gnuplot to compare an UNSAT-H generated run with a WEPS # generated run, or Two UNSAT-H runs or Two WEPS runs. # values compared are the volumetric soil water content by layer # get input file types if [ -n "`grep unsat-h ${1}`" ] then echo "First argument is unsat-h file" typefile1="unsat" else if [ -n "`grep "theta(1:layrsn)" ${1}`" ] then echo "First argument is weps file" typefile1="weps" else echo "First argument is not recognized file type" typefile1="none" fi fi # get input file types if [ -n "`grep unsat-h ${2}`" ] then echo "Second argument is unsat-h file" typefile2="unsat" else if [ -n "`grep "theta(1:layrsn)" ${2}`" ] then echo "Second argument is weps file" typefile2="weps" else echo "Second argument is not recognized file type" typefile2="none" fi fi if [ "$typefile1" != "none" ] then if [ "$typefile2" != "none" ] then # grab number of layers from header of input files numlayers1=`sed -n '1p' < $1 | sed 's/.*numlay =//'` numlayers2=`sed -n '1p' < $2 | sed 's/.*numlay =//'` numlayers=`echo "$numlayers1 $numlayers2" | stats min` echo "1 = $numlayers1; 2 = $numlayers2; min = $numlayers" # create plot files to show individual layers by year echo "reset" > twofile.plt echo "year = 0" >> twofile.plt echo "nlay = $numlayers" >> twofile.plt echo "call 'twoyearlay.plt' '3'" >> twofile.plt echo "print \"year: \", year+1" > twoyearlay.plt echo "layer = 0" >> twoyearlay.plt echo "set title 'Volumetric Water Content'" >> twoyearlay.plt echo "set xrange [0:365]" >> twoyearlay.plt echo "set yrange [0:0.4]" >> twoyearlay.plt echo "call 'twolayer.plt' '\$0'" >> twoyearlay.plt echo "year = year + 1" >> twoyearlay.plt echo "if(year < 10) reread" >> twoyearlay.plt echo "layer = layer + 1" > twolayer.plt echo "print \"layer: \", layer" >> twolayer.plt echo "set multiplot" >> twolayer.plt # plot first file with red line if [ "$typefile1" = "unsat" ] then if [ "$typefile2" = "unsat" ] then #compare with another UNSAT file, start with surface node echo "plot '$1' index year using 1:layer+1 with lines linetype 1" >> twolayer.plt else #compare with WEPS file, start with first layer node echo "plot '$1' index year using 1:layer+2 with lines linetype 1" >> twolayer.plt fi else echo "plot '$1' index year using 2:\$0+layer with lines linetype 1" >> twolayer.plt fi # plot second file with green line if [ "$typefile2" = "unsat" ] then if [ "$typefile1" = "unsat" ] then #compare with another UNSAT file, start with surface node echo "plot '$2' index year using 1:layer+1 with lines linetype 2" >> twolayer.plt else #compare with WEPS file, start with first layer node echo "plot '$2' index year using 1:layer+2 with lines linetype 2" >> twolayer.plt fi else echo "plot '$2' index year using 2:\$0+layer with lines linetype 2" >> twolayer.plt fi echo "set nomultiplot" >> twolayer.plt echo "pause -1 'next layer?'" >> twolayer.plt echo "clear" >> twolayer.plt echo "if(layer < nlay) reread" >> twolayer.plt gnuplot twofile.plt rm twofile.plt rm twoyearlay.plt rm twolayer.plt fi fi