[cig-commits] commit: update example files to work with grdmap.sh; update scripts to use bash

Mercurial hg at geodynamics.org
Mon Oct 8 10:45:25 PDT 2012


changeset:   144:703b8ccf773a
tag:         tip
user:        Sylvain Barbot <sbarbot at caltech.edu>
date:        Mon Oct 08 10:45:18 2012 -0700
files:       examples/alaska/coseismic.sh examples/japan/tohoku11/coseismic.sh examples/mojave/coulomb.sh examples/mojave/efaults.sh examples/mojave/egps_hm.sh examples/mojave/egps_lan.sh examples/mojave/eopts.sh examples/mojave/hectorm.sh examples/mojave/landers.sh examples/newzealand/christchurch.sh examples/newzealand/darfield.sh examples/sichuan/wenchuan.sh examples/taiwan/afterslip.sh examples/taiwan/coseismic.sh examples/taiwan/coupled.sh examples/taiwan/ecoast.sh examples/taiwan/ecoasts.sh examples/taiwan/econtour.sh examples/taiwan/efaults.sh examples/taiwan/eopts.sh examples/taiwan/epgps.sh examples/taiwan/readme.txt examples/taiwan/visco1d.sh examples/tibet/kokoxili/eopts-relax.sh examples/tibet/kokoxili/eopts.sh examples/tibet/kokoxili/kokoxili_co.sh examples/tibet/kokoxili/kokoxili_vs.sh examples/tibet/kokoxili/kokoxili_vs3d.sh examples/tibet/kokoxili/readme.txt examples/tibet/manyi/manyi_co.sh examples/tibet/yushu/yushu_as.sh examples/tibet/yushu/yushu_co.sh examples/tibet/yushu/yushu_vlc.sh examples/tibet/yushu/yushu_vmc.sh examples/tibet/yutian/yutian_co.sh util/erpatch_slip.sh util/grdmap.sh
description:
update example files to work with grdmap.sh; update scripts to use bash


diff -r ce4b4e72c047 -r 703b8ccf773a examples/alaska/coseismic.sh
--- a/examples/alaska/coseismic.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/alaska/coseismic.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#/bin/sh
+#/bin/bash
 
 # Mw 9.4 1964 Alaska earthquake coseismic displacements
 
diff -r ce4b4e72c047 -r 703b8ccf773a examples/japan/tohoku11/coseismic.sh
--- a/examples/japan/tohoku11/coseismic.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/japan/tohoku11/coseismic.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#/bin/sh
+#/bin/bash
 
 # Mw 9.0 2011 Tohoku (Japan) earthquake coseismic displacements
 #
diff -r ce4b4e72c047 -r 703b8ccf773a examples/mojave/coulomb.sh
--- a/examples/mojave/coulomb.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/mojave/coulomb.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # Coseismic and viscoelastic deformation due to the 1992 Mw7.3 
 # Landers, CA earthquake. The Earth model is uniform elastic 
diff -r ce4b4e72c047 -r 703b8ccf773a examples/mojave/efaults.sh
--- a/examples/mojave/efaults.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/mojave/efaults.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # this script is called with grdmap.sh using 
 #
@@ -7,17 +7,37 @@
 
 set -e
 self=$(basename $0)
+selfdir=$(dirname $0)
+cmdline=$*
 trap 'echo $self: Some errors occurred. Exiting.; exit' ERR
 
-if [ "$#" -lt "5" ]; then
-	echo $self": expected $self file.ps xmin/xmax/ymin/ymax scale u3 height. exiting."
+while getopts "b:c:gp:v:H:" flag
+do
+	case "$flag" in
+	b) bset=1;bds=$OPTARG;;
+	c) cset=1;carg=$OPTARG;;
+	g) gset=1;;
+	p) pset=1;U3=$OPTARG;;
+	v) vset=1;SIZE=$OPTARG;VECTOR=$OPTARG"c";;
+	H) Hset=1;HEIGHT=$OPTARG;;
+	esac
+done
+for item in $bset $cset $pset $vset $Hset; do
+	shift;shift
+done
+for item in $gset; do
+	shift
+done
+
+if [ "$#" -lt "1" ]; then
+	echo ${self} overlays faults on a GMT map.
+	echo
+	echo usage: $self -b xmin/xmax/ymin/ymax file.ps
 	exit 1
 fi
 
