1 #!/bin/ksh |
1 #!/bin/ksh |
2 #====================================================================== |
2 #====================================================================== |
3 # L W P L O T _ T L |
3 # L W P L O T _ T L |
4 # doc: Thu Oct 13 10:51:49 2011 |
4 # doc: Thu Oct 13 10:51:49 2011 |
5 # dlm: Mon Mar 12 21:12:36 2012 |
5 # dlm: Wed Apr 18 10:33:35 2012 |
6 # (c) 2011 A.M. Thurnherr |
6 # (c) 2011 A.M. Thurnherr |
7 # uE-Info: 17 0 NIL 0 0 72 0 2 4 NIL ofnI |
7 # uE-Info: 18 0 NIL 0 0 72 0 2 4 NIL ofnI |
8 #====================================================================== |
8 #====================================================================== |
9 |
9 |
10 # HISTORY: |
10 # HISTORY: |
11 # Oct 13, 2011: - created |
11 # Oct 13, 2011: - created |
12 # Oct 14, 2011: - fiddled |
12 # Oct 14, 2011: - fiddled |
13 # Oct 17, 2011: - turned into filter |
13 # Oct 17, 2011: - turned into filter |
14 # - added %run_label |
14 # - added %run_label |
15 # Nov 14, 2011: - added file layout check |
15 # Nov 14, 2011: - added file layout check |
16 # Mar 12, 2012: - sh -> ksh as this does not work with /bin/sh on MacOSX 10.6.4 |
16 # Mar 12, 2012: - sh -> ksh as this does not work with /bin/sh on MacOSX 10.6.4 |
|
17 # Apr 12, 2012: - made re-entrant |
17 |
18 |
18 USAGE="Usage: $0 <eps-file> [in-file]" |
19 USAGE="Usage: $0 <eps-file> [in-file]" |
19 [ $# -eq 2 ] && exec <"$2" "$0" "$1" |
20 [ $# -eq 2 ] && exec <"$2" "$0" "$1" |
20 [ $# -ne 1 ] && { echo $USAGE >&2; exit 1; } |
21 [ $# -ne 1 ] && { echo $USAGE >&2; exit 1; } |
21 eps_file="$1" |
22 eps_file="$1" |
35 set -- $fields |
36 set -- $fields |
36 [ "$1" = elapsed -a "$2" = scan_offset -a "$4" = downcast ] || { |
37 [ "$1" = elapsed -a "$2" = scan_offset -a "$4" = downcast ] || { |
37 echo "$0: file layout error ($1,$2,$4)" >&2 |
38 echo "$0: file layout error ($1,$2,$4)" >&2 |
38 exit 1 |
39 exit 1 |
39 } |
40 } |
|
41 |
|
42 eps_file="$PWD/$eps_file" # make outfile name absolute (hopefully, it is not already...) |
|
43 mkdir /tmp/$$ # GMT makes tmpfiles and is not reentrant |
|
44 cd /tmp/$$ |
40 |
45 |
41 TMPFILE=/tmp/$$.LWplot_TL |
46 TMPFILE=/tmp/$$.LWplot_TL |
42 if [ ! -t 1 ] |
47 if [ ! -t 1 ] |
43 then |
48 then |
44 tee $TMPFILE |
49 tee $TMPFILE |