#! /bin/bash # take a HYDRUS output file NOD_INF.OUT and covert to WEPS HLAYERS.OUT format. # INVOCATION: hydrus_to_hlayers [input file name] [output file name] if [ -e "$1" ] then infile="$1" else echo "$1" ": File does not exist." echo "INVOCATION: hydrus_to_hlayers [input file name] [output file name]" exit fi outfile="$2" echo "# Converted from HYDRUS file \"${infile}\" into hlayers formated file \"${outfile}\"" > ${outfile} dm "if N < 11 then SKIP else INPUT" < ${infile} | dm "0" y1 "1" x1 "if x2 < 0 then -x2 else x2" x4 "0" "0" "0" "0" "0" "0" x11 "x5/86400000" "-x3/1000" "0" "0" "0" "0" | dm "if x4 = 0 then ' ' else INPUT" >> ${outfile}