-echo $self: $*
+echo $self: $cmdline
 PSFILE=$1
-bds=$2
-
 WDIR=gmt
 
 psxy -O -K -JX -R$bds -P -m \
diff -r ce4b4e72c047 -r 703b8ccf773a examples/mojave/egps_hm.sh
--- a/examples/mojave/egps_hm.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/mojave/egps_hm.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # this script is called with grdmap.sh using 
 #
@@ -7,19 +7,39 @@
 
 set -e
 self=$(basename $0)
+selfdir=$(dirname $0)
+cmdline=$*
 trap 'echo $self: Some errors occurred. Exiting.; exit' ERR
 
-if [ "$#" -lt "5" ]; then
-	echo $self": expected $self file.ps xmin/xmax/ymin/ymax scale u3 height. exiting."
+while getopts "b:c:gp:v:H:" flag
+do
+	case "$flag" in
+	b) bset=1;bds=$OPTARG;;
+	c) cset=1;carg=$OPTARG;;
+	g) gset=1;;
+	p) pset=1;U3=$OPTARG;;
+	v) vset=1;SIZE=$OPTARG;VECTOR=$OPTARG"c";;
+	H) Hset=1;HEIGHT=$OPTARG;;
+	esac
+done
+for item in $bset $cset $pset $vset $Hset; do
+	shift;shift
+done
+for item in $gset; do
+	shift
+done
+
+if [ "$#" -lt "1" ]; then
+	echo ${self} overlays Hector Mine GPS offsets on a GMT map.
+	echo
+	echo usage: $self -b xmin/xmax/ymin/ymax file.ps
 	exit 1
 fi
 
-echo $self: $*
+echo $self: $cmdline
 PSFILE=$1
-bds=$2
-iscale=$3
+iscale=$VECTOR
 oscale=`echo $iscale | awk -F "c" '{print 1/$1}'`
-
 WDIR=$(dirname $PSFILE)
 DDIR=gps
 
diff -r ce4b4e72c047 -r 703b8ccf773a examples/mojave/egps_lan.sh
--- a/examples/mojave/egps_lan.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/mojave/egps_lan.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # this script is called with grdmap.sh using 
 #
@@ -7,19 +7,39 @@
 
 set -e
 self=$(basename $0)
+selfdir=$(dirname $0)
+cmdline=$*
 trap 'echo $self: Some errors occurred. Exiting.; exit' ERR
 
-if [ "$#" -lt "5" ]; then
-	echo $self": expected $self file.ps xmin/xmax/ymin/ymax scale u3 height. exiting."
+while getopts "b:c:gp:v:H:" flag
+do
+	case "$flag" in
+	b) bset=1;bds=$OPTARG;;
+	c) cset=1;carg=$OPTARG;;
+	g) gset=1;;
+	p) pset=1;U3=$OPTARG;;
+	v) vset=1;SIZE=$OPTARG;VECTOR=$OPTARG"c";;
+	H) Hset=1;HEIGHT=$OPTARG;;
+	esac
+done
+for item in $bset $cset $pset $vset $Hset; do
+	shift;shift
+done
+for item in $gset; do
+	shift
+done
+
+if [ "$#" -lt "1" ]; then
+	echo ${self} overlays Landers GPS offsets on a GMT map.
+	echo
+	echo usage: $self -b xmin/xmax/ymin/ymax file.ps
 	exit 1
 fi
 
-echo $self: $*
+echo $self: $cmdline
 PSFILE=$1
-bds=$2
-iscale=$3
+iscale=$VECTOR
 oscale=`echo $iscale | awk -F "c" '{print 1/$1}'`
-
 WDIR=$(dirname $PSFILE)
 DDIR=gps
 
diff -r ce4b4e72c047 -r 703b8ccf773a examples/mojave/eopts.sh
--- a/examples/mojave/eopts.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/mojave/eopts.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # this script is called with grdmap.sh using 
 #
@@ -7,17 +7,38 @@
 
 set -e
 self=$(basename $0)
+selfdir=$(dirname $0)
+cmdline=$*
 trap 'echo $self: Some errors occurred. Exiting.; exit' ERR
 
