-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhimawari_readheader.f90
197 lines (152 loc) · 5.38 KB
/
himawari_readheader.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
!******************************************************************************%
! *
! * Copyright (C) 2016 Simon Proud <[email protected]>
! *
! * This source code is licensed under the GNU General Public License (GPL),
! * Version 3. See the file COPYING for more details.
! *
! ******************************************************************************/
!*******************************************************************************
! Module containing the Fortran interface to himawari_native_util. Please see
! the comments in the C code for descriptions of the various routines including
! their arguments and return values.
!*******************************************************************************
module himawari_readheader
use himawari
use himawari_headerinfo
use iso_c_binding
implicit none
private
public :: AHI_readhdr_IR, \
AHI_readhdr_VIS
contains
integer function AHI_readhdr_IR(filelun,ahi_hdr,verbose)result(status)
type(himawari_t_IR_Header),intent(inout) :: ahi_hdr
integer,intent(in) :: filelun
logical, intent(in) :: verbose
integer :: retval,fpos
type(himawari_t_Basic_Info) :: him_basic
type(himawari_t_Data_Info) :: him_data
type(himawari_t_Proj_Info) :: him_proj
type(himawari_t_Navi_Info) :: him_nav
type(himawari_t_Calib_Info) :: him_calib
type(himawari_t_IR_Calib_Info) :: him_chan_calib
type(himawari_t_InterCalib_Info) :: him_interCalib
type(himawari_t_Segm_Info) :: him_seg
type(himawari_t_NaviCorr_Info) :: him_navcorr
type(himawari_t_ObsTime_Info) :: him_obstime
type(himawari_t_Error_Info) :: him_error
type(himawari_t_Spare) :: him_spare
type(himawari_t_Correct_Table) :: him_correct_table
fpos = 0
call fseek(filelun,fpos,0,retval)
read(filelun)him_basic
fpos = fpos + him_basic%BlockLen
call fseek(filelun,fpos,0,retval)
read(filelun)him_data
fpos = fpos + him_data%BlockLen
call fseek(filelun,fpos,0,retval)
read(filelun)him_proj
fpos = fpos + him_proj%BlockLen
call fseek(filelun,fpos,0,retval)
read(filelun)him_nav
fpos = fpos + him_nav%BlockLen
call fseek(filelun,fpos,0,retval)
read(filelun)him_calib
read(filelun)him_chan_calib
fpos = fpos + him_calib%BlockLen
call fseek(filelun,fpos,0,retval)
read(filelun)him_interCalib
fpos = fpos + him_interCalib%BlockLen
call fseek(filelun,fpos,0,retval)
read(filelun)him_seg
fpos = fpos + him_seg%BlockLen
call fseek(filelun,fpos,0,retval)
read(filelun)him_navcorr
fpos = fpos + him_navcorr%BlockLen
call fseek(filelun,fpos,0,retval)
read(filelun)him_obstime
fpos = fpos + him_obstime%BlockLen
call fseek(filelun,fpos,0,retval)
read(filelun)him_error
fpos = fpos + him_error%BlockLen
call fseek(filelun,fpos,0,retval)
call fseek(filelun,him_basic%totalHeaderLen,0,retval)
ahi_hdr%him_basic = him_basic
ahi_hdr%him_proj = him_proj
ahi_hdr%him_nav = him_nav
ahi_hdr%him_calib = him_calib
ahi_hdr%him_chan_calib = him_chan_calib
ahi_hdr%him_interCalib = him_interCalib
ahi_hdr%him_seg = him_seg
ahi_hdr%him_navcorr = him_navcorr
ahi_hdr%him_obstime = him_obstime
ahi_hdr%him_error = him_error
status = HIMAWARI_SUCCESS
return
end function AHI_readhdr_IR
integer function AHI_readhdr_VIS(filelun,ahi_hdr,verbose)result(status)
type(himawari_t_VIS_Header),intent(inout) :: ahi_hdr
integer,intent(in) :: filelun
logical, intent(in) :: verbose
integer :: retval,fpos
type(himawari_t_Basic_Info) :: him_basic
type(himawari_t_Data_Info) :: him_data
type(himawari_t_Proj_Info) :: him_proj
type(himawari_t_Navi_Info) :: him_nav
type(himawari_t_Calib_Info) :: him_calib
type(himawari_t_VIS_Calib_Info) :: him_chan_calib
type(himawari_t_InterCalib_Info) :: him_interCalib
type(himawari_t_Segm_Info) :: him_seg
type(himawari_t_NaviCorr_Info) :: him_navcorr
type(himawari_t_ObsTime_Info) :: him_obstime
type(himawari_t_Error_Info) :: him_error
type(himawari_t_Spare) :: him_spare
type(himawari_t_Correct_Table) :: him_correct_table
call fseek(filelun,0,0,retval)
read(filelun)him_basic
fpos = fpos + him_basic%BlockLen
call fseek(filelun,fpos,0,retval)
read(filelun)him_data
fpos = fpos + him_data%BlockLen
call fseek(filelun,fpos,0,retval)
read(filelun)him_proj
fpos = fpos + him_proj%BlockLen
call fseek(filelun,fpos,0,retval)
read(filelun)him_nav
fpos = fpos + him_nav%BlockLen
call fseek(filelun,fpos,0,retval)
read(filelun)him_calib
read(filelun)him_chan_calib
fpos = fpos + him_calib%BlockLen
call fseek(filelun,fpos,0,retval)
read(filelun)him_interCalib
fpos = fpos + him_interCalib%BlockLen
call fseek(filelun,fpos,0,retval)
read(filelun)him_seg
fpos = fpos + him_seg%BlockLen
call fseek(filelun,fpos,0,retval)
read(filelun)him_navcorr
fpos = fpos + him_navcorr%BlockLen
call fseek(filelun,fpos,0,retval)
read(filelun)him_obstime
fpos = fpos + him_obstime%BlockLen
call fseek(filelun,fpos,0,retval)
read(filelun)him_error
fpos = fpos + him_error%BlockLen
call fseek(filelun,fpos,0,retval)
call fseek(filelun,him_basic%totalHeaderLen,0,retval)
ahi_hdr%him_basic = him_basic
ahi_hdr%him_proj = him_proj
ahi_hdr%him_nav = him_nav
ahi_hdr%him_calib = him_calib
ahi_hdr%him_chan_calib = him_chan_calib
ahi_hdr%him_interCalib = him_interCalib
ahi_hdr%him_seg = him_seg
ahi_hdr%him_navcorr = him_navcorr
ahi_hdr%him_obstime = him_obstime
ahi_hdr%him_error = him_error
status = HIMAWARI_SUCCESS
return
end function AHI_readhdr_VIS
end module himawari_readheader