OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
geocor.f
Go to the documentation of this file.
1  subroutine geocor
2 c
3 c apply geometric correction to the stokes parameters of the diffuse
4 c radiation leaving the top and bottom of the atmosphere
5 c
6 c**********************************************************************
7 c
8  implicit real*8 (a-h,o-z)
9  include 'afrt_rt2.cmn'
10  integer*4 s
11 c
12 c**********************************************************************
13 c
14  m1=jpass-2
15  m2=jpass-1
16  m3=jpass
17 c
18 c apply geo. series correction to the fluxes leaving the bottom
19 c of the atmosphere
20 c
21  call geom(fluxd(m1,nolyr+1),fluxd(m2,nolyr+1),fluxd(m3,nolyr+1),
22  1 rr1,temp1(nolyr+1))
23  call geom(fluxu(m1,1),fluxu(m2,1),fluxu(m3,1),
24  1 rr2,temp2(1))
25 c
26  if(kzz.eq.1)then
27  totflxgs=temp1(nolyr+1)+temp2(1)+amuo*factr
28  ctest=totflxgs/amuo
29  endif
30  if(kzz.eq.1)gz=temp1(nolyr+1)
31  if(kzz.eq.2 .and. itrans.eq.0)sb=temp1(nolyr+1)
32 c
33 c apply geo. series correction to the radiances leaving the top &
34 c bottom of the atmosphere
35 c
36  read(71,rec=m3)ftmp
37  read(71,rec=m2)ftmpa
38  read(71,rec=m1)ftmpb
39 c if iglint=1 then remove the direct component
40  if(kzz.eq.1 .and. iglint.eq.1)then
41  do i=nx,nmum1
42  do j=1,jpart
43  do k=1,4
44  abcz=dexp(-tautot/dabs(cosmu(i)))
45  ftmp(k,i,j)=ftmp(k,i,j)-fglint(k,i,j)*abcz
46  ftmpa(k,i,j)=ftmpa(k,i,j)-fglint(k,i,j)*abcz
47  ftmpb(k,i,j)=ftmpb(k,i,j)-fglint(k,i,j)*abcz
48  enddo
49  enddo
50  enddo
51  endif
52 c
53  do i=nx,nmum1
54  m=nmum1-i+1
55  do j=1,jpart
56  do k=1,4
57  if(ftmp(k,i,j).le.1.0d-15)then
58  fioup(k,m,j)=ftmp(k,i,j)
59  else
60  call geom(ftmpb(k,i,j),ftmpa(k,i,j),ftmp(k,i,j),
61  1 ratiog,fioup(k,m,j))
62  endif
63  enddo
64  enddo
65  enddo
66 c
67  read(72,rec=m3)ftmp
68  read(72,rec=m2)ftmpa
69  read(72,rec=m1)ftmpb
70 c
71 c if(iref .eq.1 .and. itrans.eq.1)then
72 c
73  do i=nx,nmum1
74  m=nmum1-i+1
75  do j=1,jpart
76  do k=1,4
77  if(ftmp(k,i,j).le.1.0d-15)then
78  fioup_btm(k,m,j)=ftmp(k,i,j)
79  else
80  call geom(ftmpb(k,i,j),ftmpa(k,i,j),ftmp(k,i,j),
81  1 ratiog,fioup_btm(k,m,j))
82  endif
83  enddo
84  enddo
85  enddo
86 c
87 c else
88 c
89  do i=1,nx-1
90  do j=1,jpart
91  do k=1,4
92  if(ftmp(k,i,j).le.1.0d-15)then
93  fiodn(k,i,j)=ftmp(k,i,j)
94  else
95  call geom(ftmpb(k,i,j),ftmpa(k,i,j),ftmp(k,i,j),
96  1 ratiog,fiodn(k,i,j))
97  endif
98  enddo
99  enddo
100  enddo
101 c
102 
103 c endif
104 c
105  if(kzz.eq.1)then
106  call outmds
107 c
108  fdirc(ksza)=amufpi
109  fdown(ksza)=temp1(nolyr+1)*pi
110  fup(ksza)=temp2(1)*pi
111  do i=1,nx-1
112  do j=1,jpart
113  xzeroz(1,ksza,i,j)=fioup(1,i,j)+fioup(2,i,j)
114  xzeroz(2,ksza,i,j)=fioup(1,i,j)-fioup(2,i,j)
115  xzeroz(3,ksza,i,j)=fioup(3,i,j)
116  xzeroz(4,ksza,i,j)=fioup(4,i,j)
117  xzerod(1,ksza,i,j)=fiodn(1,i,j)+fiodn(2,i,j)
118  xzerod(2,ksza,i,j)=fiodn(1,i,j)-fiodn(2,i,j)
119  xzerod(3,ksza,i,j)=fiodn(3,i,j)
120  xzerod(4,ksza,i,j)=fiodn(4,i,j)
121  enddo
122  enddo
123  if(iref.eq.1 .or. iref.eq.2 .or.iref.eq.3)then
124  oalb(ksza)=calb
125  endif
126  endif
127 c
128  do i=1,nx-1
129  do j=1,jpart
130  xzero_up(ksza,i,j)=fioup(1,i,j)+fioup(2,i,j)
131  xzero_btm(ksza,i,j)=fioup_btm(1,i,j)+fioup_btm(2,i,j)
132  enddo
133  enddo
134  if(kzz.eq.2 .and. itrans.eq.1)then
135  call outmds_trans
136  do i=1,nx-1
137  do j=1,jpart
138  xzero_up(ksza,i,j)=fioup(1,i,j)+fioup(2,i,j)
139  xzero_btm(ksza,i,j)=fioup_btm(1,i,j)+fioup_btm(2,i,j)
140  enddo
141  enddo
142  else if(kzz.eq.2 .and. itrans.eq.0)then
143  call outmds
144  ef=amuo*efactb(nolyr+1)
145  ftot=(gz+ef)
146  do i=1,nx-1
147  do j=1,jpart
148  tdn(1,i,j)=(fiodn(1,i,j)+fiodn(2,i,j))
149  tdn(2,i,j)=(fiodn(1,i,j)-fiodn(2,i,j))
150  tdn(3,i,j)=(fiodn(3,i,j))
151  tdn(4,i,j)=(fiodn(4,i,j))
152  tup(1,i,j)=(fioup(1,i,j)+fioup(2,i,j))
153  tup(2,i,j)=(fioup(1,i,j)-fioup(2,i,j))
154  tup(3,i,j)=(fioup(3,i,j))
155  tup(4,i,j)=(fioup(4,i,j))
156  enddo
157  enddo
158 c
159  sbarz(ksza)=sb
160  do i=1,nx-1
161  do j=1,jpart
162  do s=1,nstk
163  tupz(s,ksza,i,j)=tup(s,i,j)*ftot
164  tdwnz(s,ksza,i,j)=tdn(s,i,j)*ftot
165  enddo
166  enddo
167  enddo
168  endif
169 c
170  if(nsza.gt.1)then
171  ef=amuo*efactb(nolyr+1)
172  ftot=(gz+ef)
173  sbarz(ksza)=sb
174  do i=1,nx-1
175  do j=1,jpart
176  do s=1,nstk
177  tupz(s,ksza,i,j)=tup(s,i,j)*ftot
178  tdwnz(s,ksza,i,j)=tdn(s,i,j)*ftot
179  enddo
180  enddo
181  enddo
182  endif
183 c
184 c**********************************************************************
185  return
186  end
187 c************************************************************************
subroutine geocor
Definition: geocor.f:2
#define pi
Definition: vincenty.c:23
subroutine outmds_trans
Definition: outmds_trans.f:2
subroutine outmds
Definition: outmds.f:2