-if [ "$#" -lt "5" ]; then
-	echo $self": expected $self file.ps xmin/xmax/ymin/ymax scale u3 height. exiting."
+while getopts "b:c:gp:v:H:" flag
+do
+	case "$flag" in
+	b) bset=1;bds=$OPTARG;;
+	c) cset=1;carg=$OPTARG;;
+	g) gset=1;;
+	p) pset=1;U3=$OPTARG;;
+	v) vset=1;SIZE=$OPTARG;VECTOR=$OPTARG"c";;
+	H) Hset=1;HEIGHT=$OPTARG;;
+	esac
+done
+for item in $bset $cset $pset $vset $Hset; do
+	shift;shift
+done
+for item in $gset; do
+	shift
+done
+
+if [ "$#" -lt "1" ]; then
+	echo ${self} overlays position of observation points on a GMT map.
+	echo
+	echo usage: $self -b xmin/xmax/ymin/ymax file.ps
 	exit 1
 fi
 
-echo $self: $*
+echo $self: $cmdline
 PSFILE=$1
-bds=$2
-iscale=$3
+iscale=$VECTOR
 oscale=`echo $iscale | awk -F "c" '{print 1/$1}'`
 
 WDIR=$(dirname $PSFILE)
diff -r ce4b4e72c047 -r 703b8ccf773a examples/mojave/hectorm.sh
--- a/examples/mojave/hectorm.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/mojave/hectorm.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # Hector Mine earthquake 
 # Newtonian viscosity
diff -r ce4b4e72c047 -r 703b8ccf773a examples/mojave/landers.sh
--- a/examples/mojave/landers.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/mojave/landers.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # Landers earthquake 
 # Newtonian viscosity
diff -r ce4b4e72c047 -r 703b8ccf773a examples/newzealand/christchurch.sh
--- a/examples/newzealand/christchurch.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/newzealand/christchurch.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # reference:
 #
diff -r ce4b4e72c047 -r 703b8ccf773a examples/newzealand/darfield.sh
--- a/examples/newzealand/darfield.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/newzealand/darfield.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # reference:
 #
diff -r ce4b4e72c047 -r 703b8ccf773a examples/sichuan/wenchuan.sh
--- a/examples/sichuan/wenchuan.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/sichuan/wenchuan.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # reference for the slip model:
 #
diff -r ce4b4e72c047 -r 703b8ccf773a examples/taiwan/afterslip.sh
--- a/examples/taiwan/afterslip.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/taiwan/afterslip.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#/bin/sh
+#/bin/bash
 
 # model of afterslip on down-dip extension of the Chelungpu Fault.
 # notice the reduced sampling size to better resolve deformation
diff -r ce4b4e72c047 -r 703b8ccf773a examples/taiwan/coseismic.sh
--- a/examples/taiwan/coseismic.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/taiwan/coseismic.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#/bin/sh
+#/bin/bash
 
 # 1999 Mw 7.6 Chi Chi coseismic displacements
 
diff -r ce4b4e72c047 -r 703b8ccf773a examples/taiwan/coupled.sh
--- a/examples/taiwan/coupled.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/taiwan/coupled.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#/bin/sh
+#/bin/bash
 
 # this is Rousset et al. (in prep. 2012) preferred model for the 1999 Mw 7.1 
 # Chi-Chi earthquake including viscoelastic relaxation in a three-dimensional 
diff -r ce4b4e72c047 -r 703b8ccf773a examples/taiwan/ecoast.sh
--- a/examples/taiwan/ecoast.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/taiwan/ecoast.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,18 +1,43 @@
-#!/bin/sh
+#!/bin/bash
+
+# this script is called with grdmap.sh using 
+#
+#   grdmap.sh -e ./ecoast.sh file.grd
+#
 
 set -e
 self=$(basename $0)
+selfdir=$(dirname $0)
+cmdline=$*
 trap 'echo $self: Some errors occurred. Exiting.; exit' ERR
 
