#!/bin/bash # D=../01_GPS/wus_gps_final_crowell.dat R=-R-122/-114/32/37 # # sample the model at the data points # # make and apply the mask if requested # if [ "$#" -eq 2 ] then echo "mask" grdmask CGM_mask.xy -Gmask.grd -Rve_$1.grd -N1/NaN/NaN grdmath ve_$1.grd mask.grd MUL = ve.grd grdmath vn_$1.grd mask.grd MUL = vn.grd else echo "no_mask" cp ve_$1.grd ve.grd cp vn_$1.grd vn.grd fi # gmt select $D $R -fg | awk '{print($1,$2,$3,$4) }' > data.lluv grdtrack data.lluv -sa -Gve.grd > data.lluvu grdtrack data.lluvu -sa -Gvn.grd > data.lluvuv # # compute the rms deviation # awk '{print $3-$5}' < data.lluvuv > dv.dat awk '{print $4-$6}' < data.lluvuv >> dv.dat # # compute mean and standard deviation # echo -n $1 "mean, std, " >> stats.dat awk '{sum+=$1; array[NR]=$1} END {for(x=1;x<=NR;x++){sumsq+=((array[x]-(sum/NR))**2);}print sum/NR, sqrt(sumsq/NR)}' < dv.dat >> stats.dat