OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
czcscaleg.f
Go to the documentation of this file.
1  subroutine czcscal(iorbit,slopech,yintch,icnts,igain,rlt)
2 c
3 c Calibrates CZCS radiances according to Evans and Gordon, 1994.
4 c
5 c Name Type I/O Description
6 c ---------- ---- --- --------------------------------
7 c iorbit int I orbit count
8 c slopech real I size 5 slope data for 5 vis bands
9 c yintch real I size 5 intercept for 5 vis bands
10 c icnts int*2 I raw radiance counts for 5 vis bands
11 c igain int O derived gain
12 c rlt real O size 5 calibrated radiances
13 c
14 c From Watson Gregg, modified be W. Robinson, 29 Apr 2004
15 c
16 c
17 c rlt - O calibrated radiances for 5 vis bands
18  save ifst
19  parameter(npix=1968,nlt=5,nltc=4)
20  integer*2 icnts(nlt)
21  real slope(nltc,4),yint(nltc,4),rk(nltc,4)
22  real slopech(nlt),yintch(nlt)
23  real g(nltc)
24  integer iorbdec(5)
25  real dec(nltc,5)
26  real S(nlt),rlt(nlt)
27  data ifst /0/
28 c
29 c Band 1 Band 2 Band 3 Band 4
30  data slope /0.04452,0.03103,0.02467,0.01136, !Gain 1
31  * 0.03598,0.02493,0.02015,0.00897, !Gain 2
32  * 0.02968,0.02032,0.01643,0.00741, !Gain 3
33  * 0.02113,0.01486,0.01181,0.00535/ !Gain 4
34  data yint /0.03963,0.05361,0.08013,0.01136,
35  * 0.03963,0.05361,0.08013,0.01136,
36  * 0.03963,0.06461,0.09503,0.01136,
37  * 0.03963,0.06361,0.09159,0.01136/
38  data rk /1.018,0.982,0.974,1.008,
39  * 1.021,0.983,0.963,1.020,
40  * 1.011,0.988,0.947,1.016,
41  * 1.020,0.972,0.950,1.010/
42  data iorbdec /1,5000,7000,20000,39000/
43  data dec /1.0, 1.0, 1.0, 1.0,
44  * 0.92,0.98,0.99,1.0,
45  * 0.84,0.97,0.99,1.0,
46  * 0.73,0.86,0.91,1.0,
47  * 0.59,0.78,0.84,0.91/
48 c
49  if (ifst .eq. 0)then
50 c Find gain
51  call gain(slopech,slope,igain)
52 c write(6,*)'Gain = ',igain
53 c Find decay
54 c write(6,*)'iorbit = ',iorbit
55  iorbit = min(iorbit,39000)
56  do i = 1,4
57  if (iorbit .ge. iorbdec(i) .and. iorbit .lt. iorbdec(i+1))then
58  idec = i
59  endif
60  enddo
61 c write(6,*)'idec = ',idec
62  i = idec
63  x1 = float(iorbdec(i))
64  x2 = float(iorbdec(i+1))
65  rden = x2-x1
66  do nl = 1,nltc
67  rnum = dec(nl,i+1) - dec(nl,i)
68  slp = rnum/rden
69  gm1 = float(iorbit-iorbdec(i))*slp + dec(nl,i)
70  g(nl) = 1.0/gm1
71  enddo
72 c Adjust calibration of Band 4 according to Evans and Antoine,
73 c personal communication
74  iorb4 = 6750
75  if (iorbit .gt. iorb4)then
76  x1 = float(iorb4)
77  x2 = float(iorbdec(5))
78  rden = x2-x1
79  nl = nltc
80  rnum = dec(nl,5) - dec(nl,4)
81  slp = rnum/rden
82  gm1 = float(iorbit-iorb4)*slp + dec(nl,4)
83  g(nl) = 1.0/gm1
84  endif
85  do nl = 1,nltc
86 c write(6,*)'i,nl,dec,dec,g = ',i,nl,dec(nl,i),dec(nl,i+1),g(nl)
87  enddo
88  s(nlt) = 0.0
89  ifst = 1
90  slope1 = slopech(1)
91  endif
92 c
93 c Slope
94  if (slopech(1) .ne. slope1)call gain(slopech,slope,igain)
95  ig = igain
96  do nl = 1,nltc
97  s(nl) = g(nl)*rk(nl,ig)*slope(nl,ig)
98  rlt(nl) = s(nl)*float(icnts(nl)) + yint(nl,ig)
99 c write(6,*)'nl,icnts,rlt = ',nl,icnts(nl),rlt(nl)
100  enddo
101  rlt(nlt) = slopech(nlt)*icnts(nlt) + yintch(nlt)
102 c
103  return
104  end
105 c
106 c ****************************************************************
107  subroutine gain(slopech,slope,igain)
108 c
109 c Computes gain from tabulated slopes given in the data file.
110 c
111  parameter(nlt=5,nltc=4)
112  real slope(nltc,4)
113  real slopech(nlt)
114 c
115  dif1 = 99999.0
116  do ig = 1,4
117  dif = abs(slopech(1) - slope(1,ig))
118  if (dif .lt. dif1)then
119  dif1 = dif
120  igain = ig
121  endif
122  enddo
123 c
124  return
125  end
subroutine czcscal(iorbit, slopech, yintch, icnts, igain, rlt)
Definition: czcscaleg.f:2
README for MOD_PR03(V6.1.0) 2. POINTS OF CONTACT it can be either SDP Toolkit or MODIS Packet for Terra input files The orbit validation configuration parameter(LUN 600281) must be either "TRUE" or "FALSE". It needs to be "FALSE" when running in Near Real Time mode
#define min(A, B)
Definition: main_biosmap.c:62
#define abs(a)
Definition: misc.h:90