-if [ "$#" -lt "2" ]; then
-	echo $self": expected $self file.ps xmin/xmax/ymin/ymax. exiting."
+while getopts "b:c:gp:v:H:" flag
+do
+	case "$flag" in
+	b) bset=1;bds=$OPTARG;;
+	c) cset=1;carg=$OPTARG;;
+	g) gset=1;;
+	p) pset=1;U3=$OPTARG;;
+	v) vset=1;SIZE=$OPTARG;VECTOR=$OPTARG"c";;
+	H) Hset=1;HEIGHT=$OPTARG;;
+	esac
+done
+for item in $bset $cset $pset $vset $Hset; do
+	shift;shift
+done
+for item in $gset; do
+	shift
+done
+
+if [ "$#" -lt "1" ]; then
+	echo ${self} overlays coast lines on a GMT map.
+	echo
+	echo usage: $self -b xmin/xmax/ymin/ymax file.ps
 	exit 1
 fi
 
-echo $self: $*
+echo $self: $cmdline
 PSFILE=$1
-bds=$2
-
 WDIR=./gmt
 
 #psxy -O -K -JX -R$bds -P -M \
diff -r ce4b4e72c047 -r 703b8ccf773a examples/taiwan/ecoasts.sh
--- a/examples/taiwan/ecoasts.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/taiwan/ecoasts.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,18 +1,43 @@
-#!/bin/sh
+#!/bin/bash
+
+# this script is called with grdmap.sh using 
+#
+#   grdmap.sh -e ./ecoasts.sh file.grd
+#
 
 set -e
 self=$(basename $0)
+selfdir=$(dirname $0)
+cmdline=$*
 trap 'echo $self: Some errors occurred. Exiting.; exit' ERR
 
-if [ "$#" -lt "2" ]; then
-	echo $self": expected $self file.ps xmin/xmax/ymin/ymax. exiting."
+while getopts "b:c:gp:v:H:" flag
+do
+	case "$flag" in
+	b) bset=1;bds=$OPTARG;;
+	c) cset=1;carg=$OPTARG;;
+	g) gset=1;;
+	p) pset=1;U3=$OPTARG;;
+	v) vset=1;SIZE=$OPTARG;VECTOR=$OPTARG"c";;
+	H) Hset=1;HEIGHT=$OPTARG;;
+	esac
+done
+for item in $bset $cset $pset $vset $Hset; do
+	shift;shift
+done
+for item in $gset; do
+	shift
+done
+
+if [ "$#" -lt "1" ]; then
+	echo ${self} overlays coast lines on a GMT map.
+	echo
+	echo usage: $self -b xmin/xmax/ymin/ymax file.ps
 	exit 1
 fi
 
-echo $self: $*
+echo $self: $cmdline
 PSFILE=$1
-bds=$2
-
 WDIR=gmt
 
 psxy -O -K -JX -R$bds -P -m \
diff -r ce4b4e72c047 -r 703b8ccf773a examples/taiwan/econtour.sh
--- a/examples/taiwan/econtour.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/taiwan/econtour.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,23 +1,47 @@
-#!/bin/sh
+#!/bin/bash
+
+# this script is called with grdmap.sh using 
+#
+#   grdmap.sh -e ./econtour.sh file.grd
+#
 
 set -e
 self=$(basename $0)
+selfdir=$(dirname $0)
+cmdline=$*
 trap 'echo $self: Some errors occurred. Exiting.; exit' ERR
 
-if [ "$#" -lt "2" ]; then
-	echo $self": expected $self file.ps xmin/xmax/ymin/ymax. exiting."
+while getopts "b:c:gp:v:H:" flag
+do
+	case "$flag" in
+	b) bset=1;bds=$OPTARG;;
+	c) cset=1;carg=$OPTARG;;
+	g) gset=1;;
+	p) pset=1;U3=$OPTARG;;
+	v) vset=1;SIZE=$OPTARG;VECTOR=$OPTARG"c";;
+	H) Hset=1;HEIGHT=$OPTARG;;
+	esac
+done
+for item in $bset $cset $pset $vset $Hset; do
+	shift;shift
+done
+for item in $gset; do
+	shift
+done
+
+if [ "$#" -lt "1" ]; then
+	echo ${self} overlays contours of .grd file on a GMT map.
+	echo
+	echo usage: $self -b xmin/xmax/ymin/ymax file.ps
 	exit 1
 fi
 
-echo $self: $*
+echo $self: $cmdline
 PSFILE=$1
-bds=$2
-
 WDIR=$(dirname $PSFILE)
 INDEX=`echo $(basename $PSFILE) | awk '{print substr($0,0,3)}'`
 GRD=$WDIR/$(basename $PSFILE -plot.ps)
 
