-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_bbk.c
776 lines (656 loc) · 29.9 KB
/
run_bbk.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
// %P%
// ----- constants ---------------------------------------------------
static const char SCCSID[]="$Id: run_bbk.c 108316 2019-03-06 20:34:17Z bruce.tran $ 20$Date: 2010/02/17 18:24:48 $ NGS";
static const int DEBUG = 0; // diagnostics print if != 0
static char final_header1[]= "Basic Statistics: ";
static char final_header2[]=
"Val AVE Sigma Minim. Lat of Min Lon of Min Maxim. Lat of Max Lon of Max";
static char final_header3[]=
" (sec) (sec) (sec) (dec deg) (dec deg) (sec) (dec deg) (dec deg)";
// ----- standard library --------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h> // M_PI
// ----- classes, structs, types -------------------------------------
#include "grid_header.h"
// ----- functions ---------------------------------------------------
#include "run_bbk.h"
#include "getheaders.h"
#include "bb80ll.h"
#include "interg.h"
#include "which_defl.h"
void run_bbk(FILE* ifp, FILE* ofp,
FILE** vec_xifp, FILE** vec_eifp, GRID_HEADER vec_hdr[50],
char vec_xfnames[50][256], int nfiles, int imodel) {
/*******************************************************************************
* in - ifp : input bluebook file
* in - ofp : output bluebook file, optional
* in - vec_xifp : vector of file ptrs, pointing to Xi data files
* in - vec_eifp : vector of file ptrs, pointing to Eta data files
* in - vec_hdr : vector of header data (same for Xi and Eta data files)
* in - nfiles :
* in - imodel : user specified geoid model
* INPUT FILE, BLUE BOOK FORMAT
* Spin through the blue book file, stopping at each * *80* record,
* and while there, look forward to the next records to see
* if there is an *86* * record.
* If so, overwrite the geoid field in it with an interpolated value.
* If not, create an *86* record.
*
* Read one line, and if it is NOT an *84* record,
* replicate it immediately into the output file (if we're using one).
* If the record is not an *80* record,
* come back and get a new record.
*******************************************************************************/
int jjj = 0;
int kount = 0;
int keep = 0;
double xn = -90.0;
double xs = 90.0;
double xw = 360.0;
double xe = 0.0;
double minx = 1000.0;
double mine = 1000.0;
double minh = 1000.0;
double maxx = -1000.0;
double maxe = -1000.0;
double maxh = -1000.0;
double avex = 0.0;
double avee = 0.0;
double aveh = 0.0;
double stdx = 0.0;
double stde = 0.0;
double stdh = 0.0;
double rmsx = 0.0;
double rmse = 0.0;
double rmsh = 0.0;
double minlatx = 90.0;
double minlate = 90.0;
double minlath = 90.0;
double maxlatx = -90.0;
double maxlate = -90.0;
double maxlath = -90.0;
double minlonx = 360.0;
double minlone = 360.0;
double minlonh = 360.0;
double maxlonx = 0.0;
double maxlone = 0.0;
double maxlonh = 0.0;
double fact;
char card[90];
char card2[90];
char card85[90];
double xlat; // lat of point in question - decdeg
double xlon; // lon of point in question - decdeg
double valx; // interpolated value, Xi
double vale; // interpolated value, Eta
double valh; // calculated value, Laplace
char dirxi[2]; // Xi hemisphere
char direta[2]; // Eta hemisphere
int ixi = 0; // Xi for output
int ieta = 0; // Eta for output
int poseast = 0; // longitude Hemisphere toggle
int kk = 0;
char bbcode;
strncpy(card, "\0", 90);
strncpy(card2, "\0", 90);
strncpy(card85, "\0", 90);
strncpy(dirxi, "\0", 2);
strncpy(direta, "\0", 2);
// Spin through the blue book file, stopping at each *80* record,
// and while there, look forward to the next records
// to see if there is an *85* record.
// If so, overwrite the geoid field in it with an interpolated value.
// If not, create an *85* record.
while( fgets(card, 90, ifp) ) {
// Read one line, and if it is NOT an *84* record,
// replicate it immediately into the output file (if we're using one).
// If the record is not an *80* record, come back and get a new record.
if( (strncmp(&card[7], "83", 2) == 0)
|| (strncmp(&card[7], "84", 2) == 0)) {
continue;
} else
if (ofp) {
fprintf(ofp, "%s", card);
}
if (strncmp(&card[7], "80", 2) != 0) {
continue;
} else {
// Arriving here, we have an *80* record as 'card'
// Get the lat/lon value from the *80* record
bb80ll(card, &xlat, &xlon);
if (DEBUG != 0) {
printf("card = \n%s\n", card);
printf("xlat = %lf xlon = %lf\n", xlat, xlon);
printf("card[68] = %c \n", card[68]);
}
if (card[68] == 'W') {
poseast = 0; // 0 := false
xlon = 360.0 - xlon;
}
if (DEBUG != 0) {
printf("xlat = %lf xlon = %lf\n", xlat, xlon);
}
// If the xlat/xlon values are bad, don't do an interpolation.
// Just move on to the next record...any existing *86*
// record associated with this erroneous *80* record will
// remain unmodified.
if (xlat == -999.0 || xlon == -999.0) continue;
// Arriving here, the *80* record has a good lat/lon value
++kount;
// The associated *85* record, if it exists, must
// come AFTER the *80* record we're currently looking at,
// and the ONLY thing allowed between the 80 and 85 record
// are 81 and 82 records (83 and 84 records will be deleted).
jjj = 0;
while (jjj == 0) {
strncpy(card2, "\0", 90);
fgets(card2, 90, ifp);
if (DEBUG != 0) printf("card2 = \n%s\n", card2);
// POSSIBILITY 1: We find an *83* or *84* record
// ACTION: Do not allow it to go into the output file, and
// go back for another "card2" value
if( (strncmp(&card2[7], "83", 2) == 0)
|| (strncmp(&card2[7], "84", 2) == 0) ) {
continue;
}
// POSSIBILITY 2: We find an *81* or *82* record
// ACTION: Replicate this record into the output file
// and go back for another "card2" value
if( (strncmp(&card2[7], "81", 2) == 0)
|| (strncmp(&card2[7], "82", 2) == 0) ) {
fprintf(ofp, "%s", card2);
continue;
}
// POSSIBILITY 3: We find an *85* record
// ACTION: a) Modify it if it's the right *85* record
// b) If it is the wrong *85* record,
// delete it and make a NEW *85* record, and
// then go back and get another "card2" value
if( (strncmp(&card2[7], "85", 2)) == 0) {
if( (strncmp(&card[10], &card2[10], 4)) == 0) {
if (DEBUG != 0) { printf("match 80 and 85"); }
// Arriving here, we've found the *85* record
// associated with the *80* record
// Find which geoid file to use, based on lat/lon
kk = which_defl(xlat, xlon, nfiles, kk, imodel, vec_xfnames,
vec_hdr, vec_xifp );
if (DEBUG != 0) printf("After which_defl kk = %d\n", kk);
if (kk == -1) {
// If not in any grid area, set to -999
valx = -999;
vale = -999;
valh = -999;
} else {
// Otherwise, do the interpolation
// Interpolate Xi
valx = interg(xlat, xlon, vec_hdr, vec_xifp, kk);
if (DEBUG != 0) printf("Xi = %lf \n", valx);
// Interpolate Eta
vale = interg(xlat, xlon, vec_hdr, vec_eifp, kk);
if (DEBUG != 0) printf("Eta = %lf \n", vale);
// Calculate the Horizontal Laplace correction
valh = -tan(xlat * M_PI / 180.0) * vale;
if (DEBUG != 0) { printf("Lap = %lf \n", valh); }
++keep;
avex += valx;
avee += vale;
aveh += valh;
rmsx += (valx*valx);
rmse += (vale*vale);
rmsh += (valh*valh);
if (xlat > xn) xn = xlat;
if (xlat < xs) xs = xlat;
if (xlon > xe) xe = xlon;
if (xlon < xw) xw = xlon;
if (valx < minx) {
minx = valx;
minlatx = xlat;
minlonx = xlon;
}
if (valx > maxx) {
maxx = valx;
maxlatx = xlat;
maxlonx = xlon;
}
if (vale < minx) {
mine = vale;
minlate = xlat;
minlone = xlon;
}
if (vale > maxe) {
maxe = vale;
maxlate = xlat;
maxlone = xlon;
}
if (valh < minh) {
minh = valh;
minlath = xlat;
minlonh = xlon;
}
if (valh > maxh) {
maxh = valh;
maxlath = xlat;
maxlonh = xlon;
}
// Modify the *85* record and write it out
// Find the right deflection code
if(imodel == 1) {
strncpy( &card2[20], "DEFLEC99", 8);
bbcode = 'A';
}
else if(imodel == 3) {
strncpy( &card2[20], "DEFLEC09", 8);
bbcode = 'E';
}
else if(imodel == 5) {
strncpy( &card2[20], "DEFLEC12A", 9);
bbcode = 'W';
}
else if(imodel == 6) {
strncpy( &card2[20], "DEFLEC12B", 9);
bbcode = 'X';
}
else if(imodel == 7) {
strncpy( &card2[20], "DEFLEC18", 8);
bbcode = 'Y';
}
card2[62] = bbcode;
// strcpy(&card2[30], b33);
ixi = (int)( floor(valx*100.0 + 0.5) );
ieta = (int)( floor(vale*100.0 + 0.5) );
if (ofp) {
if (ixi >= 0.0) strcpy(dirxi, "N");
else strcpy(dirxi, "S");
if (ieta >= 0.0) strcpy(direta, "E");
else strcpy(direta, "W");
fprintf(ofp, "%-62s%5d%1s000%5d%1s000\n",
card2, abs(ixi), dirxi,
abs(ieta), direta);
}
++jjj;
// goto L137;
break; // go back, get "card"
}// if (kk == -1)
}//~if( strncmp(card2[11], card[11], 4) == 0 )
// If this is NOT the associated *85* record, delete
// it and make a new *85* record
else {
if (DEBUG != 0) { printf("NOT match 80 and 85"); }
// Find geoid file to use, based on input lat/lon
kk = which_defl(xlat, xlon, nfiles, kk, imodel, vec_xfnames,
vec_hdr, vec_xifp );
if (kk == -1) {
// If not in any grid area, set = -999
valx = -999;
vale = -999;
valh = -999;
} else {
// Otherwise, do the interpolation
// Interpolate Xi
valx = interg(xlat, xlon, vec_hdr, vec_xifp, kk );
if (DEBUG != 0) { printf("Xi = %lf \n", valx); }
// Interpolate Eta
vale = interg(xlat, xlon, vec_hdr, vec_eifp, kk );
if (DEBUG != 0) { printf("Eta = %lf \n", vale); }
// Calculate the Horizontal Laplace correction
valh = -tan(xlat * M_PI / 180.0) * vale;
if (DEBUG != 0) { printf("Lap = %lf \n", valh); }
keep += 1;
avex += valx;
avee += vale;
aveh += valh;
rmsx += (valx*valx);
rmse += (vale*vale);
rmsh += (valh*valh);
if (xlat > xn) xn = xlat;
if (xlat < xs) xs = xlat;
if (xlon > xe) xe = xlon;
if (xlon < xw) xw = xlon;
if (valx < minx) {
minx = valx;
minlatx = xlat;
minlonx = xlon;
}
if (valx > maxx) {
maxx = valx;
maxlatx = xlat;
maxlonx = xlon;
}
if (vale < mine) {
mine = vale;
minlate = xlat;
minlone = xlon;
}
if (vale > maxe) {
maxe = vale;
maxlate = xlat;
maxlone = xlon;
}
if (valh < minh) {
minh = valh;
minlath = xlat;
minlonh = xlon;
}
if (valh > maxh) {
maxh = valh;
maxlath = xlat;
maxlonh = xlon;
}
// Make a NEW *85* record and write it out
strncpy(card85, "\0", 90);
strcpy( card85, " *85*");
strncat(card85, &card[10], 4);
if (imodel == 1) {
strcat(card85, " DEFLEC99");
bbcode = 'A';
}
else if (imodel == 3) {
strcat(card85, " DEFLEC09");
bbcode = 'E';
}
else if(imodel == 5) {
strncpy( &card2[20], "DEFLEC12A", 9);
bbcode = 'W';
}
else if(imodel == 6) {
strncpy( &card2[20], "DEFLEC12B", 9);
bbcode = 'X';
}
else if(imodel == 7) {
strncpy( &card2[20], "DEFLEC18", 8);
bbcode = 'Y';
}
ixi = (int)(fabs(valx)*100.0 + 0.5);
ieta = (int)(fabs(vale)*100.0 + 0.5);
if (ofp) {
if (valx >= 0.0) strcpy(dirxi, "N");
else strcpy(dirxi, "S");
if (vale >= 0.0) strcpy(direta, "E");
else strcpy(direta, "W");
fprintf(ofp, "%-61s%c%5d%1s000%5d%1s000\n",
card85, bbcode, abs(ixi), dirxi,
abs(ieta), direta);
}
// Go back and look for the next "card" value
// Any *86* records which follow this *85* record
// will be passed into the output file
++jjj;
break;
}//~if (kk == -1) {
}//~if (card2.compare(11,4, card,11,4) == 0)
strncpy(card2, "\0", 90);
}//~if ( (strncmp(&card2[7], "85", 2)) == 0) {
// POSSIBILITY 4: We find something besides an 81,82,
// 83, 84 or 85 record
// ACTION: Create a new *85* based on the previous *80* record,
// print the new 85 record, then
// print the card2 record.
// was: and then transfer the new 'card2' into 'card' and
// was: go back just after the 'read' statement for 'card'
if( (strncmp(&card2[7], "81", 2) != 0)
&& (strncmp(&card2[7], "82", 2) != 0)
&& (strncmp(&card2[7], "83", 2) != 0)
&& (strncmp(&card2[7], "84", 2) != 0)
&& (strncmp(&card2[7], "85", 2) != 0) ) {
// Find geoid file to use, based on input lat/lon
kk = which_defl(xlat, xlon, nfiles, kk,imodel,vec_xfnames,vec_hdr,vec_xifp);
if (kk == -1) {
// If not in any of our grid areas, set to -999
valx = -999;
vale = -999;
valh = -999;
} else {
// Otherwise, do the interpolation
// Interpolate Xi
valx = interg(xlat, xlon, vec_hdr, vec_xifp, kk );
if (DEBUG != 0) printf("Xi = %lf \n", valx);
// Interpolate Eta
vale = interg(xlat, xlon, vec_hdr, vec_eifp, kk );
if (DEBUG != 0) printf("Eta = %lf \n", vale);
// Calculate the Horizontal Laplace correction
valh = -tan(xlat * M_PI / 180.0) * vale;
if (DEBUG != 0) { printf("Lap = %lf \n", valh); }
++keep;
avex += valx;
avee += vale;
aveh += valh;
rmsx += valx*valx;
rmse += vale*vale;
rmsh += valh*valh;
if (xlat > xn) xn = xlat;
if (xlat < xs) xs = xlat;
if (xlon > xe) xe = xlon;
if (xlon < xw) xw = xlon;
if (valx < minx) {
minx = valx;
minlatx = xlat;
minlonx = xlon;
}
if (valx > maxx) {
maxx = valx;
maxlatx = xlat;
maxlonx = xlon;
}
if (vale < mine) {
mine = vale;
minlate = xlat;
minlone = xlon;
}
if (vale > maxe) {
maxe = vale;
maxlate = xlat;
maxlone = xlon;
}
if (valh < minh) {
minh = valh;
minlath = xlat;
minlonh = xlon;
}
if (valh > maxh) {
maxh = valh;
maxlath = xlat;
maxlonh = xlon;
}
}
// Make a NEW *85* record
strncpy(card85, "\0", 90);
strcpy( card85, " *85*");
strncat(card85, &card[10], 4);
if (imodel == 1) {
strcat(card85, " DEFLEC99");
bbcode = 'A';
}
else if (imodel == 3) {
strcat(card85, " DEFLEC09");
bbcode = 'E';
}
else if(imodel == 5) {
strncpy( &card2[20], "DEFLEC12A", 9);
bbcode = 'W';
}
else if(imodel == 6) {
strncpy( &card2[20], "DEFLEC12B", 9);
bbcode = 'X';
}
else if(imodel == 7) {
strncpy( &card2[20], "DEFLEC18", 8);
bbcode = 'Y';
}
ixi = (int)(fabs(valx)*100.0 + 0.5);
ieta = (int)(fabs(vale)*100.0 + 0.5);
// Print the NEW *85* record
if (ofp) {
if (valx >= 0.0) strcpy(dirxi, "N");
else strcpy(dirxi, "S");
if (vale >= 0.0) strcpy(direta, "E");
else strcpy(direta, "W");
fprintf(ofp, "%-61s%c%5d%1s000%5d%1s000\n",
card85, bbcode, abs(ixi), dirxi,
abs(ieta), direta);
}
// Put the latest 'card85' record into 'card' and go back to
// the top to search...if 'card2' is an *86* record, then
// it will be passed unchanged into the output file.
// Print the card2 record
fprintf(ofp, "%s", card2);
// strcpy(card, card2);
++jjj;
break;
}//~if ((card2.substr(7,2) != "81")
// POSSIBILITY 5: We find the EOF
// ACTION: Create a new *86* based on the previous *80* record
// and then go to the 'end report' phase
// Find geoid file to use, based on input lat/lon
kk = which_defl(xlat, xlon, nfiles, kk, imodel, vec_xfnames,vec_hdr,vec_xifp);
// If the point isn't in any of our grid areas, set to -999
if (kk == -1) {
valx = -999;
vale = -999;
valh = -999;
} else {
// Otherwise, do the interpolation
// Interpolate Xi
valx = interg(xlat, xlon, vec_hdr, vec_xifp, kk );
if (DEBUG != 0) { printf("Xi = %lf \n", valx); }
// Interpolate Eta
vale = interg(xlat, xlon, vec_hdr, vec_eifp, kk );
if (DEBUG != 0) { printf("Eta = %lf \n", vale); }
// Calculate the Horizontal Laplace correction
valh = -tan(xlat * M_PI / 180.0) * vale;
if (DEBUG != 0) { printf("Lap = %lf \n", valh); }
keep += 1;
avex += valx;
avee += vale;
aveh += valh;
rmsx += (valx*valx);
rmse += (vale*vale);
rmsh += (valh*valh);
if (xlat > xn) xn = xlat;
if (xlat < xs) xs = xlat;
if (xlon > xe) xe = xlon;
if (xlon < xw) xw = xlon;
if (valx < minx) {
minx = valx;
minlatx = xlat;
minlonx = xlon;
}
if (valx > maxx) {
maxx = valx;
maxlatx = xlat;
maxlonx = xlon;
}
if (vale < mine) {
mine = vale;
minlate = xlat;
minlone = xlon;
}
if (vale > maxe) {
maxe = vale;
maxlate = xlat;
maxlone = xlon;
}
if (valh < minh) {
minh = valh;
minlath = xlat;
minlonh = xlon;
}
if (valh > maxh) {
maxh = valh;
maxlath = xlat;
maxlonh = xlon;
}
}
// Make a NEW *85* record
strncpy(card85, "\0", 90);
strcpy( card85, " *85*");
strncat(card85, &card[10], 4);
if (imodel == 1) {
strcat(card85, " DEFLEC99");
bbcode = 'A';
}
else if (imodel == 3) {
strcat(card85, " DEFLEC09");
bbcode = 'E';
}
else if (imodel == 5) {
strcat(card85, " DEFLEC12");
bbcode = 'W';
}
ixi = (int)(fabs(valx)*100.0 + 0.5);
ieta = (int)(fabs(vale)*100.0 + 0.5);
if (ofp) {
if (valx >= 0.0) strcpy(dirxi, "N");
else strcpy(dirxi, "S");
if (vale >= 0.0) strcpy(direta, "E");
else strcpy(direta, "W");
fprintf(ofp, "%-61s%c%5d%1s000%5d%1s000\n",
&card2[1], bbcode, abs(ixi), dirxi,
abs(ieta), direta);
}
strncpy(card, "\0", 90);
strncpy(card2, "\0", 90);
}//~while (jjj == 0)
}//~if ( card.compare(7, 2, "80") != 0)
}//~while( fgets(card, 80, ifp) ) {
// When finished, give a little report to the screen and end program.
avex /= keep;
avee /= keep;
aveh /= keep;
rmsx = sqrt(rmsx/keep);
rmse = sqrt(rmse/keep);
rmsh = sqrt(rmsh/keep);
if (keep > 1) {
fact = ((double)keep) / ((double)(keep-1));
stdx = sqrt( fact * ((rmsx*rmsx) - (avex*avex)) );
stde = sqrt( fact * ((rmse*rmse) - (avee*avee)) );
stdh = sqrt( fact * ((rmsh*rmsh) - (aveh*aveh)) );
} else {
stdx = 0.0;
stde = 0.0;
stdh = 0.0;
}
if (poseast) { // East Longitude
printf("\n\
FINAL REPORT: \n\
Points Input / Points Kept : %d %d \n\
North/South/West/East Bounds: %10.6lf %10.6lf %10.6lf %10.6lf\n\
\n\
%s\n\
%s\n\
%s\n\
Xi %6.2lf %5.2lf %5.2lf %10.6lf %10.6lf %6.2lf %10.6lf %10.6lf\n\
Eta %6.2lf %5.2lf %5.2lf %10.6lf %10.6lf %6.2lf %10.6lf %10.6lf\n\
Lap %6.2lf %5.2lf %5.2lf %10.6lf %10.6lf %6.2lf %10.6lf %10.6lf\n\n",
kount, keep,
xn, xs, xw, xe,
final_header1,
final_header2,
final_header3,
avex, stdx, minx, minlatx, minlonx, maxx, maxlatx, maxlonx,
avee, stde, mine, minlate, minlone, maxe, maxlate, maxlone,
aveh, stdh, minh, minlath, minlonh, maxh, maxlath, maxlonh);
} else { // West Longitude
printf("\n\
FINAL REPORT: \n\
Points Input / Points Kept : %d %d \n\
North/South/West/East Bounds: %10.6lf %10.6lf %10.6lf %10.6lf\n\
\n\
%s\n\
%s\n\
%s\n\
Xi %6.2lf %5.2lf %5.2lf %10.6lf %10.6lf %6.2lf %10.6lf %10.6lf\n\
Eta %6.2lf %5.2lf %5.2lf %10.6lf %10.6lf %6.2lf %10.6lf %10.6lf\n\
Lap %6.2lf %5.2lf %5.2lf %10.6lf %10.6lf %6.2lf %10.6lf %10.6lf\n\n",
kount, keep,
xn, xs, xw, xe,
final_header1,
final_header2,
final_header3,
avex, stdx, minx, minlatx, 360.0-minlonx, maxx, maxlatx, 360.0-maxlonx,
avee, stde, mine, minlate, 360.0-minlone, maxe, maxlate, 360.0-maxlone,
aveh, stdh, minh, minlath, 360.0-minlonh, maxh, maxlath, 360.0-maxlonh);
}
return;
}//~run_bbk