OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
get_l1a_open.f
Go to the documentation of this file.
1  subroutine get_l1a_open( infile, amode, prod_ID, isday,
2  * nlin, iret )
3 
4 c get_l1a_open( infile, amode, prod_ID, nlin, iret )
5 c
6 c Purpose: opens a L1A HDF file and reads the number of scan lines attribute
7 c
8 c Calling Arguments:
9 c
10 c Name Type I/O Description
11 c -------- ---- --- -----------
12 c infile char I size 80 L1A file name string
13 c amode I*4 I mode for HDF file open
14 c =1, read-only
15 c =3, read/write
16 c prod_ID I*4 O HDF file ID
17 c isday I*4 O Start day of file
18 c nlin I*4 O number of scan lines in the L1A file
19 c iret I*4 O return code
20 c =0, success
21 c =-1, failure
22 c
23 c By: F. S. Patt, SAIC GSC, 24 Sep 98
24 c
25 c Notes:
26 c
27 c Modification History:
28 c
29 c Modified to read and return 'Start Day' attribute from file.
30 c F. S. Patt, SAIC GSC, April 22, 1999.
31 c
32 c Modified to read start year and convert start day to Julian day,
33 c to solve year-rollover problem.
34 c F. S. Patt, SAIC, November 5, 2002.
35 
36 
37  character*80 infile
38  integer*4 prod_ID, at_id
39  integer*4 nlin
40  integer*4 amode
41  integer*4 isday,isyr
42  integer*2 iday,iyr
43  integer sfstart, sffattr, sfrattr
44 
45  iret = 0
46 
47  prod_id = sfstart(infile, amode)
48  if (prod_id.eq.-1) then
49  write(*,*)'Error opening HDF file'
50  iret = -1
51  return
52  endif
53 
54  at_id = sffattr(prod_id, 'Number of Scan Lines')
55  if (at_id.eq.-1) then
56  write(*,*)'Error getting index for Number of Scan Lines'
57  iret = -1
58  return
59  endif
60 
61  iret = sfrattr(prod_id, at_id, nlin)
62  if (iret.eq.-1) then
63  write(*,*)'Error getting value for Number of Scan Lines'
64  return
65  endif
66 
67  at_id = sffattr(prod_id, 'Start Day')
68  if (at_id.eq.-1) then
69  write(*,*)'Error getting index for Start Day'
70  iret = -1
71  return
72  endif
73 
74  iret = sfrattr(prod_id, at_id, iday)
75  if (iret.eq.-1) then
76  write(*,*)'Error getting value for Start Day'
77  return
78  endif
79 
80  isday = iday
81 
82  at_id = sffattr(prod_id, 'Start Year')
83  if (at_id.eq.-1) then
84  write(*,*)'Error getting index for Start Year'
85  iret = -1
86  return
87  endif
88 
89  iret = sfrattr(prod_id, at_id, iyr)
90  if (iret.eq.-1) then
91  write(*,*)'Error getting value for Start Year'
92  return
93  endif
94 
95  isyr = iyr
96 
97  isday = jd(isyr,1,isday)
98 
99  return
100  end
101 
102 
Definition: jd.py:1
subroutine get_l1a_open(infile, amode, prod_ID, isday, nlin, iret)
Definition: get_l1a_open.f:3