Debian Codegraph @

bin/plotcpm.erroffsets

raw
1 #!/bin/csh -f
2 # Changed this to csh -f. The -f option has been added after a
3 # report that this script failed for a tcsh user who had a .cshrc file.
4 # For Cygwin users, link your tcsh to csh, i.e., ln -s /bin/tcsh /bin/csh,
5 # or obtain a regular csh from somewhere.
6 #%// BK 27-Apr-2002
7 #
8 # plotcpm for gmt3-0
9 # used by Doris software for optional plotting of error vectors etc.
10 # input is file with info of axis (x,y) ("CPM_Data")
11 # BK 03/03/1999 ([email protected])
12 # removed psxy -F option for gmt3.3.3
13 # BK 01-Feb-2000
14 # added option for background magnitude image (argv 6).
15 # this requires some diskspace...
16 # BK 16-May-2000
17 # added histogram of errors
18 #%// BK 30-Jun-2000
19 ### RCS #####
20 #%// BK 17-May-2000
21 #%// $Revision: 3.9 $ $Date: 2003/11/27 16:36:04 $
22 # changed plot error vectors instead of offsets.
23 # increased size plots with errors
24 #%// BK 07-Feb-2001
25 # added unit vectors, changed number of plots, removed c (entimeter) option
26 # since linux box crashed on it.
27 #%// BK 15-Mar-2001
28 #%// MA June 2008 GMT compatibility updates
29 ################
30
31 ### Allow Doris time to write output file.
32 sleep 1
33 set PRG = `basename "$0"`
34 set VER = "v1.3, FMR software"
35 set AUT = "TUDelft Radar Group (c)1999-2008"
36 #set AUT = "Bert Kampes && Mahmut Arikan (c)1999-2008"
37 echo "$PRG $VER, $AUT"
38 echo " "
39
40
41 ### Handle input.
42 set USAGE = "0" #synopsis
43 set HELP = "0" #exit afterwards
44 # arg 1
45 set IFILE = "CPM_Data"
46 # args 2:5 (default) dimension of the 3rd plot.
47 @ L0 = 1
48 #@ LN = 25000
49 @ LN = 30000
50 @ P0 = 1
51 #@ PN = 4900
52 @ PN = 5000
53 # args 6 for background plot
54 set DOBG = "0"
55 set SLCFORMAT = ""
56 set SLCFILE = ""
57
58 switch ( $#argv )
59 case '6':
60 set DOBG = "1"
61 set SLCFILE = "$6"
62 # ||| fall through |||
63 #
64 case '5':
65 @ L0 = $2
66 @ LN = $3
67 @ P0 = $4
68 @ PN = $5
69 # ||| fall through |||
70 #
71 case '1':
72 set IFILE = $1
73 breaksw
74 # --- no fall through ---
75 #
76 default:
77 set HELP = "1"
78 endsw
79 #if ( $#argv < 6 ) set USAGE = "1"
80
81 # Check input
82 if ( ! -r "$IFILE" ) then
83 echo " input file: $IFILE cannot be read."
84 set HELP = "1"
85 endif
86
87 # Check if something went wrong
88 if ( $HELP ) set USAGE = "1"
89 if ( $USAGE ) then
90 cat << __EOFHD
91
92 $PRG -- program to plot data from Doris
93
94 Usage:
95 $PRG [[[ifile [linelo hi pixlo hi [slcfile]]]
96
97 tip: $PRG CPM_Data 1 25000 1 4900 slcfile.raw
98
99 __EOFHD
100 endif
101 if ( $HELP ) then
102 cat << __EOFHD
103
104 infile is a data file from doris, see this script for details.
105 linelo is first line.
106 linehi is last line.
107 pixello is first pixel.
108 pixello is last pixel.
109 slcfile is filename of SLC data for background of magnitude.
110 format must be ci2 or cr4 of SLC data.
111
112 Defaults:
113 ifile == CPM_Data
114 linelo == 1
115 linehi == 25000
116 pixlo == 1
117 pixhi == 4900
118
119 If magnitude background calls to GMT and cpxfiddle.
120
121 __EOFHD
122 exit -1
123 endif
124
125 ### find out if nawk is available, since awk seems not to know atan2?
126 #set AWK = awk;
127 # echo 1 | /usr/xpg4/bin/awk '{print 1}' >& /dev/null
128 # if ( $status == 0 ) set AWK = '/usr/xpg4/bin/awk'
129 # echo 1 | /usr/xpg4/bin/awk '{print 1}' >& /dev/null
130 echo 1 | awk '{print 1}' >& /dev/null
131 if ( $status == 0 ) set AWK = `which awk`
132 echo 1 | nawk '{print 1}' >& /dev/null
133 if ( $status == 0 ) set AWK = 'nawk'
134 echo 1 | gawk '{print 1}' >& /dev/null
135 if ( $status == 0 ) set AWK = 'gawk'
136 echo "Using as awk program: $AWK"
137
138
139 ### Initialize variables
140 set OFILE1 = "dummy1.$$.ps" # distribution errors azi/range
141 set OFILE2 = "dummy2.$$.ps" # 2d pic
142 set OFILE3 = "dummy3.$$.ps" # histogram azimuth,range errors
143 set TMPFILE = "tmpfile.plot"
144 ### Clean up, should not exist anyway.
145 rm -f $OFILE1 $OFILE2 $OFILE3 $TMPFILE
146
147
148 ### Set GMT defaults
149 # PAPER_MEDIA a4+ \
150 gmtset MEASURE_UNIT cm \
151 PAPER_MEDIA a4+ \
152 PAGE_ORIENTATION portrait \
153 ANOT_FONT Helvetica \
154 ANOT_FONT_SIZE 10p \
155 ANOT_OFFSET 0.2 \
156 ANNOT_FONT_SIZE_SECONDARY 10p \
157 BASEMAP_AXES WeSn \
158 LABEL_FONT Helvetica \
159 LABEL_FONT_SIZE 10 \
160 HEADER_FONT_SIZE 24p \
161 UNIX_TIME_POS -2/-2
162
163
164 ### remove heading comment lines (10)
165 #tail -n +11 $IFILE >! $TMPFILE
166 #%// BK 25-Sep-2001: following bug report by Irek Baran. on tail.
167 $AWK '{if(NR>10)print $0}' $IFILE >! $TMPFILE
168
169
170
171 ###Assumes data in input file $1: (CPM_Data)
172 # 2 27 447 241.12 3.31 0.44 0.04 0.11 48.12 130.80
173 # 1: window number
174 # 2: location x
175 # 3: location y
176 # 4: offset x
177 # 5: offset y
178 # 6: correlation
179 # 7: error x
180 # 8: error y
181 # 9: abs(wtest x)
182 # 10:abs(wtest y)
183
184 ### Plotting options gmt: psxy/pstext
185 # R: axis , use 0 to 1
186 # J: projection/size (cm, see default file)
187 # V: verbose
188 # U: timestamp
189 # :: lat/lon not lon/lat input
190 # S: symbol
191 # N: if outside border do ?
192 # B: boundary annotation
193 # P: portrait
194 # K: append to ps later
195
196 ### Plot1: error_vs_correlation + window number
197 ### get maxima in data
198 # $6 : correlation
199 # $7 : errors in azimuth
200 # $8 : errors in range
201 #
202 ### Plot the points (azimuth).
203 echo " +++ Plotting absolute errors azimuth +++"
204 #set MAXERR=`$AWK 'BEGIN{m=$7}{{if($7>m){m=$7}}}END{print m+.05}'<$TMPFILE`
205 set MAXERR=`$AWK '(NR==1){m = sqrt ( $7 * $7 )}{{if ( sqrt ( $7 * $7 ) > m ){m = sqrt ( $7 * $7 )}}}END{print m + 0.05}'<$TMPFILE`
206 set TITLE = "Azimuth_direction"
207 set PROJ = "-JX15/8"
208 set XLABEL = "Correlation"
209 set YLABEL = "abs(e)"
210 set GMTFLAGS = "-K -N -R0/1/0/$MAXERR $PROJ -U -Sx.2 -B.1:"$XLABEL":/.1:"$YLABEL"::."$TITLE": -P -W4/255/0/0"
211 $AWK '{print $6, sqrt ( $7 * $7 )}' $TMPFILE | psxy $GMTFLAGS >! $OFILE1
212 ### Add the window numbers.
213 #set GMTFLAGS = "-N -R0/1/0/$MAXERR $PROJ -P -O"
214 set GMTFLAGS = "-K -N -R0/1/0/$MAXERR $PROJ -P -O"
215 $AWK '{printf "%lg %s 10 0 0 5 %lg\n", $6 + 0.003, sqrt ( $7 * $7 ) + 0.003, $1}' $TMPFILE | pstext $GMTFLAGS >> $OFILE1
216 ###
217 ###
218 ### Do the same plot for Range direction.
219 echo " +++ Plotting absolute errors range +++"
220 set MAXERR=`$AWK '(NR==1){m = sqrt ( $8 * $8 )}{{if ( sqrt ( $8 * $8 ) > m ){m = sqrt ( $8 * $8 )}}}END{print m + 0.05}'<$TMPFILE`
221 set TITLE="Range_direction"
222 set GMTFLAGS="-Y14 -O -K -N -R0/1/0/$MAXERR $PROJ -Sx.2 -B.1:"":/.1:"$YLABEL"::."$TITLE": -P -W4/255/0/0"
223 $AWK '{print $6, sqrt ( $8 * $8 )}' $TMPFILE | psxy $GMTFLAGS >> $OFILE1
224 set GMTFLAGS = "-N -R0/1/0/$MAXERR $PROJ -P -O"
225 $AWK '{printf "%lg %s 10 0 0 5 %lg\n", $6+.003, sqrt ( $8 * $8 ) + 0.003, $1}' $TMPFILE | pstext $GMTFLAGS >> $OFILE1
226 ### View this plot in bg, delete it when closed, and continue script.
227 viewanddel $OFILE1 &
228
229
230 ### Plot3: location of windows / wtests / error vectors
231 # plotted are scaled observations (offsets) for pattern visualization
232 # (rotated) scaled wtests, to see largest one
233 # col1: window number
234 # 2/3: positionL/P
235 # 9/10: wtests
236 #if ( "$5" == "" ) then
237 # echo "usage: $0 infile minL maxL minP maxP"
238 # echo " eg: $0 testdata.dat 0 25000 0 4900"
239 # exit -1
240 #endif
241
242
243 # Labeling of axis.
244 echo \\n" +++ Plotting the observed offset vectors (normalized)"
245 set TITLE = "error_vectors+rotated_wtests"
246 set XLABEL = "Azimuth"
247 set YLABEL = "Range"
248 # height=y=azimuth, assume 5*stretched
249 @ WIDTH = ( ( $PN - $P0 ) + 1)
250 @ HEIGHT = ( ( $LN - $L0 ) + 1)
251 @ NUMPIXS = ( $WIDTH * $HEIGHT )
252 set SLCFORMAT = "cr4"
253 if ( $DOBG ) then
254 # filewidth should be used...
255 @ SIZECI2 = $WIDTH * $HEIGHT * 4
256 @ SIZECR4 = $WIDTH * $HEIGHT * 8
257 set FSIZE = `ls -l $SLCFILE | $AWK '{print $5}'`
258 if ( $FSIZE == $SIZECI2 ) then
259 echo " *** File format ${SLCFILE}: complex short."
260 set SLCFORMAT = ci2
261 else if ( $FSIZE == $SIZECR4 ) then
262 echo " *** File format ${SLCFILE}: complex float."
263 set SLCFORMAT = cr4
264 else
265 echo " *** Sorry, no background, file format could not be determined."
266 set DOBG = "0"
267 endif
268 endif
269
270 # GMT
271 @ TICKSL = $HEIGHT / 7
272 @ TICKSP = $WIDTH / 7
273 set RANGE = "-P -: -R$P0/$PN/$L0/$LN"
274 set FRAME = "-B"$TICKSP":"$YLABEL":/"$TICKSL":"$XLABEL"::."$TITLE":"
275 set XSIZE = "21"
276 set YSIZE = "0"
277 # size paper, largest size $XSIZE
278 # strict stretching ERS1/2 only...
279 @ HEIGHT = $HEIGHT / 5
280 if ( $HEIGHT > $WIDTH ) then
281 set YSIZE = $XSIZE
282 set XSIZE = `echo "scale=3; $WIDTH/$HEIGHT*$YSIZE" | bc -l`
283 else
284 set YSIZE = `echo "scale=3; $HEIGHT/$WIDTH*$XSIZE" | bc -l`
285 endif
286
287 echo " *** SIZE X,Y: $XSIZE $YSIZE"
288 set SIZE = "-JX$XSIZE/$YSIZE" # put - before axis to flip, also values to be multiple by -
289 #set SIZE = "-JX17"
290
291
292 ### First plot background if requested.
293 if ( $DOBG ) then
294 echo " *** Making background plot of magnitude image"
295 set SUBX = "1"
296 set SUBY = "1"
297 echo " *** Total number of pixels: $NUMPIXS"
298 # try to limit tmp GRDFILE to 10MB (2.500.000 binary float pixels)
299 if ( $NUMPIXS > 100000000 ) then # eg. 25.000 * 5.000
300 set SUBY = "15" # else > 10MB tmpfile
301 set SUBX = "3" # else > 10MB tmpfile
302 else if ( $NUMPIXS > 50000000 ) then # eg. 10.000 * 5000
303 set SUBY = "10" # else > 10MB tmpfile
304 set SUBX = "2" # else > 10MB tmpfile
305 else if ( $NUMPIXS > 12500000 ) then # eg. 1500 * 5000
306 set SUBY = "5"
307 endif
308 echo " *** Subsampling data with factors (x,y): $SUBX $SUBY"
309 #
310 ## echo creating magnitude file mag.raw
311 # Assume whole file to be plotted (else not possible for now, call from doris)
312 #set PROG = "cpxfiddle -w$WIDTH -f$SLCFORMAT -qmag -e0.2 -ofloat\
313 # -l$L0 -L$LN -p$P0 -P$PN -S$SUBX/$SUBY -- $SLCFILE"
314 set PROG = "cpxfiddle -w$WIDTH -f$SLCFORMAT -qmag -e0.2 -ofloat -M$SUBX/$SUBY -- $SLCFILE"
315
316 # correct for GMT, subsampling output = ceil ((P-p+1)/sub)
317 #set RANGE = "-R$FIRSTPIXEL/$LASTPIXEL/$FIRSTLINE/$LASTLINE"
318 # outputlines after subsampling = ceil((P-p+1)/sub)
319 #subsampling
320 #set NUMX = `echo "$P0 $PN $SUBX" | $AWK '{printf "%i", ($2-$1)/$3+1}'`
321 #set NUMY = `echo "$L0 $LN $SUBY" | $AWK '{printf "%i", ($2-$1)/$3+1}'`
322
323 #multilooking
324 set NUMX = `echo "$P0 $PN $SUBX" | $AWK '{print int ( ( $2 - $1 + 1 ) / $3 )}'`
325 set NUMY = `echo "$L0 $LN $SUBY" | $AWK '{print int ( ( $2 - $1 + 1 ) / $3 )}'`
326 echo " *** Number of output pixels (x,y): $NUMX $NUMY"
327
328 set EAST = `echo "$P0+($NUMX-1)*$SUBX" | bc -l`
329 set NORTH = `echo "$L0+($NUMY-1)*$SUBY" | bc -l`
330 set BKRANGE = "-R$P0/$EAST/$L0/$NORTH"
331 echo " *** GMT range: $BKRANGE"
332
333 set GRDFILE = $$.grd
334 set INC = "-I$SUBX/$SUBY"
335 set IFORMAT = "-Zf" # binary float values
336 echo " *** Calling:"\\n" $PROG | xyz2grd -G$GRDFILE $BKRANGE $INC $IFORMAT"
337 $PROG | xyz2grd -G$GRDFILE $BKRANGE $INC $IFORMAT
338 #
339 echo " *** Making (continuous) cpt table"
340 set CPTFILE = $$.cpt
341 set CPTNAME = gray
342 echo " *** Calling:"\\n" grd2cpt $GRDFILE -C$CPTNAME >! $CPTFILE"
343 grd2cpt $GRDFILE -C$CPTNAME >! $CPTFILE
344 #
345 # mirror grd file in horizontal plane
346 set BKSIZE = "-JX$XSIZE/-$YSIZE"
347 echo " *** GMT range option: $BKSIZE"
348 echo " *** Calling:"\\n" grdimage $GRDFILE $BKSIZE -C$CPTFILE -P -K >! $OFILE2"
349 grdimage $GRDFILE $BKSIZE -C$CPTFILE -P -K >! $OFILE2
350 # Tidy tidy tidy
351 echo " *** Removing grd and cpt file: $GRDFILE $CPTFILE"
352 rm -f $GRDFILE
353 rm -f $CPTFILE
354 # Set Overlay for next
355 set GMTFLAGS = "-O"
356 else
357 set GMTFLAGS = ""
358 endif
359
360
361 ### Add rescaled wtests to plot as normalized ellips.
362 echo " *** Plotting normalized w tests"\
363 " Semi major/minor are interchanged for visibility"
364 # Find out maximum wtest (both directions).
365 @ MAXW1=`$AWK 'BEGIN{m=$9}{{if ( $9 > m ){m = $9}}{if ( $10 > m ){m = $10}}}END{print int ( m )}'<$TMPFILE`
366 # size is scale=1.5 +0.2... -> 2.2 cm largest
367 set GMTFLAGS = "$GMTFLAGS -K -N $RANGE $SIZE -Se -W3/0/255/0 -Y5"
368 #$AWK -v s=$MAXW1 \
369 # '{scale=1.5/s} \
370 # {printf "%.1f %.1f 0 %.2f %.2f\n", $2, $3, 0.2+scale*$9, 0.2+scale*$10}' \
371 # $TMPFILE | \
372 # psxy $GMTFLAGS >> $OFILE2
373 $AWK '{scale = 1.5/'$MAXW1'} \
374 {printf "%.1f %.1f 0 %.2f %.2f\n", $2, $3, 0.2 + scale * $9, 0.2 + scale * $10}' \
375 $TMPFILE | \
376 psxy $GMTFLAGS >> $OFILE2
377
378
379 ### Plot the location crosses.
380 #/set GMTFLAGS = "-K -O -N $RANGE $FRAME $SIZE -U -Sx0.4 -W6/255/0/0"
381 set GMTFLAGS = "-K -O -N $RANGE $FRAME $SIZE -U -Sx0.2 -W6/255/0/0"
382 $AWK '{print $2, $3}' $TMPFILE | psxy $GMTFLAGS >> $OFILE2
383
384
385 if ( "1" == "2" ) then
386 ### Plot normalized offset vectors.
387 # -G fill
388 # -Sv arrowwidth/headlength/headwidth [0.075/0.3/0.25]
389 set GMTFLAGS = "-K -O -N $RANGE $SIZE -Sv0.04/0.25/0.125 -G0/0/255 -W2/0/0/0"
390 set MEANL = `$AWK '{s += $4}END{print int ( ( s / NR ) )}'<$TMPFILE` # old fashion normalization
391 set MEANP = `$AWK '{s += $5}END{print int ( ( s / NR ) )}'<$TMPFILE` # old fashion normalization
392 echo "MEAN L P : $MEANL $MEANP"
393 # set WL = $MEANL
394 # set WP = $MEANP
395 # MA new normalization
396 set MAXL=`$AWK '(NR==1){m = $4 }{if ( $4 > m ) m = $4 }END{print m }'<$TMPFILE`
397 set MINL=`$AWK '(NR==1){m = $4 }{if ( $4 < m ) m = $4 }END{print m }'<$TMPFILE`
398 set MAXP=`$AWK '(NR==1){m = $5 }{if ( $5 > m ) m = $5 }END{print m }'<$TMPFILE`
399 set MINP=`$AWK '(NR==1){m = $5 }{if ( $5 < m ) m = $5 }END{print m }'<$TMPFILE`
400 echo "MAXMIN L P : $MAXL $MINL $MAXP $MINP "
401 set WL = `$AWK 'BEGIN{ print '$MINL' }' `
402 set WP = `$AWK 'BEGIN{ print '$MINP' }' `
403 set NFL = `$AWK 'BEGIN{ print '$MAXL' - '$MINL' }' `
404 set NFP = `$AWK 'BEGIN{ print '$MAXP' - '$MINP' }' `
405
406 # plot arrows as they are, normalized by max length ? (always longest==3cm?)
407 #no cause then offset 1000 <> 1001 is no difference while it is the same as 10<>11
408 # thus scale length by l-max
409 #$AWK -v wl=$WL -v wp=$WP \
410 # '{ \
411 # {l=$4-wl-1} \
412 # {p=$5-wp-1} \
413 #$AWK '{ {l = $4 - '$WL' - 1.0} {p = $5 - '$WP' - 1.0} \ # old fashion normalization
414 #$AWK '{ {l = $4 -402 } \
415 # {p = $5 -25 } \
416 # $AWK '{ {l = $4 -'$MEANL' } \
417 # {p = $5 -'$MEANP' } \
418 # most of the displayment is on range so unit vector for azimuth
419 #$AWK '{ {l = ($4 - '$WL')/'$NFL' } \
420 # {p = ($5 - '$WP')/'$NFP'*('$NFP'/'$NFL') } \
421 $AWK '{ {l = $4 -'$MEANL' } \
422 {p = $5 -'$MEANP' } \
423 {l = l + 0.0000001} {p = p + 0.0000001} \
424 {dir = 57.3 * atan2 ( l , p )} \
425 {scale = 1} \
426 {len = scale * sqrt ( l * l + p * p )} \
427 {printf "%.1f %.1f %.1f %.1f\n", $2, $3, dir, len} \
428 }' \
429 $TMPFILE | \
430 #$TMPFILE > dump.txt && cat dump.txt | \
431 psxy $GMTFLAGS >> $OFILE2
432
433 else
434
435 ### Plot error vectors, offset vectors can be plotted with 'plotoffsets'.
436 # -G fill
437 # -Sv arrowwidth/headlength/headwidth [0.075c/0.3c/0.25c]
438 set GMTFLAGS = "-K -O -N $RANGE $SIZE -Sv0.04/0.25/0.125 -G0/0/255 -W2/0/0/0"
439 # MA new normalization
440 set MAXL=`$AWK '(NR==1){m = $7 }{if ( $7 > m ) m = $7 }END{print m }'<$TMPFILE`
441 set MINL=`$AWK '(NR==1){m = $7 }{if ( $7 < m ) m = $7 }END{print m }'<$TMPFILE`
442 set MAXP=`$AWK '(NR==1){m = $8 }{if ( $8 > m ) m = $8 }END{print m }'<$TMPFILE`
443 set MINP=`$AWK '(NR==1){m = $8 }{if ( $8 < m ) m = $8 }END{print m }'<$TMPFILE`
444 echo "MAXMIN error of L P : $MAXL $MINL $MAXP $MINP "
445 set NFL = `$AWK 'BEGIN{ print '$MAXL' - '$MINL' }' `
446 set NFP = `$AWK 'BEGIN{ print '$MAXP' - '$MINP' }' `
447 # plot arrows as they are, normalized by max length ? (always longest==3cm?)
448 $AWK '{ \
449 {l = $7} \
450 {p = $8} \
451 {l = l + 0.0000001} {p = p + 0.0000001} \
452 {dir = 57.3 * atan2 ( l , p )} \
453 {scale = 1} \
454 {len = scale * sqrt ( l * l + p * p )} \
455 {printf "%.1f %.1f %.1f %.1f\n", $2, $3, dir, len} \
456 }' \
457 $TMPFILE | \
458 psxy $GMTFLAGS >> $OFILE2
459
460 # Plot unit vectors at the side
461 echo " Adding unit error vectors in lower left corner."
462 # set GMTFLAGS = "-N -O -K $RANGE $SIZE -Sv0.04/0.25/0.125 -G255/0/255 -W2/255/0/255"
463 set GMTFLAGS = "-N -O $RANGE $SIZE -Sv0.04/0.25/0.125 -G255/0/255 -W2/255/0/255"
464 #### l p err_l err_p
465 echo "$L0 $P0 1 0" | \
466 $AWK '{{l = $3 + 0.0000001}{p = $4 + 0.0000001}{dir = 57.3 * atan2 ( l , p )} \
467 {scale = 1} {len = scale * sqrt ( l * l + p * p )} \
468 {printf "%.1f %.1f %.1f %.1f\n", $1, $2, dir, len} \
469 }' | psxy $GMTFLAGS -K >> $OFILE2
470 echo "$L0 $P0 0 1" | \
471 $AWK '{{l = $3 + 0.0000001}{p = $4 + 0.0000001}{dir = 57.3 * atan2 ( l , p )} \
472 {scale = 1} {len = scale * sqrt ( l * l + p * p )} \
473 {printf "%.1f %.1f %.1f %.1f\n", $1, $2, dir, len} \
474 }' | psxy $GMTFLAGS >> $OFILE2
475 endif
476
477
478 ### Add the window numbers (last call).
479 ##pstext: (x, y, size(pts), angle(ccw), fontno, justify, text)
480 ##set GMTFLAGS = "-O -N -G0/255/0 $RANGE $SIZE"
481 set GMTFLAGS = "-O -N -G0/0/0 $RANGE $SIZE"
482 ##green, 14pts, RightTop BottomLeft
483 echo "## dont print point labels now!"
484 #$AWK '{printf "%.1f %.1f 10 0 0 RT %s\n", $2, $3, $1}' $TMPFILE | \
485 # pstext $GMTFLAGS >> $OFILE2
486
487 # view postscript in background, delete it afterwards, continue script.
488 viewanddel $OFILE2 &
489
490
491
492 ### Figure 3 : histogram of errors in azimuth, range
493 echo " +++ Plotting histograms of least squares errors +++"
494 set TITLE = "Error_histogram_Azimuth_direction"
495 set XLABEL = "Error"
496 set YLABEL = "frequency"
497 #set GMTFLAGS = "-K -JX10/5 -U -W0.1 -C -B0.1/5:"$XLABEL":/.1:"$YLABEL"::."$TITLE": -P -G0/0/255"
498 set GMTFLAGS = "-K "$PROJ" -U -W0.1 -F -B0.1:"$XLABEL":/.1:"$YLABEL"::."$TITLE": -P -G0/0/255"
499 $AWK '{print $7}' $TMPFILE | pshistogram $GMTFLAGS > $OFILE3
500 ### range
501 set TITLE = "Error_histogram_Range_direction"
502 # set GMTFLAGS = "-O -Y10 -JX10/5 -C -W0.1 -B0.1/5:"":/.1:"$YLABEL"::."$TITLE": -P -G0/0/255"
503 set GMTFLAGS = "-O -Y14 "$PROJ" -F -W0.1 -B0.1:"$XLABEL":/.1:"$YLABEL"::."$TITLE": -P -G0/0/255"
504 $AWK '{print $8}' $TMPFILE | pshistogram $GMTFLAGS >> $OFILE3
505 viewanddel $OFILE3 &
506
507 ### Tidy up
508 rm -f $TMPFILE
509 echo " +++ Finished: $PRG +++"\\n
510 exit 0
511
512 ### EOF
513