Debian Codegraph @

bin/plotcpm

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 offsets in 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 offsets in 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 = "offset_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 # [LEN] tcsh produces integer overflow with large files
257 set SIZECR4 = ` awk 'BEGIN{print '$WIDTH' * '$HEIGHT' * 8}' `
258 set FSIZE = `ls -l $SLCFILE | $AWK '{print $6}'`
259 if ( $FSIZE == $SIZECI2 ) then
260 echo " *** File format ${SLCFILE}: complex short."
261 set SLCFORMAT = ci2
262 else if ( $FSIZE == $SIZECR4 ) then
263 echo " *** File format ${SLCFILE}: complex float."
264 set SLCFORMAT = cr4
265 else
266 echo " *** Sorry, no background, file format could not be determined."
267 set DOBG = "0"
268 endif
269 endif
270
271 # GMT
272 @ TICKSL = $HEIGHT / 7
273 @ TICKSP = $WIDTH / 7
274 set RANGE = "-P -: -R$P0/$PN/$L0/$LN"
275 set FRAME = "-B"$TICKSP":"$YLABEL":/"$TICKSL":"$XLABEL"::."$TITLE":"
276 set XSIZE = "21"
277 set YSIZE = "0"
278 # size paper, largest size $XSIZE
279 # strict stretching ERS1/2 only...
280 @ HEIGHT = $HEIGHT / 5
281 if ( $HEIGHT > $WIDTH ) then
282 set YSIZE = $XSIZE
283 set XSIZE = `echo "scale=3; $WIDTH/$HEIGHT*$YSIZE" | bc -l`
284 else
285 set YSIZE = `echo "scale=3; $HEIGHT/$WIDTH*$XSIZE" | bc -l`
286 endif
287
288 echo " *** SIZE X,Y: $XSIZE $YSIZE"
289 set SIZE = "-JX$XSIZE/$YSIZE" # put - before axis to flip, also values to be multiple by -
290 #set SIZE = "-JX17"
291
292
293 ### First plot background if requested.
294 if ( $DOBG ) then
295 echo " *** Making background plot of magnitude image"
296 set SUBX = "1"
297 set SUBY = "1"
298 echo " *** Total number of pixels: $NUMPIXS"
299 # try to limit tmp GRDFILE to 10MB (2.500.000 binary float pixels)
300 if ( $NUMPIXS > 100000000 ) then # eg. 25.000 * 5.000
301 set SUBY = "15" # else > 10MB tmpfile
302 set SUBX = "3" # else > 10MB tmpfile
303 else if ( $NUMPIXS > 50000000 ) then # eg. 10.000 * 5000
304 set SUBY = "10" # else > 10MB tmpfile
305 set SUBX = "2" # else > 10MB tmpfile
306 else if ( $NUMPIXS > 12500000 ) then # eg. 1500 * 5000
307 set SUBY = "5"
308 endif
309 echo " *** Subsampling data with factors (x,y): $SUBX $SUBY"
310 #
311 ## echo creating magnitude file mag.raw
312 # Assume whole file to be plotted (else not possible for now, call from doris)
313 #set PROG = "cpxfiddle -w$WIDTH -f$SLCFORMAT -qmag -e0.2 -ofloat\
314 # -l$L0 -L$LN -p$P0 -P$PN -S$SUBX/$SUBY -- $SLCFILE"
315 set PROG = "cpxfiddle -w$WIDTH -f$SLCFORMAT -qmag -e0.2 -ofloat -M$SUBX/$SUBY -- $SLCFILE"
316
317 # correct for GMT, subsampling output = ceil ((P-p+1)/sub)
318 #set RANGE = "-R$FIRSTPIXEL/$LASTPIXEL/$FIRSTLINE/$LASTLINE"
319 # outputlines after subsampling = ceil((P-p+1)/sub)
320 #subsampling
321 #set NUMX = `echo "$P0 $PN $SUBX" | $AWK '{printf "%i", ($2-$1)/$3+1}'`
322 #set NUMY = `echo "$L0 $LN $SUBY" | $AWK '{printf "%i", ($2-$1)/$3+1}'`
323
324 #multilooking
325 set NUMX = `echo "$P0 $PN $SUBX" | $AWK '{print int ( ( $2 - $1 + 1 ) / $3 )}'`
326 set NUMY = `echo "$L0 $LN $SUBY" | $AWK '{print int ( ( $2 - $1 + 1 ) / $3 )}'`
327 echo " *** Number of output pixels (x,y): $NUMX $NUMY"
328
329 set EAST = `echo "$P0+($NUMX-1)*$SUBX" | bc -l`
330 set NORTH = `echo "$L0+($NUMY-1)*$SUBY" | bc -l`
331 set BKRANGE = "-R$P0/$EAST/$L0/$NORTH"
332 echo " *** GMT range: $BKRANGE"
333
334 set GRDFILE = $$.grd
335 set INC = "-I$SUBX/$SUBY"
336 set IFORMAT = "-Zf" # binary float values
337 echo " *** Calling:"\\n" $PROG | xyz2grd -G$GRDFILE $BKRANGE $INC $IFORMAT"
338 $PROG | xyz2grd -G$GRDFILE $BKRANGE $INC $IFORMAT
339 #
340 echo " *** Making (continuous) cpt table"
341 set CPTFILE = $$.cpt
342 set CPTNAME = gray
343 echo " *** Calling:"\\n" grd2cpt $GRDFILE -C$CPTNAME >! $CPTFILE"
344 grd2cpt $GRDFILE -C$CPTNAME >! $CPTFILE
345 #
346 # mirror grd file in horizontal plane
347 set BKSIZE = "-JX$XSIZE/-$YSIZE"
348 echo " *** GMT range option: $BKSIZE"
349 echo " *** Calling:"\\n" grdimage $GRDFILE $BKSIZE -C$CPTFILE -P -K >! $OFILE2"
350 grdimage $GRDFILE $BKSIZE -C$CPTFILE -P -K >! $OFILE2
351 # Tidy tidy tidy
352 echo " *** Removing grd and cpt file: $GRDFILE $CPTFILE"
353 rm -f $GRDFILE
354 rm -f $CPTFILE
355 # Set Overlay for next
356 set GMTFLAGS = "-O"
357 else
358 set GMTFLAGS = ""
359 endif
360
361
362 ### Add rescaled wtests to plot as normalized ellips.
363 echo " *** Plotting normalized w tests"\
364 " Semi major/minor are interchanged for visibility"
365 # Find out maximum wtest (both directions).
366 @ MAXW1=`$AWK 'BEGIN{m=$9}{{if ( $9 > m ){m = $9}}{if ( $10 > m ){m = $10}}}END{print int ( m )}'<$TMPFILE`
367 # size is scale=1.5 +0.2... -> 2.2 cm largest
368 set GMTFLAGS = "$GMTFLAGS -K -N $RANGE $SIZE -Se -W3/0/255/0 -Y5"
369 #$AWK -v s=$MAXW1 \
370 # '{scale=1.5/s} \
371 # {printf "%.1f %.1f 0 %.2f %.2f\n", $2, $3, 0.2+scale*$9, 0.2+scale*$10}' \
372 # $TMPFILE | \
373 # psxy $GMTFLAGS >> $OFILE2
374 $AWK '{scale = 1.5/'$MAXW1'} \
375 {printf "%.1f %.1f 0 %.2f %.2f\n", $2, $3, 0.2 + scale * $9, 0.2 + scale * $10}' \
376 $TMPFILE | \
377 psxy $GMTFLAGS >> $OFILE2
378
379
380 ### Plot the location crosses.
381 #/set GMTFLAGS = "-K -O -N $RANGE $FRAME $SIZE -U -Sx0.4 -W6/255/0/0"
382 set GMTFLAGS = "-K -O -N $RANGE $FRAME $SIZE -U -Sx0.2 -W6/255/0/0"
383 $AWK '{print $2, $3}' $TMPFILE | psxy $GMTFLAGS >> $OFILE2
384
385
386 if ( "1" == "1" ) then
387 ### Plot normalized offset vectors.
388 # -G fill
389 # -Sv arrowwidth/headlength/headwidth [0.075/0.3/0.25]
390 set GMTFLAGS = "-K -O -N $RANGE $SIZE -Sv0.04/0.25/0.125 -G0/0/255 -W2/0/0/0"
391 set MEANL = `$AWK '{s += $4}END{print int ( ( s / NR ) )}'<$TMPFILE` # old fashion normalization
392 set MEANP = `$AWK '{s += $5}END{print int ( ( s / NR ) )}'<$TMPFILE` # old fashion normalization
393 echo "MEAN L P : $MEANL $MEANP"
394 # set WL = $MEANL
395 # set WP = $MEANP
396 # MA new normalization
397 set MAXL=`$AWK '(NR==1){m = $4 }{if ( $4 > m ) m = $4 }END{print m }'<$TMPFILE`
398 set MINL=`$AWK '(NR==1){m = $4 }{if ( $4 < m ) m = $4 }END{print m }'<$TMPFILE`
399 set MAXP=`$AWK '(NR==1){m = $5 }{if ( $5 > m ) m = $5 }END{print m }'<$TMPFILE`
400 set MINP=`$AWK '(NR==1){m = $5 }{if ( $5 < m ) m = $5 }END{print m }'<$TMPFILE`
401 echo "MAXMIN L P : $MAXL $MINL $MAXP $MINP "
402 set WL = `$AWK 'BEGIN{ print '$MINL' }' `
403 set WP = `$AWK 'BEGIN{ print '$MINP' }' `
404 set NFL = `$AWK 'BEGIN{ print '$MAXL' - '$MINL' }' `
405 set NFP = `$AWK 'BEGIN{ print '$MAXP' - '$MINP' }' `
406
407 # plot arrows as they are, normalized by max length ? (always longest==3cm?)
408 #no cause then offset 1000 <> 1001 is no difference while it is the same as 10<>11
409 # thus scale length by l-max
410 #$AWK -v wl=$WL -v wp=$WP \
411 # '{ \
412 # {l=$4-wl-1} \
413 # {p=$5-wp-1} \
414 #$AWK '{ {l = $4 - '$WL' - 1.0} {p = $5 - '$WP' - 1.0} \ # old fashion normalization
415 #$AWK '{ {l = $4 -402 } \
416 # {p = $5 -25 } \
417 # $AWK '{ {l = $4 -'$MEANL' } \
418 # {p = $5 -'$MEANP' } \
419 # most of the displayment is on range so unit vector for azimuth
420 #$AWK '{ {l = ($4 - '$WL')/'$NFL' } \
421 # {p = ($5 - '$WP')/'$NFP'*('$NFP'/'$NFL') } \
422 $AWK '{ {l = $4 -'$MEANL' } \
423 {p = $5 -'$MEANP' } \
424 {l = l + 0.0000001} {p = p + 0.0000001} \
425 {dir = 57.3 * atan2 ( l , p )} \
426 {scale = 1} \
427 {len = scale * sqrt ( l * l + p * p )} \
428 {printf "%.1f %.1f %.1f %.1f\n", $2, $3, dir, len} \
429 }' \
430 $TMPFILE | \
431 #$TMPFILE > dump.txt && cat dump.txt | \
432 psxy $GMTFLAGS >> $OFILE2
433
434 else
435
436 ### Plot error vectors, offset vectors can be plotted with 'plotoffsets'.
437 # -G fill
438 # -Sv arrowwidth/headlength/headwidth [0.075c/0.3c/0.25c]
439 set GMTFLAGS = "-K -O -N $RANGE $SIZE -Sv0.04/0.25/0.125 -G0/0/255 -W2/0/0/0"
440 # MA new normalization
441 set MAXL=`$AWK '(NR==1){m = $7 }{if ( $7 > m ) m = $7 }END{print m }'<$TMPFILE`
442 set MINL=`$AWK '(NR==1){m = $7 }{if ( $7 < m ) m = $7 }END{print m }'<$TMPFILE`
443 set MAXP=`$AWK '(NR==1){m = $8 }{if ( $8 > m ) m = $8 }END{print m }'<$TMPFILE`
444 set MINP=`$AWK '(NR==1){m = $8 }{if ( $8 < m ) m = $8 }END{print m }'<$TMPFILE`
445 echo "MAXMIN offset of L P : $MAXL $MINL $MAXP $MINP "
446 set NFL = `$AWK 'BEGIN{ print '$MAXL' - '$MINL' }' `
447 set NFP = `$AWK 'BEGIN{ print '$MAXP' - '$MINP' }' `
448 # plot arrows as they are, normalized by max length ? (always longest==3cm?)
449 $AWK '{ \
450 {l = $7} \
451 {p = $8} \
452 {l = l + 0.0000001} {p = p + 0.0000001} \
453 {dir = 57.3 * atan2 ( l , p )} \
454 {scale = 1} \
455 {len = scale * sqrt ( l * l + p * p )} \
456 {printf "%.1f %.1f %.1f %.1f\n", $2, $3, dir, len} \
457 }' \
458 $TMPFILE | \
459 psxy $GMTFLAGS >> $OFILE2
460
461 # Plot unit vectors at the side
462 echo " Adding unit offset vectors in lower left corner."
463 # set GMTFLAGS = "-N -O -K $RANGE $SIZE -Sv0.04/0.25/0.125 -G255/0/255 -W2/255/0/255"
464 set GMTFLAGS = "-N -O $RANGE $SIZE -Sv0.04/0.25/0.125 -G255/0/255 -W2/255/0/255"
465 #### l p err_l err_p
466 echo "$L0 $P0 1 0" | \
467 $AWK '{{l = $3 + 0.0000001}{p = $4 + 0.0000001}{dir = 57.3 * atan2 ( l , p )} \
468 {scale = 1} {len = scale * sqrt ( l * l + p * p )} \
469 {printf "%.1f %.1f %.1f %.1f\n", $1, $2, dir, len} \
470 }' | psxy $GMTFLAGS -K >> $OFILE2
471 echo "$L0 $P0 0 1" | \
472 $AWK '{{l = $3 + 0.0000001}{p = $4 + 0.0000001}{dir = 57.3 * atan2 ( l , p )} \
473 {scale = 1} {len = scale * sqrt ( l * l + p * p )} \
474 {printf "%.1f %.1f %.1f %.1f\n", $1, $2, dir, len} \
475 }' | psxy $GMTFLAGS >> $OFILE2
476 endif
477
478
479 ### Add the window numbers (last call).
480 ##pstext: (x, y, size(pts), angle(ccw), fontno, justify, text)
481 ##set GMTFLAGS = "-O -N -G0/255/0 $RANGE $SIZE"
482 set GMTFLAGS = "-O -N -G0/0/0 $RANGE $SIZE"
483 ##green, 14pts, RightTop BottomLeft
484 echo "## dont print point labels now!"
485 #$AWK '{printf "%.1f %.1f 10 0 0 RT %s\n", $2, $3, $1}' $TMPFILE | \
486 # pstext $GMTFLAGS >> $OFILE2
487
488 # view postscript in background, delete it afterwards, continue script.
489 viewanddel $OFILE2 &
490
491
492
493 ### Figure 3 : histogram of offsets in azimuth, range
494 echo " +++ Plotting histograms of least squares offsets +++"
495 set TITLE = "Error_histogram_Azimuth_direction"
496 set XLABEL = "Error"
497 set YLABEL = "frequency"
498 #set GMTFLAGS = "-K -JX10/5 -U -W0.1 -C -B0.1/5:"$XLABEL":/.1:"$YLABEL"::."$TITLE": -P -G0/0/255"
499 set GMTFLAGS = "-K "$PROJ" -U -W0.1 -F -B0.1:"$XLABEL":/.1:"$YLABEL"::."$TITLE": -P -G0/0/255"
500 $AWK '{print $7}' $TMPFILE | pshistogram $GMTFLAGS > $OFILE3
501 ### range
502 set TITLE = "Error_histogram_Range_direction"
503 # set GMTFLAGS = "-O -Y10 -JX10/5 -C -W0.1 -B0.1/5:"":/.1:"$YLABEL"::."$TITLE": -P -G0/0/255"
504 set GMTFLAGS = "-O -Y14 "$PROJ" -F -W0.1 -B0.1:"$XLABEL":/.1:"$YLABEL"::."$TITLE": -P -G0/0/255"
505 $AWK '{print $8}' $TMPFILE | pshistogram $GMTFLAGS >> $OFILE3
506 viewanddel $OFILE3 &
507
508 ### Tidy up
509 rm -f $TMPFILE
510 echo " +++ Finished: $PRG +++"\\n
511 exit 0
512
513 ### EOF
514