-echo $GRD
 grdcontour $GRD -O -K -C0.05 -JX -R$bds -P \
          -W0.3p/100/100/100 >> $PSFILE
 
diff -r ce4b4e72c047 -r 703b8ccf773a examples/taiwan/efaults.sh
--- a/examples/taiwan/efaults.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/taiwan/efaults.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,18 +1,43 @@
-#!/bin/sh
+#!/bin/bash
+
+# this script is called with grdmap.sh using 
+#
+#   grdmap.sh -e ./efaults.sh file.grd
+#
 
 set -e
 self=$(basename $0)
+selfdir=$(dirname $0)
+cmdline=$*
 trap 'echo $self: Some errors occurred. Exiting.; exit' ERR
 
-if [ "$#" -lt "2" ]; then
-	echo $self": expected $self file.ps xmin/xmax/ymin/ymax. exiting."
+while getopts "b:c:gp:v:H:" flag
+do
+	case "$flag" in
+	b) bset=1;bds=$OPTARG;;
+	c) cset=1;carg=$OPTARG;;
+	g) gset=1;;
+	p) pset=1;U3=$OPTARG;;
+	v) vset=1;SIZE=$OPTARG;VECTOR=$OPTARG"c";;
+	H) Hset=1;HEIGHT=$OPTARG;;
+	esac
+done
+for item in $bset $cset $pset $vset $Hset; do
+	shift;shift
+done
+for item in $gset; do
+	shift
+done
+
+if [ "$#" -lt "1" ]; then
+	echo ${self} overlays faults on a GMT map.
+	echo
+	echo usage: $self -b xmin/xmax/ymin/ymax file.ps
 	exit 1
 fi
 
-echo $self: $*
+echo $self: $cmdline
 PSFILE=$1
-bds=$2
-
 WDIR=gmt
 
 psxy -O -K -JX -R$bds -P -m \
diff -r ce4b4e72c047 -r 703b8ccf773a examples/taiwan/eopts.sh
--- a/examples/taiwan/eopts.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/taiwan/eopts.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,20 +1,45 @@
-#!/bin/sh
+#!/bin/bash
+
+# this script is called with grdmap.sh using 
+#
+#   grdmap.sh -e ./eopts.sh file.grd
+#
 
 set -e
 self=$(basename $0)
+selfdir=$(dirname $0)
+cmdline=$*
 trap 'echo $self: Some errors occurred. Exiting.; exit' ERR
 
-if [ "$#" -lt "2" ]; then
-	echo $self": expected $self file.ps xmin/xmax/ymin/ymax. exiting."
+while getopts "b:c:gp:v:H:" flag
+do
+	case "$flag" in
+	b) bset=1;bds=$OPTARG;;
+	c) cset=1;carg=$OPTARG;;
+	g) gset=1;;
+	p) pset=1;U3=$OPTARG;;
+	v) vset=1;SIZE=$OPTARG;VECTOR=$OPTARG"c";;
+	H) Hset=1;HEIGHT=$OPTARG;;
+	esac
+done
+for item in $bset $cset $pset $vset $Hset; do
+	shift;shift
+done
+for item in $gset; do
+	shift
+done
+
+if [ "$#" -lt "1" ]; then
+	echo ${self} overlays observation points on a GMT map.
+	echo
+	echo usage: $self -b xmin/xmax/ymin/ymax file.ps
 	exit 1
 fi
 
-echo $self: $*
+echo $self: $cmdline
 PSFILE=$1
-bds=$2
-iscale=$3
+iscale=$VECTOR
 oscale=`echo $iscale | awk -F "c" '{print 1/$1}'`
-
 WDIR=$(dirname $PSFILE)
 INDEX=`echo $(basename $PSFILE) | awk '{print substr($0,0,3)}'`
 
diff -r ce4b4e72c047 -r 703b8ccf773a examples/taiwan/epgps.sh
--- a/examples/taiwan/epgps.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/taiwan/epgps.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,20 +1,45 @@
-#!/bin/sh
+#!/bin/bash
+
+# this script is called with grdmap.sh using 
+#
+#   grdmap.sh -e ./ecoast.sh file.grd
+#
 
 set -e
 self=$(basename $0)
