OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
get_l1a_data.f
Go to the documentation of this file.
1  subroutine get_l1a_data( prod_ID, nlin, msec, pos,
2  1 smat, att, tilt, iret)
3 
4 c get_l1a_data( prod_ID, nlin, msec, orb_vec, sen_mat, att, tilt, iret )
5 c
6 c Purpose: reads the scan line times and several navigation arrays from
7 c an open SeaWiFS L1A file.
8 c
9 c Calling Arguments:
10 c
11 c Name Type I/O Description
12 c -------- ---- --- -----------
13 c prod_ID I*4 I HDF file ID
14 c nlin I*4 I number of scan lines in the L1A file
15 c msec(*) I*4 O size nlin array of scan line times
16 c pos(3,*) R*4 O size 3 x nlin array of position vectors
17 c smat(3,3,*) R*4 O size 3 x 3 x nlin array of sensor matrices
18 c att(3,*) R*4 O size 3 x nlin array of attitude angles
19 c tilt(*) R*4 O size nlin array of tilt angles
20 c iret I*4 O return code
21 c =0, success
22 c =-1, failure
23 c
24 c By: F. S. Patt, SAIC GSC, 24 Sep 98
25 c
26 c Notes:
27 c
28 c Modification History:
29 c
30 
31  real*4 pos(3,*), smat(3,3,*), att(3,*), tilt(*)
32  integer*4 prod_ID, iret
33  integer*4 msec(*)
34  integer*4 or_id, se_id, at_id, ti_id, ms_id, ind
35  integer*4 istart(3), istr(3), idims(3), nflags(8)
36  integer sfn2index, sfselect, sfrdata, sfendacc
37  logical first/.true./
38  data istart/3*0/, istr/3*1/, idims/3*1/
39  data msecday/86400000/
40 
41  iret = 0
42 
43 c Get sdid for scan time times
44  ind = sfn2index(prod_id, 'msec')
45  if (ind.eq.-1) then
46  iret = -1
47  write(*,*) 'Error getting index for msec'
48  return
49  end if
50  ms_id = sfselect(prod_id, ind)
51  if (ms_id.eq.-1) then
52  iret = -1
53  write(*,*) 'Error selecting msec'
54  return
55  end if
56 
57 c Get sdid for orbit vectors
58  ind = sfn2index(prod_id, 'orb_vec')
59  if (ind.eq.-1) then
60  iret = -1
61  write(*,*) 'Error getting index for orb_vec'
62  return
63  end if
64  or_id = sfselect(prod_id, ind)
65  if (or_id.eq.-1) then
66  iret = -1
67  write(*,*) 'Error selecting orb_vec'
68  return
69  end if
70 
71 c Get sdid for attitude angles
72  ind = sfn2index(prod_id, 'att_ang')
73  if (ind.eq.-1) then
74  iret = -1
75  write(*,*) 'Error getting index for att_ang'
76  return
77  end if
78  at_id = sfselect(prod_id, ind)
79  if (at_id.eq.-1) then
80  iret = -1
81  write(*,*) 'Error selecting att_ang'
82  return
83  end if
84 
85 c Get sdid for sensor matrices
86  ind = sfn2index(prod_id, 'sen_mat')
87  if (ind.eq.-1) then
88  iret = -1
89  write(*,*) 'Error getting index for sen_mat'
90  return
91  end if
92  se_id = sfselect(prod_id, ind)
93  if (se_id.eq.-1) then
94  iret = -1
95  write(*,*) 'Error selecting sen_mat'
96  return
97  end if
98 
99 c Get sdid for tilt angles
100  ind = sfn2index(prod_id, 'tilt')
101  if (ind.eq.-1) then
102  iret = -1
103  write(*,*) 'Error getting index for tilt'
104  return
105  end if
106  ti_id = sfselect(prod_id, ind)
107  if (ti_id.eq.-1) then
108  iret = -1
109  write(*,*) 'Error selecting tilt'
110  return
111  end if
112 
113 
114 c Read sensor matrices
115  idims(1) = 3
116  idims(2) = 3
117  idims(3) = nlin
118  iret = sfrdata(se_id, istart, istr, idims, smat)
119  if (iret.eq.-1) then
120  write(*,*) 'Error reading sen_mat'
121  return
122  end if
123 
124 c Read orbit vectors
125  idims(2) = nlin
126  iret = sfrdata(or_id, istart, istr, idims, pos)
127  if (iret.eq.-1) then
128  write(*,*) 'Error reading orb_vec'
129  return
130  end if
131 
132 c Read attitude angles
133  iret = sfrdata(at_id, istart, istr, idims, att)
134  if (iret.eq.-1) then
135  write(*,*) 'Error reading att_ang'
136  return
137  end if
138 
139 c Read scan line times
140  idims(1) = nlin
141  iret = sfrdata(ms_id, istart, istr, idims, msec)
142  if (iret.eq.-1) then
143  write(*,*) 'Error reading msec'
144  return
145  end if
146 
147 c Read tilt angles
148  idims(1) = nlin
149  iret = sfrdata(ti_id, istart, istr, idims, tilt)
150  if (iret.eq.-1) then
151  write(*,*) 'Error reading tilt'
152  return
153  end if
154 
155 c Free sdid's
156  iret = sfendacc(or_id)
157  iret = sfendacc(se_id)
158  iret = sfendacc(at_id)
159  iret = sfendacc(ti_id)
160  iret = sfendacc(ms_id)
161 
162 c Check for day rollover during scene
163  if ((msec(nlin)-msec(1)).lt.(-msecday/2)) then
164 
165  ind = 1
166  dowhile((msec(ind+1)-msec(ind)).gt.(-msecday/2))
167  ind = ind + 1
168  end do
169  do i = ind+1,nlin
170  msec(i) = msec(i) + msecday
171  end do
172  end if
173 
174  return
175  end
176 
subroutine get_l1a_data(prod_ID, nlin, msec, pos, smat, att, tilt, iret)
Definition: get_l1a_data.f:3
#define real
Definition: DbAlgOcean.cpp:26