-
Notifications
You must be signed in to change notification settings - Fork 2
/
subs1.for
8011 lines (6788 loc) · 225 KB
/
subs1.for
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
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
* %P%
* file subs1.for ver $RCSfile: subs1.for,v $
SUBROUTINE AB (A, B, R, L, M, N)
*** FORM THE MATRIX PRODUCT R=AB
*** THE MATRICES A AND B ARE RETURNED UNCHANGED
IMPLICIT DOUBLE PRECISION (A-H, O-Z)
DIMENSION A(L,M), B(M,N), R(L,N)
CHARACTER*99 SCCSID
C SCCSID='$Id: subs1.for 107411 2018-10-30 14:54:00Z jarir.saleh $ 20$Date: 2008/08/25 16:04:51 $ NGS'
DO 5 I = 1, L
DO 4 J = 1, N
R(I,J) = 0.D0
DO 3 K = 1, M
R(I,J) = R(I,J) + A(I,K)*B(K,J)
3 CONTINUE
4 CONTINUE
5 CONTINUE
RETURN
END
SUBROUTINE ABAT (A, B, R, W, M, N)
*** FORM THE MATRIX PRODUCT R=ABA'
*** THE MATRICES A AND B ARE RETURNED UNCHANGED
*** W IS A SCRATCH VECTOR
IMPLICIT DOUBLE PRECISION (A-H, O-Z)
IMPLICIT INTEGER (I-N)
DIMENSION A(M,N), B(N,N), R(M,M), W(N)
DO 15 I = 1, M
DO 5 K = 1, N
W(K) = 0.D0
DO 4 L = 1, N
W(K) = W(K) + A(I,L)*B(L,K)
4 CONTINUE
5 CONTINUE
DO 14 J = I, M
R(I,J) = 0.D0
DO 10 L = 1, N
R(I,J) = R(I,J) + W(L)*A(J,L)
10 CONTINUE
R(J,I) = R(I,J)
14 CONTINUE
15 CONTINUE
RETURN
END
SUBROUTINE ABORT2
*** PRINT MESSAGE OF FATAL TERMINATION
IMPLICIT DOUBLE PRECISION (A-H, O-Z)
IMPLICIT INTEGER (I-N)
CHARACTER*26 TBUF
COMMON/UNITS/ LUNIT
WRITE (LUNIT,1)
1 FORMAT ('0')
WRITE (LUNIT,2)
2 FORMAT (1X, 130('*') )
WRITE (LUNIT,3)
3 FORMAT (' ***** FATAL TERMINATION -- FATAL TERMINATION !!'/
* ' ***** THIS DUMP IS INTENTIONAL !'/
* ' ***** REFER TO PRIOR ERROR MESSAGES')
WRITE (LUNIT,2)
ITYPE = 0
CALL SYSTIM (ITYPE, TBUF, DIFM, DIFM0)
WRITE (LUNIT,4) TBUF(1:24)
4 FORMAT ('0SYSTEM TIME IS ', A24)
STOP 666
END
SUBROUTINE ACCUR (A, NX, B, SHIFTS, SIGUWT)
*** COMPUTE AND LIST ACCURACIES
*** NOTE: ORTHOMETRIC OR GEOID HEIGHT UPDATED IF 2.5DIM ADJUSTMENT
IMPLICIT DOUBLE PRECISION (A-H, O-Z)
IMPLICIT INTEGER (I-N)
PARAMETER ( MXSSN = 9999 )
CHARACTER*80 ACARD
CHARACTER*80 BBOOK, AFILE, GFILE, DFILE, BBNAM
CHARACTER*7 ADJFIL, NAFILE
CHARACTER*2 CC12, CC34
LOGICAL GETSSN
LOGICAL LSS, LUP, LMSL, LABS, LADJ, LUPI
LOGICAL L2HLF, LEHT
LOGICAL ELFLAG, DFFLAG
DIMENSION A(*), NX(*), B(*), SHIFTS(*)
COMMON /NAME/ BBOOK, AFILE, GFILE, DFILE, BBNAM, ADJFIL, NAFILE
COMMON /OPT/ AX, E2, DMSL, DGH, VM, VP, CTOL, ITMAX, IMODE,
& LMSL, LSS, LUP, LABS, LADJ, LUPI
COMMON /DUAL/ N2HLF, I2HLF(MXSSN), L2HLF, LEHT
COMMON /FLAGS/ ELFLAG(MXSSN), DFFLAG(MXSSN)
COMMON /GPSORD/ CC34
COMMON/UNITS/ LUNIT
*** DO NOT COMPUTE ACCURACIES UNLESS INVERSE COMPUTED
IF (IMODE .NE. 1) THEN
IUNIT = 11
OPEN (IUNIT,ERR=200,STATUS='OLD',FILE=AFILE,IOSTAT=IOS)
CALL HEAD4
***** UPDATE HEIGHT IF 2.5DIM ADJUSTMENT
IF (L2HLF) THEN
CALL LINE4 (4)
WRITE (LUNIT,10)
10 FORMAT (/, ' WARNING - FOR RELATIVE LENGTH ACCURACY',
& ' COMPUTATIONS, DUAL HEIGHT STATIONS',
& /, ' ARE TREATED AS 2-DIM STATIONS',
& ' AND USE THE ORIGINAL STATION HEIGHT', /)
ENDIF
***** LOOP OVER ADJUSTMENT FILE FOR ACCURACY CARDS (QQ)
100 READ (IUNIT,1,END=777) ACARD
1 FORMAT (A80)
READ (ACARD,5) CC12
5 FORMAT (A2)
IF (CC12 .EQ. 'QQ') THEN
READ (ACARD,2) ISSN, JSSN
2 FORMAT (10X, I4, 36X, I4)
CC34(1:2) = ACARD(3:4)
IF (CC34(1:1) .EQ. ' ' .AND. CC34(2:2) .NE. ' ') THEN
CC34(1:1) = CC34(2:2)
CC34(2:2) = ' '
ENDIF
IF (GETSSN( ISSN, ISN) .AND. GETSSN(JSSN, JSN) ) THEN
CALL RELACC (ISSN, JSSN, ISN, JSN, A, NX, B, SHIFTS, SIGUWT)
ENDIF
ENDIF
GO TO 100
777 CLOSE (IUNIT)
CALL LINE4 (2)
WRITE (LUNIT,3)
3 FORMAT ('0************ END OF ACCURACY PROCESSING **********')
ENDIF
200 CONTINUE
RETURN
END
c The new argument IOBSNO is being passed to this subroutine so that
c it can be passed to the VSHIFT subroutines. This observation number
c reflects the numbering of vector components in sequence, without
c skipping rejected vectors. Mike Potterfield 3/15/07.
SUBROUTINE ACUM20 (IOBS, VSD,IOBSNO)
*** ACCUMULATE A LARGE RESIDUAL (NORMALIZED)
IMPLICIT DOUBLE PRECISION (A-H, O-Z)
IMPLICIT INTEGER (I-N)
PARAMETER ( MXRD = 20 )
COMMON /RESTAT/ VSD20(MXRD), VMAX, VMIN, VSDMAX, VSDMIN, VSUM,
& VSDSUM, VSD21, VSD22, VSD23, VSD24, VSD25, VSD26,
& VSD27, VSD28, VSD29, VSD210, VSD211, VSD212,
& VABS1, VABS2, VABS3, VABS4, VABS5, VABS6, VABS7,
& VABS8, VABS9, VABS10, VABS11, VABS12, I20(MXRD),
& N0, N1, N2, N3, N4, N5, N6, N7, N8, N9, N10,
& N11, N12, NI20
COMMON /REDUN/ RN1, RN2, RN3, RN4, RN5, RN6, RN7, RN8, RN9,
& RN10, RN11, RN12
*** DEAL ONLY WITH ABSOLUTE VALUES .GT. SMALLEST
V = DABS(VSD)
IF (V .LE. VSD20(MXRD) ) RETURN
*** POINT TO NEW ARRAY LOCATION
IP = IPOINT(V)
*** SHIFT ARRAY CONTENTS AND LOAD ARRAYS
CALL VSHIFT (IP, IOBS, V, IOBSNO)
RETURN
END
**v 4.28
c The new argument IOBSNO is being passed to this subroutine so that
c it can be passed to the VSHIFT subroutines. This observation number
c reflects the numbering of vector components in sequence, without
c skipping rejected vectors. Mike Potterfield 3/15/07.
SUBROUTINE ACUM20V (IOBS, V, IOBSNO)
*** ACCUMULATE A LARGE RESIDUAL
IMPLICIT DOUBLE PRECISION (A-H, O-Z)
IMPLICIT INTEGER (I-N)
PARAMETER ( MXRDV = 20 )
COMMON /RESTA3/ V20(MXRDV), I20V(MXRDV),NI20V
COMMON /UNITS/ LUNIT
*** DEAL ONLY WITH ABSOLUTE VALUES .GT. SMALLEST
V2 = DABS(V)
IF (V2 .LE. V20(MXRDV) ) RETURN
*** POINT TO NEW ARRAY LOCATION
IP = IPOINTV(V2)
*** SHIFT ARRAY CONTENTS AND LOAD ARRAYS
CALL VSHIFTV (IP, IOBS, V2, IOBSNO)
RETURN
END
******************
** v 4.29f
c The new argument IOBSNO is being passed to this subroutine so that
c it can be passed to the VSHIFT subroutines. This observation number
c reflects the numbering of vector components in sequence, without
c skipping rejected vectors. Mike Potterfield 3/15/07.
SUBROUTINE ACUM2DU (IOBS, V, IOBSNO)
*** ACCUMULATE A LARGE RESIDUAL FOR DU COMPONENT
IMPLICIT DOUBLE PRECISION (A-H, O-Z)
IMPLICIT INTEGER (I-N)
PARAMETER ( MXRDU = 20 )
COMMON /RESTA7/ VDU20(MXRDU), I20DU(MXRDU),NI20DU
COMMON /UNITS/ LUNIT
*** DEAL ONLY WITH ABSOLUTE VALUES .GT. SMALLEST
V2 = DABS(V)
IF (V2 .LE. VDU20(MXRDU) ) RETURN
*** POINT TO NEW ARRAY LOCATION
IP = IPOINTU(V2)
*** SHIFT ARRAY CONTENTS AND LOAD ARRAYS
CALL VSHIFTU (IP, IOBS, V2, IOBSNO)
RETURN
END
*********************
** v 4.29i
c The new argument IOBSNO is being passed to this subroutine so that
c it can be passed to the VSHIFT subroutines. This observation number
c reflects the numbering of vector components in sequence, without
c skipping rejected vectors. Mike Potterfield 3/15/07.
SUBROUTINE ACUM2DL (IOBS, V, IOBSNO)
*** ACCUMULATE A LARGE RESIDUAL FOR DL COMPONENT
IMPLICIT DOUBLE PRECISION (A-H, O-Z)
IMPLICIT INTEGER (I-N)
PARAMETER ( MXRDL = 20 )
COMMON /RESTA8/ VDL20(MXRDL), I20DL(MXRDL),NI20DL
COMMON /UNITS/ LUNIT
*** DEAL ONLY WITH ABSOLUTE VALUES .GT. SMALLEST
V2 = DABS(V)
IF (V2 .LE. VDL20(MXRDL) ) RETURN
*** POINT TO NEW ARRAY LOCATION
IP = IPOINTL(V2)
*** SHIFT ARRAY CONTENTS AND LOAD ARRAYS
CALL VSHIFTL (IP, IOBS, V2, IOBSNO)
RETURN
END
***********************
SUBROUTINE ADJAUX (A, NX, GOOGE, B, SIGUWT)
*** LIST ADJUSTED AUXILIARY PARAMETERS
IMPLICIT DOUBLE PRECISION (A-H, O-Z)
IMPLICIT INTEGER (I-N)
LOGICAL LBB, LGF, LCS, LVD, LVA, LVZ, LVS, LVR, LVG,
& LVC, LIS, LPS, LPG, LDR, LOS, LAP, LDF, LVX, LGV
LOGICAL LSS, LUP, LMSL, LABS, LADJ, LUPI
LOGICAL GETA
DIMENSION A(*), NX(*), GOOGE(*), B(*)
COMMON /OPRINT/ CRIT, LBB, LGF, LCS, LVD, LVA, LVZ, LVS, LVR, LVG,
& LVC, LIS, LPS, LPG, LDR, LOS, LAP, LDF, LVX, LGV
COMMON /OPT/ AX, E2, DMSL, DGH, VM, VP, CTOL, ITMAX, IMODE,
& LMSL, LSS, LUP, LABS, LADJ, LUPI
COMMON /STRUCT/ NSTA, NAUX, NUNK, IDIM, NSTAS, NOBS, NCON, NZ,NGRT
COMMON/UNITS/ LUNIT
*** HEADING
CALL HEAD5
NLINE = 2
IF (IMODE .NE. 1) NLINE = NLINE + 1
IF (LPG) NLINE = NLINE + 1
*** LOOP OVER PARAMETERS
DO 2 IAUX = 1, NAUX
CALL GETAUX (AUX, IAUX, B)
CALL LINE5 (NLINE)
WRITE (LUNIT,3) IAUX, AUX
3 FORMAT ('0#', I5, ' AUXILIARY PARAMETER IS ', 1PD10.2)
*** SIGMA
IF (IMODE .NE. 1) THEN
IA = IUNAUX(IAUX)
IF ( .NOT. GETA(IA, IA, SA, A, NX) ) THEN
WRITE (LUNIT,667) IAUX, IA
667 FORMAT ('0GET SIGMA ERROR IN ADJAUX--', 2I8)
CALL ABORT2
ENDIF
SA = DSQRT(SA)
IF (LSS) THEN
SA = SA*SIGUWT
AUXSA = AUX/SA
WRITE (LUNIT,5) SA, AUXSA
5 FORMAT (17X, 'SCALED SIGMA =', 1PD10.2, 7X, 'VAL/SD=',
& 0PF7.1)
ELSE
AUXSA = AUX/SA
WRITE (LUNIT,9) SA, AUXSA
9 FORMAT (15X, 'UNSCALED SIGMA =', 1PD10.2, 7X, 'VAL/SD=',
& 0PF7.1)
ENDIF
ENDIF
*** GOOGE
IF (LPG) THEN
IA = IUNAUX(IAUX)
WRITE (LUNIT,6) GOOGE(IA)
6 FORMAT (23X, 'GOOGE = ', 1PD10.2)
ENDIF
2 CONTINUE
RETURN
END
SUBROUTINE ADJGRT (A, NX, GOOGE, SIGUWT)
*** LIST ADJUSTED GPS AND DOPPLER ROTATION AUXILIARY PARAMETERS
IMPLICIT DOUBLE PRECISION (A-H, O-Z)
IMPLICIT INTEGER (I-N)
LOGICAL LBB, LGF, LCS, LVD, LVA, LVZ, LVS, LVR, LVG,
& LVC, LIS, LPS, LPG, LDR, LOS, LAP, LDF, LVX, LGV
LOGICAL LSS, LUP, LMSL, LABS, LADJ, LUPI
LOGICAL GETA
DIMENSION A(*), NX(*), GOOGE(*)
COMMON /OPRINT/ CRIT, LBB, LGF, LCS, LVD, LVA, LVZ, LVS, LVR, LVG,
& LVC, LIS, LPS, LPG, LDR, LOS, LAP, LDF, LVX, LGV
COMMON /OPT/ AX, E2, DMSL, DGH, VM, VP, CTOL, ITMAX, IMODE,
& LMSL, LSS, LUP, LABS, LADJ, LUPI
COMMON /STRUCT/ NSTA, NAUX, NUNK, IDIM, NSTAS, NOBS, NCON, NZ,NGRT
COMMON /CONST/ PI, PI2, RAD
COMMON/UNITS/ LUNIT
*** HEADING
CALL HEAD8
NLINE = 2
IF (IMODE .NE. 1) NLINE = NLINE + 1
IF (LPG) NLINE = NLINE + 1
*** LOOP OVER PARAMETERS - CHANGE FROM RADIANS TO ARC SECONDS
RADSEC = ( 60.D0 * 60.D0 * 180.D0 ) / PI
DO 2 IGRT = 1, NGRT
CALL GETRTG (GRTX, GRTY, GRTZ, IGRT)
GRTX = GRTX * RADSEC
GRTY = GRTY * RADSEC
GRTZ = GRTZ * RADSEC
CALL LINE8 (NLINE)
WRITE (LUNIT,3) IGRT, GRTX, GRTY, GRTZ
3 FORMAT ('0#', I3, 9X, 'VALUE =', 1PD10.2, 15X, 1PD10.2, 15X,
& 1PD10.2, ' (ARC SECONDS)')
*** SIGMA
IF (IMODE .NE. 1) THEN
IA = IUNGRT(IGRT, 1)
IF ( .NOT. GETA(IA, IA, SAX, A, NX) ) THEN
WRITE (LUNIT,667) IGRT, IA
667 FORMAT ('0GET SIGMA ERROR IN ADJGRT--', 2I8)
CALL ABORT2
ENDIF
IA = IUNGRT(IGRT, 2)
IF ( .NOT. GETA(IA, IA, SAY, A, NX) ) THEN
WRITE (LUNIT,667) IGRT, IA
CALL ABORT2
ENDIF
IA = IUNGRT(IGRT, 3)
IF ( .NOT. GETA(IA, IA, SAZ, A, NX) ) THEN
WRITE (LUNIT,667) IGRT, IA
CALL ABORT2
ENDIF
SAX = DSQRT(SAX) * RADSEC
SAY = DSQRT(SAY) * RADSEC
SAZ = DSQRT(SAZ) * RADSEC
IF (LSS) THEN
SAX = SAX*SIGUWT
SAY = SAY*SIGUWT
SAZ = SAZ*SIGUWT
GRTSAX = GRTX/SAX
GRTSAY = GRTY/SAY
GRTSAZ = GRTZ/SAZ
WRITE (LUNIT,5) SAX, SAY, SAZ, GRTSAX, GRTSAY, GRTSAZ
5 FORMAT (7X, 'SCALED SIGMA =', 1PD10.2, 15X, 1PD10.2, 15X,
& 1PD10.2, /, 13X, 'VAL/SD =', 0PF7.1, 18X, 0PF7.1,
& 18X, 0PF7.1)
ELSE
GRTSAX = GRTX/SAX
GRTSAY = GRTY/SAY
GRTSAZ = GRTZ/SAZ
WRITE (LUNIT,9) SAX, SAY, SAZ, GRTSAX, GRTSAY, GRTSAZ
9 FORMAT (5X, 'UNSCALED SIGMA =', 1PD10.2, 15X, 1PD10.2,
& 15X, 1PD10.2,
& /, 13X, 'VAL/SD =', 0PF7.1, 18X, 0PF7.1, 18X,0PF7.1)
ENDIF
ENDIF
*** GOOGE
IF (LPG) THEN
IAX = IUNGRT(IGRT, 1)
IAY = IUNGRT(IGRT, 2)
IAZ = IUNGRT(IGRT, 3)
WRITE (LUNIT,6) GOOGE(IAX), GOOGE(IAY), GOOGE(IAZ)
6 FORMAT (14X, 'GOOGE =', 1PD10.2, 15X, 1PD10.2, 15X, 1PD10.2)
ENDIF
2 CONTINUE
RETURN
END
C--------+---------+---------+---------+---------+---------+---------+------------------------
SUBROUTINE ADJPOS (A, B, NX, SHIFTS, GOOGE, SIGUWT)
*** LIST ADJUSTED POSITIONS
IMPLICIT DOUBLE PRECISION (A-H, O-Z)
IMPLICIT INTEGER (I-N)
PARAMETER ( MXSSN = 9999 )
LOGICAL LBB, LGF, LCS, LVD, LVA, LVZ, LVS, LVR, LVG,
& LVC, LIS, LPS, LPG, LDR, LOS, LAP, LDF, LVX, LGV
LOGICAL LOCSSN, GETA
LOGICAL LSS, LUP, LMSL, LABS, LADJ, LUPI
LOGICAL L2HLF, LEHT
LOGICAL ELFLAG, DFFLAG
CHARACTER*80 BBOOK, AFILE, GFILE, DFILE, BBNAM
CHARACTER*30 NAMES, NAME
CHARACTER*7 ADJFIL, NAFILE
CHARACTER*1 ADIR1, ADIR2, ADX, ADY, AEHT
DIMENSION A(*), B(*), NX(*), SHIFTS(*), GOOGE(*)
COMMON /NAMTAB/ NAMES(MXSSN)
COMMON /OPRINT/ CRIT, LBB, LGF, LCS, LVD, LVA, LVZ, LVS, LVR, LVG,
& LVC, LIS, LPS, LPG, LDR, LOS, LAP, LDF, LVX, LGV
COMMON /OPT/ AX, E2, DMSL, DGH, VM, VP, CTOL, ITMAX, IMODE,
& LMSL, LSS, LUP, LABS, LADJ, LUPI
COMMON /STRUCT/ NSTA, NAUX, NUNK, IDIM, NSTAS, NOBS, NCON, NZ,NGRT
COMMON /CONST/ PI, PI2, RAD
COMMON /DUAL/ N2HLF, I2HLF(MXSSN), L2HLF, LEHT
COMMON /FLAGS/ ELFLAG(MXSSN), DFFLAG(MXSSN)
COMMON /NAME/ BBOOK, AFILE, GFILE, DFILE, BBNAM, ADJFIL, NAFILE
COMMON/UNITS/ LUNIT
**v6.3
CHARACTER la_s1*7,lo_s1*7
CHARACTER la_s2*1,lo_s2*1
character lat_lon_char*25,HT_char*7
logical un_constrained_HT,un_constrained_Hz
LOGICAL overwrite_const_coord_in_newbb
character CC_records*80,hemi*1
character CHAR_DX*8,CHAR_DY*8,CHAR_DZ*8
character CHAR_ADX*1,CHAR_ADY*1
character CHAR_IAZ*3
character CHAR_DH*7,CHAR_TOT*7
COMMON/MM6/overwrite_const_coord_in_newbb
COMMON/MM6_array/CC_records(MXSSN)
**so far for v6.3
*** HEADING
IF (LAP) THEN
CALL HEAD3
NLINE = 2
IF (LPS) NLINE = NLINE + 1
IF (IMODE .GE. 2) NLINE = NLINE + 1
IF (LPG) NLINE = NLINE + 1
ENDIF
*** OPEN ADJUSTED POSITION SUMMARY FILE
IF (LADJ) THEN
LUS = 23
OPEN (LUS, FILE=ADJFIL, STATUS='UNKNOWN')
WRITE (LUS, 102)
102 FORMAT (' ADJUSTED POSITION SUMMARY', ///,
& ' SSN LATITUDE LONGITUDE GMSL GHT',
& ' EHT DLAT DLON DHT AZ DH',
& ' DTOT SIG LA SIG LO SIG HT',
& ' GOOGE X GOOGE Y GOOGE Z NAME')
ENDIF
*** GET POSITIONS
DO 2 ISN = 1, NSTA
CALL GETGLA (GLAT, ISN, B)
CALL GETGLO (GLON, ISN, B)
CALL GETMSL (GMSL0, ISN, B)
CALL GETECX (XPOS,ISN,B)
CALL GETECY (YPOS,ISN,B)
CALL GETECZ (ZPOS,ISN,B)
CALL GETGH (GHT0, ISN, B)
IF (L2HLF .AND. I2HLF(ISN) .EQ. 1) THEN
c write (LUNIT,*) 'GEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEZ'
CALL GETEHT (EHT, ISN, B)
IF ( ELFLAG(ISN) ) THEN
c write (LUNIT,*) 'TEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEZ'
GMSL = EHT - GHT0
GHT = GHT0
ELSE
GHT = EHT - GMSL
GMSL = GMSL0
ENDIF
AEHT = '*'
ELSE
GMSL = GMSL0
GHT = GHT0
EHT = GMSL + GHT
AEHT = ' '
ENDIF
NAME = NAMES(ISN)
CALL GETDMS (GLAT, ID1, IM1, S1, ISIGN)
IF (ISIGN .GT. 0) THEN
ADIR1 = 'N'
ELSE
ADIR1 = 'S'
ENDIF
DLAT = GLAT*RAD*ISIGN
CALL GETDMS (GLON, ID2, IM2, S2, ISIGN)
IF (ISIGN .GT. 0) THEN
ALONGD=ID2+(IM2/60.D0)+(S2/3600.D0)
ALONGD=360.D0-ALONGD
ID2=INT(ALONGD)
ALONGM=(ALONGD-ID2) * 60.D0
IM2=INT(ALONGM)
S2=(ALONGM-IM2) * 60.D0
ADIR2 = 'W'
ELSE
ADIR2 = 'W'
ENDIF
DLON = GLON*RAD*ISIGN
IF ( .NOT. LOCSSN(ISN, ISSN) ) THEN
WRITE (LUNIT,666) ADJFIL, ISN
666 FORMAT ('0SSN TABLE ERROR IN ', A8, ' --', I8)
CALL ABORT2
ENDIF
IF (LAP) THEN
CALL LINE3 (NLINE)
**v6.3 Replace adjusted coordinates by constrained ones in the ADJUST output file
c if (overwrite_const_coord_in_newbb) then
c do ii=1,MXSSN
c if (CC_records(ii)(1:2) == 'CC') then
c read (CC_records(ii)(11:14),'(i4)') iissn
c if (ISSN == iissn) then
c read(CC_records(ii)(45:69),'(a25)') lat_lon_char
c read(CC_records(ii)(70:76),'(a7)') HT_char
c un_constrained_Hz = (lat_lon_char == ' ')
c un_constrained_HT = (HT_char == ' ')
c if (.not. un_constrained_Hz) then
c if(.not. un_constrained_HT) then !The station is constrained includin the height
c read(CC_records(ii)(45:76),301)
c & ID1,IM1,la_s1,la_s2,ID2,IM2,lo_s1,lo_s2,iEHT
c do iii=1,7
c if(la_s1(iii:iii)==' ') la_s1(iii:iii)='0'
c if(lo_s1(iii:iii)==' ') lo_s1(iii:iii)='0'
c enddo
c read (la_s1,'(f7.5)') s1
c read (lo_s1,'(f7.5)') s2
C Latitude
c if (la_s2 == 'N') then
c dlat = ID1+(IM1/60.D0)+(S1/3600.D0)
c else
c dlat = -(ID1+(IM1/60.D0)+(S1/3600.D0))
c endif
c glat = dlat/RAD
c ADIR1 = la_s2
C Longitude
c if (lo_s2 == 'W') then
c dlon = ID2+(IM2/60.D0)+(S2/3600.D0)
c else
c ALONGD=ID2+(IM2/60.D0)+(S2/3600.D0)
c ALONGD=360.D0-ALONGD
c ID2=INT(ALONGD)
c ALONGM=(ALONGD-ID2) * 60.D0
c IM2=INT(ALONGM)
c S2=(ALONGM-IM2) * 60.D0
c dlon = ID2+(IM2/60.D0)+(S2/3600.D0)
c lo_s2 = 'W'
c endif
c glon = (360.d0 - dlon)/RAD
c ADIR2 = lo_s2
c Height
c EHT = 0.001d0*iEHT
c Cartesian coordinates
c call TOXYZ (GLAT,GLON,EHT,XPOS,YPOS,ZPOS)
c exit
c else !The station's Hz position is constrained but not the height
c read(CC_records(ii)(45:76),301)
c & ID1,IM1,la_s1,la_s2,ID2,IM2,lo_s1,lo_s2
c do iii=1,7
c if(la_s1(iii:iii)==' ') la_s1(iii:iii)='0'
c if(lo_s1(iii:iii)==' ') lo_s1(iii:iii)='0'
c enddo
c read (la_s1,'(f7.5)') s1
c read (lo_s1,'(f7.5)') s2
c Latitude
c if (la_s2 == 'N') then
c dlat = ID1+(IM1/60.D0)+(S1/3600.D0)
c else
c dlat = -(ID1+(IM1/60.D0)+(S1/3600.D0))
c endif
c glat = dlat/RAD
c ADIR1 = la_s2
c Longitude
c if (lo_s2 == 'W') then
c dlon = ID2+(IM2/60.D0)+(S2/3600.D0)
c else
c ALONGD=ID2+(IM2/60.D0)+(S2/3600.D0)
c ALONGD=360.D0-ALONGD
c ID2=INT(ALONGD)
c ALONGM=(ALONGD-ID2) * 60.D0
c IM2=INT(ALONGM)
c S2=(ALONGM-IM2) * 60.D0
c dlon = ID2+(IM2/60.D0)+(S2/3600.D0)
c lo_s2 = 'W'
c endif
c glon = (360.d0 - dlon)/RAD
c ADIR2 = lo_s2
c Height
c !EHT = EHT Take the adjusted ellipsoidal height of the station
c Cartesian coordinates
c call TOXYZ (GLAT,GLON,EHT,XPOS,YPOS,ZPOS)
c exit
c endif
c else
c read(CC_records(ii)(70:76),'(i7)') iEHT
c EHT = 0.001d0*iEHT
c !glat and glon are the adjusted ones
c call TOXYZ (GLAT,GLON,EHT,XPOS,YPOS,ZPOS)
c exit
c endif
c endif
c else
c cycle
c endif
c enddo
301 format (2i2,a7,a1,i3,i2,a7,a1,i7)
c endif
**so far for v6.3
WRITE (LUNIT,3) ISN, ISSN, NAME, ID1, IM1, S1, ADIR1,
* ID2, IM2, S2, ADIR2, GMSL, GHT, EHT, AEHT
3 FORMAT ('0', I5, I5, 1X, A30, 2I3, F9.5, A1,
* 1X, I4, I3, F9.5, A1, 2X, F8.3, F9.3, F10.3, A1)
ENDIF
*** PRINT SHIFTS IF ENABLED
IF (LPS) THEN
IF (IMODE .NE. 0) THEN
I1 = IUNSHF(ISN, 1)
I2 = IUNSHF(ISN, 2)
I3 = IUNSHF(ISN, 3)
DX = SHIFTS(I1)
DY = SHIFTS(I2)
DZ = SHIFTS(I3)
DXS = DX
DYS = DY
DZS = DZ
DX2 = DX*DX
DY2 = DY*DY
DH = DSQRT(DX2 + DY2)
IF (DABS(DX) .LE. 1.D-3 .OR. DABS(DY) .LE. 1.D-3) THEN
IAZ = 0
ELSE
IAZ = IDNINT( DATAN2(DY, DX)*RAD + 0.5D0 )
IF (IAZ .LT. 0) IAZ = IAZ + 360
ENDIF
DTOT = DSQRT(DX2 + DY2 + DZ*DZ)
IF (DX .LT. 0.D0) THEN
DX = -DX
ADX = 'S'
ELSE
ADX = 'N'
ENDIF
IF (DY .LT. 0.D0) THEN
DY = -DY
ADY = 'W'
ELSE
ADY = 'E'
ENDIF
**v6.3 Replace actual shifts by asterisks for constrained stations at which the adjusted positions
** were replaced (this is weighted constraints) by their constrained coordinates.
icounter = 0
c if (overwrite_const_coord_in_newbb) then
c do ii=1,MXSSN
c if (CC_records(ii)(1:2) == 'CC') then
c read (CC_records(ii)(11:14),'(i4)') iissn
c if (ISSN == iissn) then
c read(CC_records(ii)(45:69),'(a25)') lat_lon_char
c read(CC_records(ii)(70:76),'(a7)') HT_char
c un_constrained_Hz = (lat_lon_char == ' ')
c un_constrained_HT = (HT_char == ' ')
c if (.not. un_constrained_Hz) then
c if(.not. un_constrained_HT) then !The station is constrained includin the height
c icounter = icounter + 1
c CHAR_DX = '********'
c CHAR_ADX = '*'
c CHAR_DY = '********'
c CHAR_ADY = '*'
c CHAR_DZ = '********'
c CHAR_IAZ = '***'
c CHAR_DH = '*******'
c CHAR_TOT = '*******'
c IF (LAP) then
c WRITE(LUNIT,41) CHAR_DX,CHAR_ADX,CHAR_DY,
c & CHAR_ADY,CHAR_DZ,CHAR_IAZ,
c & CHAR_DH, CHAR_TOT
c41 FORMAT(32X,'SHIFTS (M.)',4X,a8,A1,9X,a8,A1,
c & 22X,a8,' AZ=',a3,' H=',a7,' T=',a7)
c endif
c exit
c else
c icounter = icounter + 1
c CHAR_DX = '********'
c CHAR_ADX = '*'
c CHAR_DY = '********'
c CHAR_ADY = '*'
c CHAR_IAZ = '***'
c CHAR_DH = '*******'
c DTOT = DZ
c IF (LAP) then
c WRITE(LUNIT,43) CHAR_DX,CHAR_ADX,CHAR_DY,
c & CHAR_ADY,DZ,CHAR_IAZ,
c & CHAR_DH, DTOT
c43 FORMAT(32X,'SHIFTS (M.)',4X,a8,A1,9X,a8,A1,
c & 22X,f8.3,' AZ=',a3,' H=',a7,' T=',f7.3)
c endif
c exit
c endif
c else
c icounter = icounter + 1
c CHAR_DZ = '********'
c DTOT = DSQRT(DX2 + DY2)
c--------+---------+---------+---------+---------+---------+---------+------------------------
c IF (LAP) then
c WRITE(LUNIT,42) DX,ADX,DY,ADY,CHAR_DZ,IAZ,DH,
c & DTOT
c42 FORMAT(32X,'SHIFTS (M.)',4X,f8.3,A1,9X,f8.3,A1,
c & 22X,a8,' AZ=',I3,' H=',f7.3,' T=',f7.3)
c endif
c exit
c endif
c else
c cycle
c endif
c else
c cycle
c endif
c enddo
c endif
if (icounter == 0) then
IF (LAP) WRITE(LUNIT,4) DX,ADX,DY,ADY,DZ,IAZ,DH,DTOT
4 FORMAT(32X,'SHIFTS (M.)',4X,F8.3,A1,9X,F8.3,A1,22X,
** v 4.29g
** * F8.3, ' AZ=', I3, ' HOR=', F5.1, ' TOT=', F5.1)
* F8.3, ' AZ=', I3, ' H=', F7.3, ' T=', F7.3)
endif
********************
ENDIF
ENDIF
** so far for v6.3
*** PRINT INVERSE ELEMENTS IF ENABLED
IF (IMODE .NE. 1) THEN
IX = IUNSTA(ISN, 1)
IY = IUNSTA(ISN, 2)
IZ = IUNSTA(ISN, 3)
IF ( .NOT. GETA(IX, IX, SX, A, NX) ) THEN
WRITE (LUNIT,667) ADJFIL, ISN, IX
667 FORMAT ('0GET SIGMA ERROR IN ', A8, ' --', 2I8)
CALL ABORT2
ENDIF
IF ( .NOT. GETA(IY, IY, SY, A, NX) ) THEN
WRITE (LUNIT,667) ISN, IY
CALL ABORT2
ENDIF
IF ( .NOT. GETA(IZ, IZ, SZ, A, NX) ) THEN
WRITE (LUNIT,667) ISN, IZ
CALL ABORT2
ENDIF
SX = DSQRT(SX)
SY = DSQRT(SY)
SZ = DSQRT(SZ)
IF (LSS) THEN
SX = SX*SIGUWT
SY = SY*SIGUWT
SZ = SZ*SIGUWT
IF (LAP) WRITE (LUNIT,5) SX, SY, SZ
5 FORMAT (25X, 'SCALED SIGMAS (M.)', 4X, F8.3, 10X, F8.3, 23X,
& F8.3)
ELSE
IF (LAP) WRITE (LUNIT,9) SX, SY, SZ
9 FORMAT (23X, 'UNSCALED SIGMAS (M.)', 4X, F8.3, 10X, F8.3,
* T97, F8.3)
ENDIF
ENDIF
*** PRINT GOOGE NUMBERS IF ENABLED
IF (LPG) THEN
IX = IUNSTA(ISN, 1)
IY = IUNSTA(ISN, 2)
IZ = IUNSTA(ISN, 3)
GX = GOOGE(IX)
GY = GOOGE(IY)
GZ = GOOGE(IZ)
IF (LAP) WRITE (LUNIT,6) GX, GY, GZ
6 FORMAT (32X, 'GOOGES', 11X, 1PD8.1, 10X, 1PD8.1, 23X, 1PD8.1)
ENDIF
*** PRINT ADJUSTED POSITION OUTPUT FILE, ENSURE THAT NO * ARE
*** PRINTED, REGARDLESS OF THE OPERATING SYSTEM
IF (LADJ) THEN
IF ( DXS .GE. 1.D4 .OR. DXS .LE. -1.D3 .OR.
& DABS(DXS) .LT. 0.001D0 ) DXS = 0.D0
IF ( DYS .GE. 1.D4 .OR. DYS .LE. -1.D3 .OR.
& DABS(DYS) .LT. 0.001D0 ) DYS = 0.D0
IF ( DZS .GE. 1.D4 .OR. DZS .LE. -1.D3 .OR.
& DABS(DZS) .LT. 0.001D0 ) DZS = 0.D0
IF ( DH .GE. 1.D3 .OR. DH .LE. -1.D2 .OR.
& DABS(DH) .LT. 0.1D0 ) DH = 0.D0
IF ( DTOT .GE. 1.D3 .OR. DTOT .LE. -1.D2 .OR.
& DABS(DTOT) .LT. 0.1D0 ) DTOT = 0.D0
IF ( SX .GE. 1.D4 .OR. SX .LE. -1.D3 .OR.
& DABS(SX) .LT. 0.001D0 ) SX = 0.D0
IF ( SY .GE. 1.D4 .OR. SY .LE. -1.D3 .OR.
& DABS(SY) .LT. 0.001D0 ) SY = 0.D0
IF ( SZ .GE. 1.D4 .OR. SZ .LE. -1.D3 .OR.
& DABS(SZ) .LT. 0.001D0 ) SZ = 0.D0
IF ( GX .GE. 1.D6 .OR. GX .LE. -1.D5 .OR.
& DABS(GX) .LT. 0.1D0 ) GX = 0.D0
IF ( GY .GE. 1.D6 .OR. GY .LE. -1.D5 .OR.
& DABS(GY) .LT. 0.1D0 ) GY = 0.D0
IF ( GZ .GE. 1.D6 .OR. GZ .LE. -1.D5 .OR.
& DABS(GZ) .LT. 0.1D0 ) GZ = 0.D0
WRITE (LUS, 100) ISSN, DLAT, DLON,
& GMSL, GHT, EHT, AEHT,
& DXS, DYS, DZS,
& IAZ, DH, DTOT,
& SX, SY, SZ,
& GX, GY, GZ, NAME
100 FORMAT (I5, ':', F11.7, ':', F12.7, ':',
& F8.3, ':', F8.3, ':', F8.3, A1, ':',
& F8.3, ':', F8.3, ':', F8.3, ':',
& I3, ':', F5.1, ':', F5.1, ':',
& F8.3, ':', F8.3, ':', F8.3, ':',
& 1PD8.1, ':', 1PD8.1, ':', 1PD8.1, ':', 2X, A30)
ENDIF
*** PRINT OUT THE EARTH CENTERED COORDINATES
WRITE(LUNIT,33) XPOS,YPOS,ZPOS
33 FORMAT(1X,T17,'X = ',F15.4,10X,'Y = ',F15.4,
* 10X,'Z = ',F15.4)
CALL LINE3 (1)
2 CONTINUE
IF (LADJ) CLOSE (LUS)
RETURN
END
C-------------------------------------------------------------------------------------------------
**v6.3
SUBROUTINE constrained_stations_shifts (A, B, NX)
*** LIST N-E-U SHIFTS OF CONSTRAINED STATIONS
IMPLICIT DOUBLE PRECISION (A-H, O-Z)
IMPLICIT INTEGER (I-N)
PARAMETER ( MXSSN = 9999 )
LOGICAL LOCSSN, GETA
CHARACTER*30 NAMES, NAME
DIMENSION A(*), B(*), NX(*)
double precision R(3,3)
double precision DXYZ(3),DNEU(3)
LOGICAL LBB, LGF, LCS, LVD, LVA, LVZ, LVS, LVR, LVG,
& LVC, LIS, LPS, LPG, LDR, LOS, LAP, LDF, LVX, LGV
CHARACTER la_s1*7,lo_s1*7
CHARACTER la_s2*1,lo_s2*1
character CC_records*80
character lat_lon_char*25,HT_char*7
logical un_constrained_HT,un_constrained_Hz
COMMON /OPRINT/ CRIT,LBB,LGF,LCS,LVD,LVA,LVZ,LVS,LVR,LVG,
& LVC,LIS,LPS,LPG,LDR,LOS,LAP,LDF,LVX,LGV
COMMON /NAMTAB/ NAMES(MXSSN)
COMMON /STRUCT/NSTA,NAUX,NUNK,IDIM,NSTAS,NOBS,NCON,NZ,NGRT
COMMON /CONST/ PI, PI2, RAD
COMMON/UNITS/ LUNIT
COMMON/MM6_array/CC_records(MXSSN)
*** HEADING
c CALL HEAD3
NLINE = 2
IF (LPS) NLINE = NLINE + 1
IF (IMODE .GE. 2) NLINE = NLINE + 1
IF (LPG) NLINE = NLINE + 1
C write header
write (LUNIT,'(///)')
write (LUNIT,660)
660 format
&('COMPARISON OF ADJUSTED AND CONSTRAINED COORDINATES AND HEIGHTS')
write (LUNIT,661)
661 format('ADJUSTED MINUS CONSTRAINED COORDINATE SHIFTS (METERS)')
write (LUNIT,6611)
6611 format('CURRENTLY NO VALUES ARE PRINTED FOR VERTICAL CONSTRAINTS'/
&)
write(LUNIT,662)'ISN','SSN','STATION DESIGNATION','DELTA NORTH',
&'DELTA EAST','DELTA HORIZ','DELTA UP'
662 format (1x,a3,3x,a3,10x,a19,18x,a11,4x,a10,3x,a11,3x,a8)