+selfdir=$(dirname $0)
+cmdline=$*
 trap 'echo $self: Some errors occurred. Exiting.; exit' ERR
 
-if [ "$#" -lt "2" ]; then
-	echo $self": expected $self file.ps xmin/xmax/ymin/ymax. exiting."
+while getopts "b:c:gp:v:H:" flag
+do
+	case "$flag" in
+	b) bset=1;bds=$OPTARG;;
+	c) cset=1;carg=$OPTARG;;
+	g) gset=1;;
+	p) pset=1;U3=$OPTARG;;
+	v) vset=1;SIZE=$OPTARG;VECTOR=$OPTARG"c";;
+	H) Hset=1;HEIGHT=$OPTARG;;
+	esac
+done
+for item in $bset $cset $pset $vset $Hset; do
+	shift;shift
+done
+for item in $gset; do
+	shift
+done
+
+if [ "$#" -lt "1" ]; then
+	echo ${self} overlays coast lines on a GMT map.
+	echo
+	echo usage: $self -b xmin/xmax/ymin/ymax file.ps
 	exit 1
 fi
 
-echo $self: $*
+echo $self: $cmdline
 PSFILE=$1
-bds=$2
-iscale=$3
+iscale=$VECTOR
 oscale=`echo $iscale | awk -F "c" '{print 1/$1}'`
-
 WDIR=$(dirname $PSFILE)
 INDEX=`echo $(basename $PSFILE) | awk '{print substr($0,0,3)}'`
 DDIR=./gps
diff -r ce4b4e72c047 -r 703b8ccf773a examples/taiwan/readme.txt
--- a/examples/taiwan/readme.txt	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/taiwan/readme.txt	Mon Oct 08 10:45:18 2012 -0700
@@ -9,7 +9,7 @@ To compute the coseismic displacement, r
 
 Create a map of the coseismic slip displacements with
 
-  grdmap.sh -b -100/100/-100/100 -p -2/2/0.01 -v 15 -e erpatch.sh -e ./wcoasts.sh -e ./efaults.sh coseismic/000
+  grdmap.sh -b -100/100/-100/100 -p -2/2/0.01 -v 15 -e erpatch.sh -e ./ecoasts.sh -e ./efaults.sh coseismic/000
 
 To compute the viscoelastic deformation, assuming a stratified viscoelastic earth with a viscoelastic substrate below 25km, run 
 
diff -r ce4b4e72c047 -r 703b8ccf773a examples/taiwan/visco1d.sh
--- a/examples/taiwan/visco1d.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/taiwan/visco1d.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#/bin/sh
+#/bin/bash
 
 # postseismic viscoelastic relaxation due to the 1999 Chi-Chi earthquake
 
diff -r ce4b4e72c047 -r 703b8ccf773a examples/tibet/kokoxili/eopts-relax.sh
--- a/examples/tibet/kokoxili/eopts-relax.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/tibet/kokoxili/eopts-relax.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,20 +1,46 @@
-#!/bin/sh
+#!/bin/bash
+
+# extra script for mapping tool grdmap.sh 
+# overlays the postseismic deformation 
+#
+#   grdmap.sh -e eopts-relax.sh WDIR/file.grd
+#
 
 set -e
 self=$(basename $0)
+selfdir=$(dirname $0)
+cmdline=$*
 trap 'echo $self: Some errors occurred. Exiting.; exit' ERR
 
-if [ "$#" -lt "2" ]; then
-	echo $self": expected $self file.ps xmin/xmax/ymin/ymax. exiting."
+while getopts "b:c:gp:v:H:" flag
+do
+	case "$flag" in
+	b) bset=1;bds=$OPTARG;;
+	c) cset=1;carg=$OPTARG;;
+	g) gset=1;;
+	p) pset=1;U3=$OPTARG;;
+	v) vset=1;SIZE=$OPTARG;VECTOR=$OPTARG"c";;
+	H) Hset=1;HEIGHT=$OPTARG;;
+	esac
+done
+for item in $bset $cset $pset $vset $Hset; do
+	shift;shift
+done
+for item in $gset; do
+	shift
+done
+
+if [ "$#" -lt "1" ]; then
+	echo ${self} overlays postseismic vectors on a GMT map.
+	echo
+	echo usage: $self -b xmin/xmax/ymin/ymax file.ps
 	exit 1
 fi
 
