#!/bin/sh # # drft06rr_dredgetime # # Called by script drft06rr_dredgemap. It is used to calculate # velocities along track and figure out when the ship is stopped # and also print out positions every 15 minutes. # # Paul Wessel, Nov 15, 2001 # gmtset D_FORMAT %.12lg cat << EOF > vel.awk BEGIN { s = 0 ds = 0 s15 = 0 old_s15 = 0 } { if (NR > 1) { ds = \$7 - old_s dt = (\$6 - old_t) * 24.0 v = ds / dt hh = substr(\$3, 8, 2) mm = substr(\$3, 10, 2) s15 += ds; if (mm%15 == 0) { printf "%s\t%s\t%s\t%s\t%.3lf\t%lg\n", \$4, \$5, hh, mm, v, s15 - old_s15 old_s15 = s15 } } old_s = \$7 old_t = \$6 } EOF gmtconvert $1.xyt -fi0x,1y,2T -fo0x,1y,2t > tmp paste $1.xyt tmp | mapproject -Gn -f0x,1y | awk -f vel.awk rm -f vel.awk tmp