#!/bin/sh 

if [ ! -f "LoganDemo.zip" ]; then
wget http://hydrology.usu.edu/taudem/taudem5.0/LoganDemo.zip 
fi

unzip -x -o "LoganDemo.zip" && cd Logan

 mpiexec -n 2 ../PitRemove logan.tif
  
 mpiexec -n 2 ../D8FlowDir -p loganp.tif -sd8 logansd8.tif -fel loganfel.tif 
  
 mpiexec -n 2 ../DinfFlowDir -ang loganang.tif -slp loganslp.tif -fel loganfel.tif

 mpiexec -n 2 ../AreaD8 -p loganp.tif -ad8 loganad8.tif
 
 mpiexec -n 2 ../AreaDinf -ang loganang.tif -sca logansca.tif
 
 mpiexec -n 2 ../AreaD8 -p loganp.tif -o LoganOutlet.shp -ad8 loganad8o.tif
 
 mpiexec -n 2 ../GridNet -p loganp.tif -plen loganplen.tif -tlen logantlen.tif -gord logangord.tif
 
 mpiexec -n 2 ../PeukerDouglas -fel loganfel.tif -ss loganss.tif
 
 mpiexec -n 2 ../AreaD8 -p loganp.tif -o LoganOutlet.shp -ad8 loganssa.tif -wg loganss.tif
 
 mpiexec -n 2 ../DropAnalysis -p loganp.tif -fel loganfel.tif -ad8 loganad8.tif -ssa loganssa.tif -drp logandrp.txt -o LoganOutlet.shp -par 5 500 10 0
 
 mpiexec -n 2 ../Threshold -ssa loganssa.tif -src logansrc.tif -thresh 300
  
 mpiexec -n 2 ../StreamNet -fel loganfel.tif -p loganp.tif -ad8 loganad8.tif -src logansrc.tif -ord loganord3.tif -tree logantree.dat -coord logancoord.dat -net logannet.shp -w loganw.tif -o LoganOutlet.shp
 