OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
pack_412.f
Go to the documentation of this file.
1 c-------------------------------------------------------------
2  subroutine rsfc412(dflag2,mod_sfc,xday,xthet,xphi,scat_ang,r412)
3 c
4  integer mod_sfc, nc_wav(5), index_iw
5  logical dflag2
6  real xday,r412p,xsfc412p,frac_iw
7  real xthet,xphi,scat_ang,r412
8  real wav1(16),sfc1(16),wav2(16),sfc2(16)
9  real wav3(16),sfc3(16),wav4(15),sfc4(15)
10  real wav5(15),sfc5(15)
11  real wav1_ond(15),sfc1_ond(15)
12  real wav1_jf(15), sfc1_jf(15)
13  real wav1_mam(15),sfc1_mam(15)
14  character *60 xname_wav(5)
15  data xname_wav /'Harmim','Mezaira','Al_Khaznah',
16  1 'Sai_Salam','SMART'/
17  data nc_wav /16,16,16,15,15/
18  data nc_wav_ond /15/
19  data nc_wav_jf /15/
20  data nc_wav_mam /15/
21  data wav1 /-62.2694,-57.1807,-51.0789,-43.4577,-34.2380,
22  1 -23.0985, -10.1670,-9.66400, 3.88359, 17.4518, 29.4005,
23  1 39.5023, 47.6345, 54.2590, 59.7262, 64.2073/
24  data sfc1 /8.99260,9.73873,9.93104,9.84897,9.45576,
25  1 9.23501,9.13252,9.12330,8.55226,8.60710,8.95064,
26  1 9.00080,9.14428,9.15092,9.09600,9.07312/
27  data wav2 /-65.2144,-60.7404,-55.3780,-48.8869,-40.6035,
28  1 -30.8647, -19.0751,-5.59166, 8.29930, 21.4201, 32.7246,
29  1 42.2137, 49.7960, 56.0005, 61.1576, 65.3304/
30  data sfc2 /10.5924,10.4384,10.6512,10.7640,10.2053,
31  1 10.0751,10.0022,9.87149,9.03432,9.31455,9.63064,
32  1 9.61609,10.0515,10.2903,9.67356,9.55387/
33  data wav3 /-65.0665,-60.5814,-55.2427,-48.7424,-40.7624,
34  1 -30.8889, -19.1950,-5.84152, 7.86039, 21.0191, 32.2845,
35  1 41.6669, 49.4183, 55.6076, 60.8122, 65.1024/
36  data sfc3 /11.3743,11.5292,12.1709,12.4900,12.1680,
37  1 11.8708,11.5987,10.6814,10.5286,10.6991,10.4998,
38  1 10.4047,10.5189,10.1996,10.1292,10.0239/
39  data wav4 /-61.5411,-56.4792,-50.1862,-42.6219,-33.1955,
40  1 -21.9909, -9.07847, 4.54637, 17.8186, 29.6754, 39.4847,
41  1 47.5092, 54.1248, 59.5025, 63.9649/
42  data sfc4 /13.8277,14.2728,13.9865,14.0596,13.5513,
43  1 13.1604,12.3758,12.3556,12.1580,12.2147,12.3659,
44  1 12.3154,12.1898,12.1819,12.4827/
45  data wav5 /-62.1827,-57.1542,-51.0592,-43.6501,-34.5908,
46  1 -23.3993, -10.6227, 3.20328, 16.5169, 28.6361, 38.6162,
47  1 46.9379, 53.6876, 59.1098, 63.7301/
48  data sfc5 /8.55188,9.39847,9.08119,8.26033,7.64707,
49  1 7.60514,7.36482,7.11801,6.97991,7.16096,7.57389,
50  1 8.00454,8.02307,7.92663,7.96206/
51 
52  data wav1_ond /-62.320,-57.277,-51.116,-43.613,-34.427,
53  1 -23.160,-10.255, 3.8275, 17.257, 29.243, 39.410,
54  1 47.510, 54.190, 59.630, 64.150/
55  data sfc1_ond /10.9800,10.0325, 10.230, 9.6033, 9.160,
56  1 8.0350, 8.7350, 8.3525, 8.3100, 8.8467, 8.900,
57  1 9.1900, 9.7500, 9.3000, 9.2700/
58  data wav1_jf /-62.367,-57.350,-51.200,-43.760,-34.425,
59  1 -23.160,-10.283, 3.4000, 17.147, 29.137, 39.263,
60  1 47.500, 54.140, 59.590, 64.160/
61  data sfc1_jf / 9.3475, 8.9250, 9.3300, 8.5600, 8.8600,
62  1 9.0400, 8.2333, 8.1650, 8.0100, 8.3450, 8.4967,
63  1 8.6400, 8.9500, 8.8000, 7.7700/
64  data wav1_mam /-62.410,-57.403,-51.347,-43.770,-34.595,
65  1 -23.380,-10.533, 3.510, 16.877, 28.947, 39.235,
66  1 47.353, 54.147, 59.533, 64.097/
67  data sfc1_mam / 9.5100, 9.9200, 9.3300, 9.5600, 8.9150,
68  1 9.5375, 8.6567, 8.5633, 8.5100, 8.7433, 8.6950,
69  1 8.8400, 8.9933, 8.9500, 8.6700/
70 
71  dflag2 = .false.
72 
73  xxfac = 8.1650 / 8.55226
74  if (xday.gt.59.0.and.xday.le.181.0)
75  1 xxfac = 8.5633 / 8.55226
76  if (xday.gt.181.0.and.xday.le.273.0)
77  1 xxfac = 1.0
78  if (xday.gt.273.0.and.xday.le.360.0)
79  1 xxfac = 8.3525 / 8.55226
80 
81  if (mod_sfc.eq.9) then
82 c-- JF
83  dd = xthet
84  if (xphi.gt.90.0) dd = -1. *xthet
85  if (dd.le.wav1_jf(1)) then
86  r412 = sfc1_jf(1)
87  return
88  endif
89  if (dd.ge.wav1_jf(nc_wav_jf)) then
90  r412 = sfc1_jf(nc_wav_jf)
91  return
92  endif
93  call search2(dflag2,dd,wav1_jf,nc_wav_jf,index_iw,frac_iw)
94  if (dflag2) return
95  r412 =frac_iw*sfc1_jf(index_iw+1)+(1.-frac_iw)*sfc1_jf(index_iw)
96 
97 c-- MAM
98  if (xday.gt.59.0.and.xday.le.181.0) then
99  dd = xthet
100  if (xphi.gt.90.0) dd = -1. *xthet
101  if (dd.le.wav1_mam(1)) then
102  r412 = sfc1_mam(1)
103  return
104  endif
105  if (dd.ge.wav1_mam(nc_wav_mam)) then
106  r412 = sfc1_mam(nc_wav_mam)
107  return
108  endif
109  call search2(dflag2,dd,wav1_mam,nc_wav_mam,index_iw,frac_iw)
110  if (dflag2) return
111  r412 =frac_iw*sfc1_mam(index_iw+1)
112  1 +(1.-frac_iw)*sfc1_mam(index_iw)
113  endif
114 
115 c-- JAS
116  if (xday.gt.181.0.and.xday.le.273.0) then
117  dd = xthet
118  if (xphi.gt.90.0) dd = -1. *xthet
119  if (dd.le.wav1(1)) then
120  r412 = sfc1(1)
121  return
122  endif
123  if (dd.ge.wav1(nc_wav(1))) then
124  r412 = sfc1(nc_wav(1))
125  return
126  endif
127  call search2(dflag2,dd,wav1,nc_wav(1),index_iw,frac_iw)
128  if (dflag2) return
129  r412 = frac_iw*sfc1(index_iw+1) + (1.-frac_iw)*sfc1(index_iw)
130  endif
131 
132 c-- OND
133  if (xday.gt.273.0.and.xday.le.360.0) then
134  dd = xthet
135  if (xphi.gt.90.0) dd = -1. *xthet
136  if (dd.le.wav1_ond(1)) then
137  r412 = sfc1_ond(1)
138  return
139  endif
140  if (dd.ge.wav1_ond(nc_wav_ond)) then
141  r412 = sfc1_ond(nc_wav_ond)
142  return
143  endif
144  call search2(dflag2,dd,wav1_ond,nc_wav_ond,index_iw,frac_iw)
145  if (dflag2) return
146  r412 =frac_iw*sfc1_ond(index_iw+1)
147  1 +(1.-frac_iw)*sfc1_ond(index_iw)
148  endif
149 
150  endif
151 
152  if (mod_sfc.eq.10) then
153  dd = xthet
154  if (xphi.gt.90.0) dd = -1. *xthet
155  if (dd.le.wav2(1)) then
156  r412 = sfc2(1) *xxfac
157  return
158  endif
159  if (dd.ge.wav2(nc_wav(2))) then
160  r412 = sfc2(nc_wav(2)) *xxfac
161  return
162  endif
163  call search2(dflag2,dd,wav2,nc_wav(2),index_iw,frac_iw)
164  if (dflag2) return
165  r412 =(frac_iw*sfc2(index_iw+1) +(1.-frac_iw)*sfc2(index_iw))
166  1 *xxfac
167  endif
168 
169  if (mod_sfc.eq.11) then
170  dd = xthet
171  if (xphi.gt.90.0) dd = -1. *xthet
172  if (dd.le.wav3(1)) then
173  r412 = sfc3(1) *xxfac
174  return
175  endif
176  if (dd.ge.wav3(nc_wav(3))) then
177  r412 = sfc3(nc_wav(3)) *xxfac
178  return
179  endif
180  call search2(dflag2,dd,wav3,nc_wav(3),index_iw,frac_iw)
181  if (dflag2) return
182  r412 =(frac_iw*sfc3(index_iw+1) +(1.-frac_iw)*sfc3(index_iw))
183  1 *xxfac
184  endif
185 
186  if (mod_sfc.eq.12) then
187  dd = xthet
188  if (xphi.gt.90.0) dd = -1. *xthet
189  if (dd.le.wav4(1)) then
190  r412 = sfc4(1) *xxfac
191  return
192  endif
193  if (dd.ge.wav4(nc_wav(4))) then
194  r412 = sfc4(nc_wav(4)) *xxfac
195  return
196  endif
197  call search2(dflag2,dd,wav4,nc_wav(4),index_iw,frac_iw)
198  if (dflag2) return
199  r412 =(frac_iw*sfc4(index_iw+1) +(1.-frac_iw)*sfc4(index_iw))
200  1 *xxfac
201  endif
202 
203  if (mod_sfc.eq.15) then
204  dd = xthet
205  if (xphi.gt.90.0) dd = -1. *xthet
206  if (dd.le.wav5(1)) then
207  r412 = sfc5(1) *xxfac
208  return
209  endif
210  if (dd.ge.wav5(nc_wav(5))) then
211  r412 = sfc5(nc_wav(5)) *xxfac
212  return
213  endif
214  call search2(dflag2,dd,wav5,nc_wav(5),index_iw,frac_iw)
215  if (dflag2) return
216  r412 =(frac_iw*sfc5(index_iw+1) +(1.-frac_iw)*sfc5(index_iw))
217  1 *xxfac
218  endif
219 
220  return
221  end
222 
223 c-------------------------------------------------------------
224  subroutine newsfc412_arab(dflag2,mod_sfc,xday,xlatp,xlonp,xthet,
225  1 xphi,scat_ang,terrain_flag_new5,r412_135, r412new)
226 
227 c
228  include 'aottbl.inc'
229  include 'newaottbl.inc'
230 
231  integer mod_sfc, jtime
232  logical dflag2
233  real xday,r412p,xsfc412p
234  integer xlatp, xlonp
235  real terrain_flag_new5
236  real xthet,xphi,scat_ang,r412new1,r412new2
237  real dd1, xnorm_fac1, xnorm_fac2
238  real r412new, xx, xnorm_fac
239  real xfac9(4), xfac10(4), xfac11(4), xfac12(4)
240  real xfac13(4), xfac14(4), xfac15(4), xfac16(4)
241  real xcc(8,4), xfacp(8)
242  character* 3 name(4)
243 
244  data name /'win', 'spr', 'sum', 'fal'/
245  data xfac9 / 7.8650, 8.1939, 9.0053, 9.0/ !for viirs
246  data xfac10 / 10.4847, 10.6111, 9.78469, 0.0/
247  data xfac11 / 11.0870, 10.6779, 10.3870, 0.0/
248  data xfac12 / 12.8442, 11.9320, 12.1442, 0.0/
249  data xfac13 / 12.8442, 11.9320, 12.1442, 0.0/
250  data xfac14 / 12.8442, 11.9320, 12.1442, 0.0/
251  data xfac15 / 8.52884, 8.17331, 7.82884, 0.0/
252  data xfac16 / 11.2968, 12.1234, 10.5265, 0.0/
253 
254 c -- Interpolate seasonal tables
255  do i = 1,8
256  do j = 1,3
257  xcc(i,j) = -999.0
258  enddo
259  enddo
260 
261  do i = 1, 8
262  if (i.eq.1) then
263  do j = 1, 4
264  xcc(i,j) = xfac9(j)
265  enddo
266  endif
267  if (i.eq.2) then
268  do j = 1, 4
269  xcc(i,j) = xfac10(j)
270  enddo
271  endif
272  if (i.eq.3) then
273  do j = 1, 4
274  xcc(i,j) = xfac11(j)
275  enddo
276  endif
277  if (i.eq.4) then
278  do j = 1, 4
279  xcc(i,j) = xfac12(j)
280  enddo
281  endif
282  if (i.eq.5) then
283  do j = 1, 4
284  xcc(i,j) = xfac13(j)
285  enddo
286  endif
287  if (i.eq.6) then
288  do j = 1, 4
289  xcc(i,j) = xfac14(j)
290  enddo
291  endif
292  if (i.eq.7) then
293  do j = 1, 4
294  xcc(i,j) = xfac15(j)
295  enddo
296  endif
297  if (i.eq.8) then
298  do j = 1, 4
299  xcc(i,j) = xfac16(j)
300  enddo
301  endif
302  enddo
303 
304  jtime = 1
305  if (xday.ge.60.0.and.xday.lt.152.0) jtime = 2
306  if (xday.ge.152.0.and.xday.lt.244.0) jtime = 3
307  if (xday.ge.244.0.and.xday.lt.335.0) jtime = 4
308 
309  do i = 1, 8
310  xfacp(i) = xcc(i,jtime)
311  enddo
312 
313 c -- interpolate bi-directional factors
314 
315  dflag2 = .false.
316 
317  mod_sfc = 9
318  call rsfc412(dflag2,mod_sfc,xday,xthet,xphi,scat_ang,r412new2)
319  xnorm_fac1 = r412new2 / xfacp(1)
320  r412new = r412_135 * xnorm_fac1
321  return
322  end
subroutine rsfc412(dflag2, mod_sfc, xday, xthet, xphi, scat_ang, r412)
Definition: pack_412.f:3
subroutine search2(dflag, xbar, x, n, i, fx)
subroutine newsfc412_arab(dflag2, mod_sfc, xday, xlatp, xlonp, xthet, xphi, scat_ang, terrain_flag_new5, r412_135, r412new)
Definition: pack_412.f:226