author | A.M. Thurnherr <athurnherr@yahoo.com> |
Thu, 16 Apr 2015 10:31:09 +0000 | |
changeset 26 | b89d4b01fcc5 |
parent 20 | d6dc9c9da138 |
child 27 | 2053d8de8d6b |
permissions | -rwxr-xr-x |
13 | 1 |
#!/bin/ksh |
2 |
#====================================================================== |
|
3 |
# L W P L O T _ S P E C |
|
4 |
# doc: Thu Sep 5 18:23:41 2013 |
|
26
b89d4b01fcc5
after implementing new schemes for plotting and active files
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
5 |
# dlm: Thu Apr 16 08:12:02 2015 |
13 | 6 |
# (c) 2013 A.M. Thurnherr |
26
b89d4b01fcc5
after implementing new schemes for plotting and active files
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
7 |
# uE-Info: 10 58 NIL 0 0 72 2 2 4 NIL ofnI |
13 | 8 |
#====================================================================== |
9 |
||
26
b89d4b01fcc5
after implementing new schemes for plotting and active files
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
10 |
# NB: THIS PLOTTING ROUTINE REQUIRES NON-PUBLIC ANTS TOOLS |
b89d4b01fcc5
after implementing new schemes for plotting and active files
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
11 |
|
13 | 12 |
# HISTORY: |
13 |
# Sep 5, 2013: - created from LWplot_prof |
|
14 |
# Oct 30, 2103: - got rid of non-portable echo -e |
|
15 |
# Nov 6, 2013: - add interpolation of missing values |
|
19 | 16 |
# Jul 12, 2013: - added a -N to pgram to make it work with partial-depth casts |
20
d6dc9c9da138
updated LWplot to make fixbb optional
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
19
diff
changeset
|
17 |
# Apr 5, 2015: - made fixbb optional |
26
b89d4b01fcc5
after implementing new schemes for plotting and active files
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
18 |
# Apr 16, 2015: - removed copy of input on stdout |
13 | 19 |
|
20 |
#-------------------------------------------------- |
|
21 |
# Usage |
|
22 |
#-------------------------------------------------- |
|
23 |
||
24 |
USAGE="Usage: $0 <eps-file> [in-file]" |
|
25 |
[ $# -eq 2 ] && exec <"$2" "$0" "$1" |
|
26 |
[ $# -ne 1 ] && { echo $USAGE >&2; exit 1; } |
|
27 |
eps_file="$1" |
|
28 |
||
29 |
#-------------------------------------------------- |
|
30 |
# Read Header Data |
|
31 |
#-------------------------------------------------- |
|
32 |
||
33 |
while [ -z "$fields" ] |
|
34 |
do |
|
35 |
read line |
|
36 |
[ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}` |
|
37 |
[ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}` |
|
38 |
[ -z "$min_depth" ] && min_depth=`expr -- "$line" : '#ANTS#PARAMS#.*min_depth{\([^}]*\)}` |
|
39 |
[ -z "$max_depth" ] && max_depth=`expr -- "$line" : '#ANTS#PARAMS#.*max_depth{\([^}]*\)}` |
|
40 |
[ -z "$fields" ] && fields=`expr -- "$line" : '#ANTS#FIELDS# \(.*\)' | sed -e s/{//g -e s/}//g` |
|
41 |
done |
|
42 |
||
43 |
set -- $fields |
|
44 |
[ "$1" = depth -a "$4" = dc_w -a "$5" = dc_w.mad -a "$6" = dc_w.nsamp -a \ |
|
45 |
"${11}" = uc_w -a "${12}" = uc_w.mad -a "${13}" = uc_w.nsamp ] || { |
|
46 |
echo "$0: file layout error" >&2 |
|
47 |
exit 1 |
|
48 |
} |
|
49 |
||
50 |
#-------------------------------------------------- |
|
51 |
# Plot Data |
|
52 |
#-------------------------------------------------- |
|
53 |
||
54 |
eps_file="$PWD/$eps_file" # make outfile name absolute (hopefully, it is not already...) |
|
55 |
mkdir /tmp/$$ # GMT makes tmpfiles and is not reentrant |
|
56 |
cd /tmp/$$ |
|
57 |
||
58 |
TMPFILE=/tmp/$$.LWplot_spec |
|
26
b89d4b01fcc5
after implementing new schemes for plotting and active files
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
20
diff
changeset
|
59 |
cat > $TMPFILE |
13 | 60 |
|
61 |
[ -f .gmtdefaults4 ] || |
|
62 |
gmtset PAPER_MEDIA letter+ \ |
|
63 |
LABEL_FONT_SIZE 14 ANNOT_FONT_SIZE_PRIMARY 14 \ |
|
64 |
WANT_EURO_FONT true \ |
|
65 |
PLOT_DEGREE_FORMAT ddd:mm:ssF |
|
66 |
||
67 |
R=-R10/2000/1e-6/0.1 |
|
68 |
U=-R0/1/0/1 |
|
69 |
X=-JX10l |
|
70 |
||
71 |
# 1 & 3MM/S ERROR LEVELS |
|
72 |
err=`awk '{print $4, $1}' $TMPFILE | |
|
73 |
fillgaps -Qi linear -f '$1' '$2' | |
|
19 | 74 |
pgram -N'$1' -S'$2>80' -b4 -d '$2' '$1' 2>/dev/null | |
13 | 75 |
list -Q =1e-6/%pgram_resolution_bandwidth` |
76 |
{ echo 15 $err; echo 500 $err; } | psxy -P -X4 -K $R $X > "$eps_file" |
|
77 |
echo 500 $err 10 0 0 ML 1mm s@+-1@+ | pstext -O -K $R $X >> "$eps_file" |
|
78 |
err=`abc "9*$err"` |
|
79 |
{ echo 15 $err; echo 500 $err; } | psxy -O -K $R $X >> "$eps_file" |
|
80 |
echo 500 $err 10 0 0 ML 3mm s@+-1@+ | pstext -O -K $R $X >> "$eps_file" |
|
81 |
||
82 |
# EPS PARAMETERIZATION |
|
83 |
c1=`abc '10**(-1.754)/(4*$pi**2)'` |
|
84 |
l1=20; l2=1000; eps=-10; |
|
85 |
{ echo $l1 `abc "$c1*sqrt(1e$eps)*$l1**2"`; echo $l2 `abc "$c1*sqrt(1e$eps)*$l2**2"`; } | |
|
86 |
psxy -O -K $R $X -W2/blue >> "$eps_file" |
|
87 |
echo `abc $l1*0.99` `abc "$c1*sqrt(1e$eps)*$l1**2"` 10 0 0 MR 10@+$eps@+ | |
|
88 |
pstext -O -K $R $X -Gblue >> "$eps_file" |
|
89 |
echo `abc $l1*1.13` `abc "$c1*sqrt(1e$eps)*$l1**2"` 10 0 0 ML W kg@+-1@+ | |
|
90 |
pstext -O -K $R $X -Gblue >> "$eps_file" |
|
91 |
l1=20; l2=1000; eps=-9; |
|
92 |
{ echo $l1 `abc "$c1*sqrt(1e$eps)*$l1**2"`; echo $l2 `abc "$c1*sqrt(1e$eps)*$l2**2"`; } | |
|
93 |
psxy -O -K $R $X -W2/blue >> "$eps_file" |
|
94 |
echo `abc $l1*0.99` `abc "$c1*sqrt(1e$eps)*$l1**2"` 10 0 0 MR 10@+$eps@+ | |
|
95 |
pstext -O -K $R $X -Gblue >> "$eps_file" |
|
96 |
l1=20; l2=1000; eps=-8; |
|
97 |
{ echo $l1 `abc "$c1*sqrt(1e$eps)*$l1**2"`; echo $l2 `abc "$c1*sqrt(1e$eps)*$l2**2"`; } | |
|
98 |
psxy -O -K $R $X -W2/blue >> "$eps_file" |
|
99 |
echo `abc $l1*0.99` `abc "$c1*sqrt(1e$eps)*$l1**2"` 10 0 0 MR 10@+$eps@+ | |
|
100 |
pstext -O -K $R $X -Gblue >> "$eps_file" |
|
101 |
l1=20; l2=1000; eps=-7; |
|
102 |
{ echo $l1 `abc "$c1*sqrt(1e$eps)*$l1**2"`; echo $l2 `abc "$c1*sqrt(1e$eps)*$l2**2"`; } | |
|
103 |
psxy -O -K $R $X -W2/blue >> "$eps_file" |
|
104 |
echo `abc $l1*0.99` `abc "$c1*sqrt(1e$eps)*$l1**2"` 10 0 0 MR 10@+$eps@+ | |
|
105 |
pstext -O -K $R $X -Gblue >> "$eps_file" |
|
106 |
l1=20; l2=1000; eps=-6; |
|
107 |
{ echo $l1 `abc "$c1*sqrt(1e$eps)*$l1**2"`; echo $l2 `abc "$c1*sqrt(1e$eps)*$l2**2"`; } | |
|
108 |
psxy -O -K $R $X -W2/blue >> "$eps_file" |
|
109 |
echo `abc $l1*0.99` `abc "$c1*sqrt(1e$eps)*$l1**2"` 10 0 0 MR 10@+$eps@+ | |
|
110 |
pstext -O -K $R $X -Gblue >> "$eps_file" |
|
111 |
||
112 |
# SPECTRA |
|
113 |
awk '{print $4, $1}' $TMPFILE | |
|
114 |
fillgaps -Qi linear -f '$1' '$2' | |
|
19 | 115 |
pgram -N'$1' -S'$2>80' -b4 -dQFT,pwrdens '$2' '$1' | |
13 | 116 |
psxy -O -K -N -Mn $R $X -W8/coral >> "$eps_file" |
117 |
awk '{print $11,$1}' $TMPFILE | |
|
118 |
fillgaps -Qi linear -f '$1' '$2' | |
|
19 | 119 |
pgram -N'$1' -S'$2>80' -b4 -dQFT,pwrdens '$2' '$1' | |
13 | 120 |
psxy -O -K -N -Mn $R $X -W8/SeaGreen >> "$eps_file" |
121 |
||
122 |
# LABELS |
|
123 |
echo 0.98 0.05 12 0 0 TR $out_basename $run_label | pstext -O -K $U -JX10/10 >> "$eps_file" |
|
124 |
||
125 |
psbasemap -O -K $R $X -Bf3a2:"Vertical Wavelength [m]":/f3a1:"w Power Density [m@+2@+s@+-2@+/(rad m@+-1@+)]":WeSn >> "$eps_file" |
|
126 |
||
127 |
rm $TMPFILE |
|
20
d6dc9c9da138
updated LWplot to make fixbb optional
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
19
diff
changeset
|
128 |
[ -n "`which fixbb`" ] && fixbb "$eps_file" |
13 | 129 |
|
130 |
cd "$PWD" |
|
131 |
rm -rf /tmp/$$ |
|
132 |