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 'common_all.cmn'
10 c
11 c**********************************************************************
12 c
13  m1=jpass-2
14  m2=jpass-1
15  m3=jpass
16 c
17 c apply geo. series correction to the fluxes leaving the bottom
18 c of the atmosphere
19 c
20  call geom(fluxd(m1,nolyrp),fluxd(m2,nolyrp),fluxd(m3,nolyrp),
21  1 rr1,temp1(nolyrp))
22  call geom(fluxu(m1,1),fluxu(m2,1),fluxu(m3,1),
23  1 rr2,temp2(1))
24 c
25  if(kzz.eq.1)then
26  totflxgs=temp1(nolyrp)+temp2(1)+amuo*factr
27  ctest=totflxgs/amuo
28  endif
29  if(kzz.eq.1)gz=temp1(nolyrp)
30  if(kzz.eq.2 .and. itrans.eq.0)sb=temp1(nolyrp)
31 c
32 c apply geo. series correction to the radiances leaving the top &
33 c bottom of the atmosphere
34 c
35  read(71,rec=m3)ftmp
36  read(71,rec=m2)ftmpa
37  read(71,rec=m1)ftmpb
38 c if iglint=1 then remove the direct component
39  if(kzz.eq.1 .and. iglint.eq.1)then
40  do i=jjj,nmum1
41  do j=1,jpart
42  do k=1,4
43  abcz=dexp(-tautot/dabs(bmu(i)))
44  ftmp(k,i,j)=ftmp(k,i,j)-fglint(k,i,j)*abcz
45  ftmpa(k,i,j)=ftmpa(k,i,j)-fglint(k,i,j)*abcz
46  ftmpb(k,i,j)=ftmpb(k,i,j)-fglint(k,i,j)*abcz
47  enddo
48  enddo
49  enddo
50  endif
51 c
52  do i=jjj,nmum1
53  m=nmum1-i+1
54  do j=1,jpart
55  do k=1,4
56  if(ftmp(k,i,j).le.1.0d-15)then
57  fioup(k,m,j)=ftmp(k,i,j)
58  else
59  call geom(ftmpb(k,i,j),ftmpa(k,i,j),ftmp(k,i,j),
60  1 ratiog,fioup(k,m,j))
61  endif
62  enddo
63  enddo
64  enddo
65 c
66  read(72,rec=m3)ftmp
67  read(72,rec=m2)ftmpa
68  read(72,rec=m1)ftmpb
69 c
70  if(iref .eq.1 .and. itrans.eq.1)then
71 c
72  do i=jjj,nmum1
73  m=nmum1-i+1
74  do j=1,jpart
75  do k=1,4
76  if(ftmp(k,i,j).le.1.0d-15)then
77  fioup_btm(k,m,j)=ftmp(k,i,j)
78  else
79  call geom(ftmpb(k,i,j),ftmpa(k,i,j),ftmp(k,i,j),
80  1 ratiog,fioup_btm(k,m,j))
81  endif
82  enddo
83  enddo
84  enddo
85 c
86  else
87 c
88  do i=1,jjjj
89  do j=1,jpart
90  do k=1,4
91  if(ftmp(k,i,j).le.1.0d-15)then
92  fiodn(k,i,j)=ftmp(k,i,j)
93  else
94  call geom(ftmpb(k,i,j),ftmpa(k,i,j),ftmp(k,i,j),
95  1 ratiog,fiodn(k,i,j))
96  endif
97  enddo
98  enddo
99  enddo
100 c
101 
102  endif
103 c
104  if(kzz.eq.1)then
105  call outmds
106 c
107  fdirc(ksza)=amufpi
108  fdown(ksza)=temp1(nolyrp)*pi
109  fup(ksza)=temp2(1)*pi
110  do i=1,jjjj
111  do j=1,jpart
112  xzeroz(ksza,i,j)=fioup(1,i,j)+fioup(2,i,j)
113  xzerod(ksza,i,j)=fiodn(1,i,j)+fiodn(2,i,j)
114  enddo
115  enddo
116  if(iref.eq.1 .or. iref.eq.2 .or.iref.eq.3)then
117  oalb(ksza)=calb
118  endif
119  endif
120 c
121  if(kzz.eq.2 .and. itrans.eq.1)then
122  call outmds_trans
123  do i=1,jjjj
124  do j=1,jpart
125  xzero_up(ksza,i,j)=fioup(1,i,j)+fioup(2,i,j)
126  xzero_btm(ksza,i,j)=fioup_btm(1,i,j)+fioup_btm(2,i,j)
127  enddo
128  enddo
129  else if(kzz.eq.2 .and. itrans.eq.0)then
130  call outmds
131  ef=amuo*efactb(nolyrp)
132  ftot=(gz+ef)
133  do i=1,jjjj
134  do j=1,jpart
135  tdn(i,j)=(fiodn(1,i,j)+fiodn(2,i,j))
136  tup(i,j)=(fioup(1,i,j)+fioup(2,i,j))
137  enddo
138  enddo
139 c
140  sbarz(ksza)=sb
141  do i=1,jjjj
142  do j=1,jpart
143  tupz(ksza,i,j)=tup(i,j)*ftot
144  tdwnz(ksza,i,j)=tdn(i,j)*ftot
145  enddo
146  enddo
147  endif
148 c
149  if(nsza.gt.1)then
150  ef=amuo*efactb(nolyrp)
151  ftot=(gz+ef)
152  sbarz(ksza)=sb
153  do i=1,jjjj
154  do j=1,jpart
155  tupz(ksza,i,j)=tup(i,j)*ftot
156  tdwnz(ksza,i,j)=tdn(i,j)*ftot
157  enddo
158  enddo
159  endif
160 c
161 c**********************************************************************
162  return
163  end
164 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