OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
put_l1a_data.f
Go to the documentation of this file.
1  subroutine put_l1a_data( prod_ID, nlin, smat, att, coef, iret)
2 
3 c put_l1a_data( prod_ID, nlin, smat, att, coef, iret)
4 c
5 c Purpose: writes the attitude angles, sensor orientation matrix and scan
6 c ellipse coefficients to a SeaWiFS L1A file
7 c
8 c Calling Arguments:
9 c
10 c Name Type I/O Description
11 c -------- ---- --- -----------
12 c prod_ID I*4 I HDF file ID for open file
13 c nlin I*4 I number of scan lines in the L1A file
14 c smat(3,3,*) R*4 I size 3 x 3 x nlin array of sensor matrices
15 c att(3,*) R*4 I size 3 x nlin array of attitude angles
16 c coef(6,*) R*4 I size 3 x nlin array of ellipse coefficients
17 c iret I*4 O return code
18 c =0, success
19 c =-1, failure
20 c
21 c By: F. S. Patt, SAIC GSC, 25 Sep 98
22 c
23 c Notes:
24 c
25 c Modification History:
26 c
27 c Modified to reset first nflag value to 0 in each scan line.
28 c F. S. Patt, SAIC GSC, 2 Feb 1999.
29 c
30 c Modified to reset both navigation fail and warning flags
31 c F. S. Patt, SAIC, March 19, 2003
32 
33 #include "nav_cnst.fin"
34 
35  real*4 smat(3,3,*), att(3,*), coef(6,*)
36  integer*4 prod_ID, iret
37  integer*4 se_id, at_id, co_id, nf_id, ind, i
38  integer*4 istart(3), istr(3), idims(3)
39  integer*4 nflag(8,maxlin)
40  integer sfn2index, sfselect, sfwdata, sfendacc
41  data istart/3*0/, istr/3*1/
42 
43  iret = 0
44 
45  ind = sfn2index(prod_id, 'att_ang')
46  if (ind.eq.-1) then
47  iret = -1
48  write(*,*) 'Error getting index for att_ang'
49  return
50  end if
51  at_id = sfselect(prod_id, ind)
52  if (at_id.eq.-1) then
53  iret = -1
54  write(*,*) 'Error selecting att_ang'
55  return
56  end if
57 
58  ind = sfn2index(prod_id, 'sen_mat')
59  if (ind.eq.-1) then
60  iret = -1
61  write(*,*) 'Error getting index for sen_mat'
62  return
63  end if
64  se_id = sfselect(prod_id, ind)
65  if (se_id.eq.-1) then
66  iret = -1
67  write(*,*) 'Error selecting sen_mat'
68  return
69  end if
70 
71  ind = sfn2index(prod_id, 'scan_ell')
72  if (ind.eq.-1) then
73  iret = -1
74  write(*,*) 'Error getting index for scan_ell'
75  return
76  end if
77  co_id = sfselect(prod_id, ind)
78  if (co_id.eq.-1) then
79  iret = -1
80  write(*,*) 'Error selecting scan_ell'
81  return
82  end if
83 
84  ind = sfn2index(prod_id, 'nflag')
85  if (ind.eq.-1) then
86  iret = -1
87  write(*,*) 'Error getting index for nflag'
88  return
89  end if
90  nf_id = sfselect(prod_id, ind)
91  if (nf_id.eq.-1) then
92  iret = -1
93  write(*,*) 'Error selecting nflag'
94  return
95  end if
96 
97  idims(1) = 3
98  idims(2) = 3
99  idims(3) = nlin
100  iret = sfwdata(se_id, istart, istr, idims, smat)
101  if (iret.eq.-1) then
102  write(*,*) 'Error writing sen_mat'
103  return
104  end if
105 
106  idims(2) = nlin
107  iret = sfwdata(at_id, istart, istr, idims, att)
108  if (iret.eq.-1) then
109  write(*,*) 'Error writing att_ang'
110  return
111  end if
112 
113  idims(1) = 6
114  iret = sfwdata(co_id, istart, istr, idims, coef)
115  if (iret.eq.-1) then
116  write(*,*) 'Error writing scan_ell'
117  return
118  end if
119 
120  idims(1) = 8
121  iret = sfrdata(nf_id, istart, istr, idims, nflag)
122  if (iret.eq.-1) then
123  write(*,*) 'Error reading nflag'
124  return
125  end if
126 
127 c Reset navfail and navwarn flags
128  do i=1,nlin
129  nflag(1,i) = 0
130  if (nflag(7,i).eq.0) nflag(8,i) = 0
131  end do
132 
133  iret = sfwdata(nf_id, istart, istr, idims, nflag)
134  if (iret.eq.-1) then
135  write(*,*) 'Error writing nflag'
136  return
137  end if
138 
139  iret = sfendacc(se_id)
140  iret = sfendacc(at_id)
141  iret = sfendacc(co_id)
142  iret = sfendacc(nf_id)
143 
144  return
145  end
146 
subroutine put_l1a_data(prod_ID, nlin, smat, att, coef, iret)
Definition: put_l1a_data.f:2
#define real
Definition: DbAlgOcean.cpp:26