-echo $self: $*
+echo $self: $cmdline
 PSFILE=$1
-bds=$2
-iscale=$3
+iscale=$VECTOR
 oscale=`echo $iscale | awk -F "c" '{print 1/$1}'`
-
 WDIR=$(dirname $PSFILE)
 INDEX=`echo $(basename $PSFILE) | awk '{print substr($0,0,3)}'`
 
diff -r ce4b4e72c047 -r 703b8ccf773a examples/tibet/kokoxili/eopts.sh
--- a/examples/tibet/kokoxili/eopts.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/tibet/kokoxili/eopts.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,20 +1,46 @@
-#!/bin/sh
+#!/bin/bash
+
+# extra script for mapping tool grdmap.sh 
+# overlays the postseismic deformation 
+#
+#   grdmap.sh -e eopts-relax.sh WDIR/file.grd
+#
 
 set -e
 self=$(basename $0)
+selfdir=$(dirname $0)
+cmdline=$*
 trap 'echo $self: Some errors occurred. Exiting.; exit' ERR
 
-if [ "$#" -lt "2" ]; then
-	echo $self": expected $self file.ps xmin/xmax/ymin/ymax. exiting."
+while getopts "b:c:gp:v:H:" flag
+do
+	case "$flag" in
+	b) bset=1;bds=$OPTARG;;
+	c) cset=1;carg=$OPTARG;;
+	g) gset=1;;
+	p) pset=1;U3=$OPTARG;;
+	v) vset=1;SIZE=$OPTARG;VECTOR=$OPTARG"c";;
+	H) Hset=1;HEIGHT=$OPTARG;;
+	esac
+done
+for item in $bset $cset $pset $vset $Hset; do
+	shift;shift
+done
+for item in $gset; do
+	shift
+done
+
+if [ "$#" -lt "1" ]; then
+	echo ${self} overlays postseismic vectors on a GMT map.
+	echo
+	echo usage: $self -b xmin/xmax/ymin/ymax file.ps
 	exit 1
 fi
 
-echo $self: $*
+echo $self: $cmdline
 PSFILE=$1
-bds=$2
-iscale=$3
+iscale=$VECTOR
 oscale=`echo $iscale | awk -F "c" '{print 1/$1}'`
-
 WDIR=$(dirname $PSFILE)
 INDEX=`echo $(basename $PSFILE) | awk '{print substr($0,0,3)}'`
 
diff -r ce4b4e72c047 -r 703b8ccf773a examples/tibet/kokoxili/kokoxili_co.sh
--- a/examples/tibet/kokoxili/kokoxili_co.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/tibet/kokoxili/kokoxili_co.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # reference for the slip model:
 #
diff -r ce4b4e72c047 -r 703b8ccf773a examples/tibet/kokoxili/kokoxili_vs.sh
--- a/examples/tibet/kokoxili/kokoxili_vs.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/tibet/kokoxili/kokoxili_vs.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # reference for the slip model:
 #
diff -r ce4b4e72c047 -r 703b8ccf773a examples/tibet/kokoxili/kokoxili_vs3d.sh
--- a/examples/tibet/kokoxili/kokoxili_vs3d.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/tibet/kokoxili/kokoxili_vs3d.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # reference for the slip model:
 #
diff -r ce4b4e72c047 -r 703b8ccf773a examples/tibet/kokoxili/readme.txt
--- a/examples/tibet/kokoxili/readme.txt	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/tibet/kokoxili/readme.txt	Mon Oct 08 10:45:18 2012 -0700
@@ -14,13 +14,13 @@
 ./kokoxili_co.sh
 
 # then, to plot a cross-section of the shear stress across the fault, use
-map.sh -b -50/50/-100/0 -p -1/1/0.01 -t 25 -u MPa kokoxili_co/001.op001-s12.grd
+grdmap.sh -b -50/50/-100/0 -p -1/1/0.01 -t 25 -u MPa kokoxili_co/001.op001-s12.grd
 
 # to map the shear stress at 10 km depth, use
