OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
swapcl.f
Go to the documentation of this file.
1  SUBROUTINE swapcl
2  i (iclmp1, iclmp2, ifxclm,
3  o lblclm, timclm, briclm, gciclm, vrmclm, vrpclm, nobclm,
4  o mrkclm, idfclm, nrfclm, mapclm, skyclm)
5 C-----------------------------------------------------------------------
6 C MODULE NAME: STSWAPCL
7 C
8 C
9 C PURPOSE: TO SWAP ALL ELEMENTS OF 2 DIFFERENT CLUMPS DURING SORT.
10 C
11 C
12 C ARGUMENT LIST:
13 C ARGUMENT I/O TYPE DIMENS DESCRIPTION
14 C -------- --- ---- ------ -----------
15 C ICLMP1 I I*4 FIRST OF 2 CLUMPS TO SWAP
16 C ICLMP2 I I*4 SECOND CLUMP TO SWAP
17 C IFXCLM I I*4 MAX NUMBER OF REF STAR MATCHES PER CLUMP
18 C LBLCLM I O I*4 * CLUMP LABELS
19 C TIMCLM I O R*8 * AVERAGE CLUMP TIMES
20 C BRICLM I O R*4 * AVERAGE CLUMP MAGNITUDES
21 C GCICLM I O R*4 3,* AVERAGE CLUMP POSITIONS (GCI)
22 C VRMCLM I O R*4 * CLUMP MAGNITUDE VARIANCES
23 C VRPCLM I O R*4 * CLUMP POSITION VARIANCES
24 C NOBCLM I O I*4 * NUMBER OF OBSERVATIONS IN EACH CLUMP
25 C MRKCLM I O I*4 * STATUS FLAG FOR EACH CLUMP
26 C IDFCLM I O I*4 * IDENTIFICATION FLAG FOR EACH CLUMP
27 C NRFCLM I O I*4 * # OF REFERENCE STAR MATCHES FOR EACH CLUMP
28 C MAPCLM I O I*4 10,* SKYMAP ID NUMBER OF REFERENCE STAR MATCHES
29 C SKYCLM I O R*4 10,3,* LIST OF CORRECTED REFERENCE STAR POSITIONS
30 C (MATCH#,AXIS,CLUMP#)
31 C
32 C COMMON BLOCK VARIABLES USED:
33 C COMMON VAR I/O VAR I/O VAR I/O VAR I/O
34 C ------ --- --- --- --- --- --- --- ---
35 C CMDEBG LEVDBG I LUDBUG I
36 C
37 C ++INCLUDE STCMDEBG
38  INTEGER*4 LEVDBG(8),LUDBUG
39  COMMON /cmdebg/levdbg,ludbug
40 C
41 C EXTERNAL FILES REFERENCED:
42 C FILENAME OPERATION FORTRAN UNIT ID
43 C -------- --------- ---------------
44 C NONE
45 C
46 C EXTERNAL REFERENCES:
47 C --------------------------------------------------------------------
48 C NONE
49 C
50 C SUBROUTINE CALLED FROM:
51 C --------------------------------------------------------------------
52 C STSORTCL - STAR MATCHING SORT ROUTINE
53 C
54 C CONSTRAINTS, RESTRICTIONS, MESSAGES, NOTES:
55 C --------------------------------------------------------------------
56 C NONE
57 C
58 C REQUIREMENTS REFERENCES:
59 C --------------------------------------------------------------------
60 C NONE
61 C
62 C DEVELOPMENT HISTORY:
63 C DATE AUTHOR DESCRIPTION
64 C -------- ------ -----------
65 C 8/ 3/88 R.J. BURLEY DESIGN
66 C 5/16/89 R.J. BURLEY CODED
67 C 11/ 6/89 R.J. BURLEY ADD LBLCLM GESS ARRAY
68 C-----------------------------------------------------------------------
69 C METHOD:
70 C PUT ALL ELEMENTS OF ICLMP1 INTO TEMP VARIABLES
71 C PUT ALL ELEMENTS OF ICLMP2 INTO ICLMP1
72 C PUT ALL ELEMENTS OF TEMP VARIABLES INTO ICLMP2
73 C RETURN
74 C-----------------------------------------------------------------------
75 C
76 C * DEFINE PARAMETER VARIABLES
77  real*8 timclm(*)
78 C
79  real*4 briclm(*), gciclm(3,*), vrmclm(*) , vrpclm(*)
80  real*4 skyclm(10,3,*)
81 C
82  INTEGER*4 ICLMP1 , ICLMP2 , IFXCLM , LBLCLM(*)
83  INTEGER*4 NOBCLM(*), MRKCLM(*) , IDFCLM(*) , NRFCLM(*)
84  INTEGER*4 MAPCLM(10,*)
85 C
86 C * DECLARE LOCAL VARIABLES
87  real*8 temp8
88  real*4 temp4
89  INTEGER*4 ITEMP, IAXIS, IMATCH
90 C
91 C INITIALIZE ROUTINE
92 C IF (LEVDBG(7) .NE. 0) WRITE (LUDBUG,1000)
93 C
94 C SWAP CLUMP LABELS
95  itemp = lblclm(iclmp1)
96  lblclm(iclmp1) = lblclm(iclmp2)
97  lblclm(iclmp2) = itemp
98 C
99 C SWAP CLUMP TIME
100  temp8 = timclm(iclmp1)
101  timclm(iclmp1) = timclm(iclmp2)
102  timclm(iclmp2) = temp8
103 C
104 C SWAP CLUMP POSITIONS
105  DO 100 iaxis=1,3
106  temp4 = gciclm(iaxis,iclmp1)
107  gciclm(iaxis,iclmp1) = gciclm(iaxis,iclmp2)
108  gciclm(iaxis,iclmp2) = temp4
109 100 CONTINUE
110 C
111 C SWAP CLUMP MAGNITUDE
112  temp4 = briclm(iclmp1)
113  briclm(iclmp1) = briclm(iclmp2)
114  briclm(iclmp2) = temp4
115 C
116 C SWAP CLUMP MAGNITUDE VARIANCE
117  temp4 = vrmclm(iclmp1)
118  vrmclm(iclmp1) = vrmclm(iclmp2)
119  vrmclm(iclmp2) = temp4
120 C
121 C SWAP CLUMP POSITION VARIANCE
122  temp4 = vrpclm(iclmp1)
123  vrpclm(iclmp1) = vrpclm(iclmp2)
124  vrpclm(iclmp2) = temp4
125 C
126 C SWAP NUMBER OF OBSERVATIONS
127  itemp = nobclm(iclmp1)
128  nobclm(iclmp1) = nobclm(iclmp2)
129  nobclm(iclmp2) = itemp
130 C
131 C SWAP CLUMP STATUS FLAGS
132  itemp = mrkclm(iclmp1)
133  mrkclm(iclmp1) = mrkclm(iclmp2)
134  mrkclm(iclmp2) = itemp
135 C
136 C SWAP IDENTIFICATION FLAGS
137  itemp = idfclm(iclmp1)
138  idfclm(iclmp1) = idfclm(iclmp2)
139  idfclm(iclmp2) = itemp
140 C
141 C SWAP NUMBER OF MATCHES
142  itemp = nrfclm(iclmp1)
143  nrfclm(iclmp1) = nrfclm(iclmp2)
144  nrfclm(iclmp2) = itemp
145 C
146 C SWAP MATCH CATALOG #'S
147  DO 200 imatch=1,10
148  itemp = mapclm(imatch,iclmp1)
149  mapclm(imatch,iclmp1) = mapclm(imatch,iclmp2)
150  mapclm(imatch,iclmp2) = itemp
151 200 CONTINUE
152 C
153 C SWAP CORRECTED REFERENCE
154 C STAR POSITIONS
155  DO 400 imatch=1,10
156  DO 300 iaxis=1,3
157  temp4 = skyclm(imatch,iaxis,iclmp1)
158  skyclm(imatch,iaxis,iclmp1) = skyclm(imatch,iaxis,iclmp2)
159  skyclm(imatch,iaxis,iclmp2) = temp4
160 300 CONTINUE
161 400 CONTINUE
162 C
163 C NORMAL TERMINATION
164 C IF (LEVDBG(7) .NE. 0) WRITE (LUDBUG,2000)
165  RETURN
166 C
167 C FORMAT SECTION
168 1000 FORMAT(' *** ENTER SWAPCL *** ')
169 2000 FORMAT(' *** EXIT SWAPCL *** ')
170  END
subroutine swapcl(ICLMP1, ICLMP2, IFXCLM, LBLCLM, TIMCLM, BRICLM, GCICLM, VRMCLM, VRPCLM, NOBCLM, MRKCLM, IDFCLM, NRFCLM, MAPCLM, SKYCLM)
Definition: swapcl.f:5
#define real
Definition: DbAlgOcean.cpp:26