-map.sh -b -300/300/-300/300 -p -1/1/0.01 -t 50 -u MPa kokoxili_co/000-s12.grd
+grdmap.sh -b -300/300/-300/300 -p -1/1/0.01 -t 50 -u MPa kokoxili_co/000-s12.grd
 
 # and to map the 3-d surface displacement, use
-map.sh -b -250/250/-300/300 -p -0.2/0.2/0.01 -v 2 -s 20 -u m -e rpatch.sh kokoxili_co/000
+grdmap.sh -b -250/250/-300/300 -p -0.2/0.2/0.01 -v 2 -s 20 -u m -e erpatch.sh kokoxili_co/000
 
 
 
@@ -51,4 +51,4 @@ obsrelax.sh kokoxili_vs3d/????.txt
 
 # a comparative plot of the layered and the 3-d viscous models
 # can be obtained with
-map.sh -b -260/340/-240/260 -p -0.01/0.01/0.0001 -v 0.03 -s 25 -e rpatch.sh -e ./eopts-relax.sh kokoxili_{vs,vs3d}/002-relax-up.grd
+grdmap.sh -b -260/340/-240/260 -p -0.01/0.01/0.0001 -v 0.03 -s 25 -e erpatch.sh -e ./eopts-relax.sh kokoxili_{vs,vs3d}/002-relax-up.grd
diff -r ce4b4e72c047 -r 703b8ccf773a examples/tibet/manyi/manyi_co.sh
--- a/examples/tibet/manyi/manyi_co.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/tibet/manyi/manyi_co.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # reference for the slip model:
 #
diff -r ce4b4e72c047 -r 703b8ccf773a examples/tibet/yushu/yushu_as.sh
--- a/examples/tibet/yushu/yushu_as.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/tibet/yushu/yushu_as.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # reference:
 #
diff -r ce4b4e72c047 -r 703b8ccf773a examples/tibet/yushu/yushu_co.sh
--- a/examples/tibet/yushu/yushu_co.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/tibet/yushu/yushu_co.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # reference:
 #
diff -r ce4b4e72c047 -r 703b8ccf773a examples/tibet/yushu/yushu_vlc.sh
--- a/examples/tibet/yushu/yushu_vlc.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/tibet/yushu/yushu_vlc.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # reference:
 #
diff -r ce4b4e72c047 -r 703b8ccf773a examples/tibet/yushu/yushu_vmc.sh
--- a/examples/tibet/yushu/yushu_vmc.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/tibet/yushu/yushu_vmc.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # reference:
 #
diff -r ce4b4e72c047 -r 703b8ccf773a examples/tibet/yutian/yutian_co.sh
--- a/examples/tibet/yutian/yutian_co.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/examples/tibet/yutian/yutian_co.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # reference:
 #
diff -r ce4b4e72c047 -r 703b8ccf773a util/erpatch_slip.sh
--- a/util/erpatch_slip.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/util/erpatch_slip.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -57,6 +57,7 @@ EOF
 	        	 -W0.5p/20/20/20 \
 	        	<<EOF >> $PSFILE
 `awk '{if (">"==$1){print $0}else{print $2,$1}}' $WDIR/rdykes-???.xy`
+EOF
 	fi
 fi
 
diff -r ce4b4e72c047 -r 703b8ccf773a util/grdmap.sh
--- a/util/grdmap.sh	Mon Oct 08 08:37:45 2012 -0700
+++ b/util/grdmap.sh	Mon Oct 08 10:45:18 2012 -0700
@@ -15,9 +15,9 @@ trap 'echo $self: Some errors occurred. 
 trap 'echo $self: Some errors occurred. Exiting.; exit' ERR
 
 usage(){
-        echo "usage: map.sh [-b -5/5/-5/5] [-p -1.5/1.5/0.1] [...] file1.grd ... fileN.grd"
+        echo "usage: $self [-b -5/5/-5/5] [-p -1.5/1.5/0.1] [...] file1.grd ... fileN.grd"
 	echo "or"
-        echo "       map.sh [-b -5/5/-5/5] [-p -1.5/1.5/0.1] [...] dir1/index1 ... dirN/indexN"
+        echo "       $self [-b -5/5/-5/5] [-p -1.5/1.5/0.1] [...] dir1/index1 ... dirN/indexN"
 	echo ""
         echo "options:"
         echo "         -b bds sets the map bound to bds"



More information about the CIG-COMMITS mailing list