Ticket #255: ropp_pp.f90

File ropp_pp.f90, 40.5 KB (added by Ian Culverwell, 13 years ago)
Line 
1! $Id: ropp_pp.f90 2905 2011-06-22 11:25:15Z idculv $
2
3!****t* Interface/Modules
4!
5! SYNOPSIS
6! use ropp_pp
7! use ropp_pp_types
8! use ropp_pp_constants
9! use ropp_pp_utils
10! use ropp_pp_spline
11! use ropp_pp_MSIS
12!
13!****
14
15!****m* Modules/ropp_pp *
16!
17! NAME
18! ropp_pp - Interface module for the ROPP pre-processor
19!
20! SYNOPSIS
21! use ropp_pp
22!
23! DESCRIPTION
24! This module provides interfaces for all pre-processor routines in the
25! ROPP Preprocessor library.
26!
27! NOTES
28!
29! SEE ALSO
30! ropp_pp_constants
31!
32! AUTHOR
33! Met Office, Exeter, UK.
34! Any comments on this software should be given via the GRAS SAF
35! Helpdesk at http://www.grassaf.org
36!
37! COPYRIGHT
38! (c) EUMETSAT. All rights reserved.
39! For further details please refer to the file COPYRIGHT
40! which you should have received as part of this distribution.
41!
42!****
43
44MODULE ropp_pp
45
46!-------------------------------------------------------------------------------
47! 1. Other modules
48!-------------------------------------------------------------------------------
49
50 USE typesizes, ONLY: wp => EightByteReal
51 USE ropp_pp_types
52 USE ropp_pp_constants
53 USE ropp_pp_utils
54 USE ropp_pp_spline
55 USE ropp_pp_msis
56
57!-------------------------------------------------------------------------------
58! 2. Compute bending angles - Geometric Optics processing
59!-------------------------------------------------------------------------------
60
61 INTERFACE
62 SUBROUTINE ropp_pp_bending_angle_go(time, r_leo, r_gns, r_coc, &
63 phase_L1, phase_L2, w_smooth, &
64 filter, impact_L1, bangle_L1, &
65 impact_L2, bangle_L2)
66 USE typesizes, ONLY: wp => EightByteReal
67 REAL(wp), DIMENSION(:), INTENT(in) :: time ! Relative time
68 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_leo ! LEO coordinates
69 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_gns ! GPS coordinates
70 REAL(wp), DIMENSION(:), INTENT(in) :: r_coc ! centre curvature
71 REAL(wp), DIMENSION(:), INTENT(in) :: phase_L1 ! L1 excess phase (m)
72 REAL(wp), DIMENSION(:), INTENT(in) :: phase_L2 ! L2 excess phase (m)
73 INTEGER, INTENT(in) :: w_smooth ! smoothing window
74 CHARACTER(len=*), INTENT(in) :: filter ! filter type
75 REAL(wp), DIMENSION(:), INTENT(out) :: impact_L1 ! L1 impact
76 REAL(wp), DIMENSION(:), INTENT(out) :: bangle_L1 ! L1 bending angles
77 REAL(wp), DIMENSION(:), INTENT(out) :: impact_L2 ! L2 impact
78 REAL(wp), DIMENSION(:), INTENT(out) :: bangle_L2 ! L2 bending angles
79 END SUBROUTINE ropp_pp_bending_angle_go
80 END INTERFACE
81
82 INTERFACE
83 SUBROUTINE ropp_pp_geometric_optics(r_leo, v_leo, r_gns, v_gns, doppler, &
84 impact, bangle)
85 USE typesizes, ONLY: wp => EightByteReal
86 REAL(wp), DIMENSION(:), INTENT(in) :: r_leo ! LEO coordinates
87 REAL(wp), DIMENSION(:), INTENT(in) :: v_leo ! LEO velocity
88 REAL(wp), DIMENSION(:), INTENT(in) :: r_gns ! GPS coordinates
89 REAL(wp), DIMENSION(:), INTENT(in) :: v_gns ! GPS velocity
90 REAL(wp), INTENT(in) :: doppler ! Doppler shift
91 REAL(wp), INTENT(out) :: impact ! Impact parameter
92 REAL(wp), INTENT(out) :: bangle ! Bending angle
93 END SUBROUTINE ropp_pp_geometric_optics
94 END INTERFACE
95
96 INTERFACE
97 SUBROUTINE ropp_pp_geometric_optics_adj(r_leo, v_leo, r_gns, v_gns, &
98 doppler, impact, bangle, &
99 impact_dd, impact_dr, &
100 bangle_dd, bangle_dr)
101 USE typesizes, ONLY: wp => EightByteReal
102 REAL(wp), DIMENSION(:), INTENT(in) :: r_leo ! LEO coordinates
103 REAL(wp), DIMENSION(:), INTENT(in) :: v_leo ! LEO velocity
104 REAL(wp), DIMENSION(:), INTENT(in) :: r_gns ! GPS coordinates
105 REAL(wp), DIMENSION(:), INTENT(in) :: v_gns ! GPS velocity
106 REAL(wp), INTENT(in) :: doppler ! Doppler shift
107 REAL(wp), INTENT(out) :: impact ! Impact parameter
108 REAL(wp), INTENT(out) :: bangle ! Bending angle
109 REAL(wp), INTENT(out) :: impact_dd ! d(IP)/d(d)
110 REAL(wp), DIMENSION(6), INTENT(out) :: impact_dr ! d(IP)/d(r_leo,r_gns)
111 REAL(wp), INTENT(out) :: bangle_dd ! d(BA)/d(d)
112 REAL(wp), DIMENSION(6), INTENT(out) :: bangle_dr ! d(BA)/d(r_leo,r_gns)
113 END SUBROUTINE ropp_pp_geometric_optics_adj
114 END INTERFACE
115
116!-------------------------------------------------------------------------------
117! 3. Compute bending angles - Wave Optics processing
118!-------------------------------------------------------------------------------
119
120 INTERFACE
121 SUBROUTINE ropp_pp_bending_angle_wo(time, r_leo, r_gns, r_coc, roc, &
122 phase_L1, phase_L2, snr_L1, snr_L2, w_ls, w_smooth, &
123 w_low, hmax, filter, opt_DL2, cff, dsh, &
124 impact_L1, bangle_L1, ba_sigma_L1, &
125 impact_L2, bangle_L2, ba_sigma_L2, diag)
126 USE typesizes, ONLY: wp => EightByteReal
127 USE ropp_pp_types, ONLY: PPdiag
128 REAL(wp), DIMENSION(:), INTENT(in) :: time ! Relative time
129 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_leo ! LEO coordinates
130 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_gns ! GPS coordinates
131 REAL(wp), DIMENSION(:), INTENT(in) :: r_coc ! centre curvature
132 REAL(wp), INTENT(in) :: roc ! radius curvature
133 REAL(wp), DIMENSION(:), INTENT(in) :: phase_L1 ! L1 excess phase (m)
134 REAL(wp), DIMENSION(:), INTENT(in) :: phase_L2 ! L2 excess phase (m)
135 REAL(wp), DIMENSION(:), INTENT(in) :: snr_L1 ! L1 amplitude
136 REAL(wp), DIMENSION(:), INTENT(in) :: snr_L2 ! L2 amplitude
137 INTEGER, INTENT(in) :: w_ls ! smoothing window
138 INTEGER, INTENT(in) :: w_smooth ! smoothing window
139 INTEGER, INTENT(in) :: w_low ! smoothing window
140 REAL(wp), INTENT(in) :: hmax ! max height for WO
141 CHARACTER(len=*), INTENT(in) :: filter ! Filter method
142 LOGICAL, INTENT(in) :: opt_DL2 ! Degraded L2 flag
143 INTEGER, INTENT(in) :: cff ! Cmplx filter flag
144 REAL(wp), INTENT(in) :: dsh ! Border width (m)
145 REAL(wp), DIMENSION(:), INTENT(inout) :: impact_L1 ! L1 impact
146 REAL(wp), DIMENSION(:), INTENT(inout) :: bangle_L1 ! L1 bending angles
147 REAL(wp), DIMENSION(:), INTENT(out) :: ba_sigma_L1 ! L1 ba std dev
148 REAL(wp), DIMENSION(:), INTENT(inout) :: impact_L2 ! L2 impact
149 REAL(wp), DIMENSION(:), INTENT(inout) :: bangle_L2 ! L2 bending angles
150 REAL(wp), DIMENSION(:), INTENT(out) :: ba_sigma_L2 ! L2 ba std dev
151 TYPE(ppDiag), OPTIONAL, INTENT(inout) :: diag ! Additional diags
152 END SUBROUTINE ropp_pp_bending_angle_wo
153 END INTERFACE
154
155 INTERFACE
156 SUBROUTINE ropp_pp_DCT(time,A,DS,r_leo,r_gns,r_coc,roc,w_ls,w_smooth, &
157 w_low,hmax,filter,opt_DL2,cff,dsh, P, E, EC, diag)
158 USE typesizes, ONLY: wp => EightByteReal
159 USE ropp_pp_types, ONLY: PPdiag
160 REAL(wp), DIMENSION(:), INTENT(in) :: time ! Relative time
161 REAL(wp), DIMENSION(:,:), INTENT(in) :: A ! Amplitudes
162 REAL(wp), DIMENSION(:,:), INTENT(in) :: DS ! Excess phase
163 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_leo ! LEO coordinates
164 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_gns ! GPS coordinates
165 REAL(wp), DIMENSION(:), INTENT(in) :: r_coc ! Centre curvature
166 REAL(wp), INTENT(in) :: roc ! Radius curvature
167 INTEGER, INTENT(in) :: w_ls ! Large smoothing
168 INTEGER, INTENT(in) :: w_smooth ! Smoothing > 7km
169 INTEGER, INTENT(in) :: w_low ! Smoothing < 7km
170 REAL(wp), INTENT(in) :: hmax ! max height for WO
171 CHARACTER(len=*), INTENT(in) :: filter ! Filter method
172 LOGICAL, INTENT(in) :: opt_DL2 ! Degraded L2 flag
173 INTEGER, INTENT(in) :: cff ! Cmplx filter flag
174 REAL(wp), INTENT(in) :: dsh ! Border width (m)
175 REAL(wp), DIMENSION(:,:), INTENT(inout) :: P ! Impact parameters
176 REAL(wp), DIMENSION(:,:), INTENT(inout) :: E ! Bending angles
177 REAL(wp), DIMENSION(:,:), INTENT(inout) :: EC ! BA covariance
178 TYPE(ppDiag), OPTIONAL, INTENT(inout) :: diag ! Additional diags
179 END SUBROUTINE ropp_pp_DCT
180 END INTERFACE
181
182!-------------------------------------------------------------------------------
183! 4. Preprocessing - Model excess phase calculation and phase correction
184!-------------------------------------------------------------------------------
185
186 INTERFACE
187 SUBROUTINE ropp_pp_modelphase(month, lat, lon, time, r_leo, r_gns, r_coc, &
188 roc, phase_LM, impact_LM, config)
189 USE typesizes, ONLY: wp => EightByteReal
190 USE ropp_pp_types
191 INTEGER, INTENT(in) :: month ! month of year
192 REAL(wp), INTENT(in) :: lat ! latitude
193 REAL(wp), INTENT(in) :: lon ! longitude
194 REAL(wp), DIMENSION(:), INTENT(in) :: time ! time of samples
195 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_leo ! LEO coordinates
196 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_gns ! GPS coordinates
197 REAL(wp), DIMENSION(:), INTENT(in) :: r_coc ! centre curvature
198 REAL(wp), INTENT(in) :: roc ! radius curvature
199 REAL(wp), DIMENSION(:), INTENT(out) :: phase_LM ! model excess phase
200 REAL(wp), DIMENSION(:), OPTIONAL, INTENT(out) :: impact_LM ! model IP
201 TYPE(ppConfig), INTENT(inout) :: config ! Configuration
202 END SUBROUTINE ropp_pp_modelphase
203 END INTERFACE
204
205 INTERFACE
206 SUBROUTINE ropp_pp_bangle2phase(time, r_leo, r_gns, r_coc, impact, &
207 bangle, phase, dphi, impact_LM, IL, IU)
208 USE typesizes, ONLY: wp => EightByteReal
209 REAL(wp), DIMENSION(:), INTENT(in) :: time ! time of samples (s)
210 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_leo ! LEO coordinates
211 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_gns ! GPS coordinates
212 REAL(wp), DIMENSION(:), INTENT(in) :: r_coc ! centre curvature
213 REAL(wp), DIMENSION(:), INTENT(in) :: impact ! impact parameter (m)
214 REAL(wp), DIMENSION(:), INTENT(inout) :: bangle ! bending angle (m)
215 REAL(wp), DIMENSION(:), INTENT(out) :: phase ! excess phase (m)
216 REAL(wp), DIMENSION(:), OPTIONAL, INTENT(out) :: dphi ! deriv phase(m/s)
217 REAL(wp), DIMENSION(:), OPTIONAL, INTENT(out) :: impact_LM ! model IP
218 INTEGER, OPTIONAL, INTENT(out) :: IL ! model lower limit
219 INTEGER, OPTIONAL, INTENT(out) :: IU ! model upper limit
220 END SUBROUTINE ropp_pp_bangle2phase
221 END INTERFACE
222
223 INTERFACE
224 SUBROUTINE ropp_pp_impact2doppler(xleo, vleo, xgns, vgns, impact, &
225 doppler, bangle)
226 USE typesizes, ONLY: wp => EightByteReal
227 REAL(wp), DIMENSION(3), INTENT(in) :: xleo ! Cartesian LEO coords
228 REAL(wp), DIMENSION(3), INTENT(in) :: vleo ! Cartesian LEO velocity
229 REAL(wp), DIMENSION(3), INTENT(in) :: xgns ! Cartesian GPS coords
230 REAL(wp), DIMENSION(3), INTENT(in) :: vgns ! Cartesian GPS velocity
231 REAL(wp), INTENT(in) :: impact ! Impact parameter
232 REAL(wp), INTENT(out) :: doppler ! Doppler frequency shift
233 REAL(wp), INTENT(out) :: bangle ! Bending angle
234 END SUBROUTINE ropp_pp_impact2doppler
235 END INTERFACE
236
237 INTERFACE
238 SUBROUTINE ropp_pp_amplitude_go(time, r_leo, r_gns, r_coc, roc, impact, &
239 snr, w_smooth, snr_R)
240 USE typesizes, ONLY: wp => EightByteReal
241 REAL(wp), DIMENSION(:), INTENT(in) :: time ! time of samples (s)
242 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_leo ! LEO coordinates
243 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_gns ! GPS coordinates
244 REAL(wp), DIMENSION(:), INTENT(in) :: r_coc ! centre curvature
245 REAL(wp), INTENT(in) :: roc ! radius curvature
246 REAL(wp), DIMENSION(:), INTENT(in) :: impact ! Impact parameters
247 REAL(wp), DIMENSION(:), INTENT(in) :: snr ! Observed amplitude
248 INTEGER, INTENT(in) :: w_smooth ! smoothing window
249 REAL(wp), DIMENSION(:), INTENT(out) :: snr_R ! Refract amplitude
250 END SUBROUTINE ropp_pp_amplitude_go
251 END INTERFACE
252
253 INTERFACE
254 SUBROUTINE ropp_pp_correct_L2(time, r_leo, r_gns, r_coc, roc, &
255 impact_LM, phase_LM, phase_L1, phase_L2, &
256 snr_L1, snr_L2, LCF, hmid, L2Q)
257 USE typesizes, ONLY: wp => EightByteReal
258 REAL(wp), DIMENSION(:), INTENT(in) :: time ! time of samples (s)
259 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_leo ! LEO coordinates
260 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_gns ! GPS coordinates
261 REAL(wp), DIMENSION(:), INTENT(in) :: r_coc ! Centre curvature
262 REAL(wp), INTENT(in) :: roc ! Radius curvature
263 REAL(wp), DIMENSION(:), INTENT(in) :: impact_LM ! Model impact (m)
264 REAL(wp), DIMENSION(:), INTENT(in) :: phase_LM ! Model excess phase
265 REAL(wp), DIMENSION(:), INTENT(inout) :: phase_L1 ! L1 excess phase (m)
266 REAL(wp), DIMENSION(:), INTENT(inout) :: phase_L2 ! L2 excess phase (m)
267 REAL(wp), DIMENSION(:), INTENT(inout) :: snr_L1 ! L1 amplitude
268 REAL(wp), DIMENSION(:), INTENT(inout) :: snr_L2 ! L2 amplitude
269 INTEGER, DIMENSION(:), INTENT(inout) :: lcf ! Lost carrier flag
270 REAL(wp), INTENT(in) :: hmid ! Border height (m)
271 REAL(wp), INTENT(out) :: L2Q ! L2 badness score
272 END SUBROUTINE ropp_pp_correct_L2
273 END INTERFACE
274
275 INTERFACE
276 SUBROUTINE ropp_pp_spectra(time, phase_L1, phase_L2, phase_LM, &
277 impact_LM, config, OutRO, filnam)
278 USE typesizes, ONLY: wp => EightByteReal
279 USE ropp_pp_types
280 REAL(wp), DIMENSION(:), INTENT(in) :: time ! time of samples (s)
281 REAL(wp), DIMENSION(:), INTENT(in) :: phase_L1 ! excess phase L1 (m)
282 REAL(wp), DIMENSION(:), INTENT(in) :: phase_L2 ! excess phase L2 (m)
283 REAL(wp), DIMENSION(:), INTENT(in) :: phase_LM ! model excess phase (m)
284 REAL(wp), DIMENSION(:), INTENT(in) :: impact_LM ! model impact param (m)
285 TYPE(PPConfig), INTENT(in) :: config ! Configuration options
286 LOGICAL, OPTIONAL, INTENT(in) :: OutRO ! Flag to output RO spectra
287 CHARACTER(LEN=*), OPTIONAL, INTENT(in) :: filnam ! Output file name root
288 END SUBROUTINE ropp_pp_spectra
289 END INTERFACE
290
291!-------------------------------------------------------------------------------
292! 5. Preprocessing - Open loop preprocessing
293!-------------------------------------------------------------------------------
294
295 INTERFACE
296 SUBROUTINE ropp_pp_openloop(time, phase_L1, phase_L2, phase_LM, &
297 r_leo, r_gns, r_coc, LCF)
298 USE typesizes, ONLY: wp => EightByteReal
299 REAL(wp), DIMENSION(:), INTENT(in) :: time ! time of samples (s)
300 REAL(wp), DIMENSION(:), INTENT(inout) :: phase_L1 ! excess phase L1 (m)
301 REAL(wp), DIMENSION(:), INTENT(inout) :: phase_L2 ! excess phase L2 (m)
302 REAL(wp), DIMENSION(:), INTENT(in) :: phase_LM ! model ex phase (m)
303 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_leo ! LEO coords (ECF)
304 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_gns ! GPS coords (ECF)
305 REAL(wp), DIMENSION(:), INTENT(in) :: r_coc ! centre curv (ECF)
306 INTEGER, DIMENSION(:), INTENT(inout) :: LCF ! lost carrier flag
307 END SUBROUTINE ropp_pp_openloop
308 END INTERFACE
309
310!-------------------------------------------------------------------------------
311! 6. Radioholographic filtering and analysis
312!-------------------------------------------------------------------------------
313
314 INTERFACE
315 SUBROUTINE ropp_pp_radioholographic_filter(time, r_leo, r_gns, r_coc, &
316 roc, phase_LM, phase, snr)
317 USE typesizes, ONLY: wp => EightByteReal
318 REAL(wp), DIMENSION(:), INTENT(in) :: time ! time of samples (s)
319 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_leo ! LEO coordinates (m)
320 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_gns ! GPS coordinates (m)
321 REAL(wp), DIMENSION(:), INTENT(in) :: r_coc ! centre curvature (m)
322 REAL(wp), INTENT(in) :: roc ! radius of curvature
323 REAL(wp), DIMENSION(:), INTENT(in) :: phase_LM ! model phase (m)
324 REAL(wp), DIMENSION(:,:), INTENT(inout) :: phase ! L1,L2 excess phase
325 REAL(wp), DIMENSION(:,:), INTENT(inout) :: snr ! L1,L2 amplitude
326 END SUBROUTINE ropp_pp_radioholographic_filter
327 END INTERFACE
328
329 INTERFACE
330 SUBROUTINE ropp_pp_radiooptic_analysis(time, r_leo, r_gns, r_coc, roc, &
331 phase_LM, phase, snr, PA, PD, OutRO, filnam)
332 USE typesizes, ONLY: wp => EightByteReal
333 REAL(wp), DIMENSION(:), INTENT(in) :: time ! time of samples (s)
334 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_leo ! LEO coordinates (m)
335 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_gns ! GPS coordinates (m)
336 REAL(wp), DIMENSION(:), INTENT(in) :: r_coc ! centre curvature (m)
337 REAL(wp), INTENT(in) :: roc ! radius of curvature
338 REAL(wp), DIMENSION(:), INTENT(in) :: phase_LM ! model phase (m)
339 REAL(wp), DIMENSION(:,:), INTENT(in) :: phase ! L1,L2 excess phase
340 REAL(wp), DIMENSION(:,:), INTENT(in) :: snr ! L1,L2 amplitude
341 REAL(wp), DIMENSION(:,:), OPTIONAL, INTENT(out) :: PA ! Average impact
342 REAL(wp), DIMENSION(:,:), OPTIONAL, INTENT(out) :: PD ! RMS impact
343 LOGICAL, OPTIONAL, INTENT(in) :: OutRO ! Flag to output spectra
344 CHARACTER(LEN=*), OPTIONAL,INTENT(in) :: filnam ! Output file name root
345 END SUBROUTINE ropp_pp_radiooptic_analysis
346 END INTERFACE
347
348!-------------------------------------------------------------------------------
349! 7. Satellite location processing
350!-------------------------------------------------------------------------------
351
352 INTERFACE
353 SUBROUTINE ropp_pp_satellite_velocities(time, r_leo, r_gns, xleo, vleo, &
354 xgns, vgns, abl, abg)
355 USE typesizes, ONLY: wp => EightByteReal
356 REAL(wp), DIMENSION(:), INTENT(in) :: time ! time of samples
357 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_leo ! LEO position
358 REAL(wp), DIMENSION(:,:), INTENT(in) :: r_gns ! GPS position
359 REAL(wp), DIMENSION(:,:), INTENT(out) :: xleo ! LEO position
360 REAL(wp), DIMENSION(:,:), INTENT(out) :: vleo ! LEO velocity
361 REAL(wp), DIMENSION(:,:), INTENT(out) :: xgns ! GPS position
362 REAL(wp), DIMENSION(:,:), INTENT(out) :: vgns ! GPS velocity
363 REAL(wp), DIMENSION(:,:), OPTIONAL, INTENT(out) :: abl ! LEO regrsn coeff
364 REAL(wp), DIMENSION(:,:), OPTIONAL, INTENT(out) :: abg ! GPS regrsn coeff
365 END SUBROUTINE ropp_pp_satellite_velocities
366 END INTERFACE
367
368 INTERFACE
369 SUBROUTINE ropp_pp_interpolate_trajectory(time,cleo,cgns,r_coc,t_init, &
370 xleo, vleo, xgns, vgns, theta)
371 USE typesizes, ONLY: wp => EightByteReal
372 REAL(wp), DIMENSION(:), INTENT(in) :: time ! time of samples (s)
373 REAL(wp), DIMENSION(:,:), INTENT(in) :: cleo ! LEO regression coeff
374 REAL(wp), DIMENSION(:,:), INTENT(in) :: cgns ! GPS regression coeff
375 REAL(wp), DIMENSION(:), INTENT(in) :: r_coc ! centre of curvature
376 REAL(wp), INTENT(in) :: t_init ! interpolation time
377 REAL(wp), DIMENSION(:), INTENT(out) :: xleo ! LEO coordinates
378 REAL(wp), DIMENSION(:), INTENT(out) :: vleo ! LEO velocity
379 REAL(wp), DIMENSION(:), INTENT(out) :: xgns ! GPS coordinates
380 REAL(wp), DIMENSION(:), INTENT(out) :: vgns ! GPS velocity
381 REAL(wp), OPTIONAL, INTENT(out) :: theta ! GPS -> LEO angle
382 END SUBROUTINE ropp_pp_interpolate_trajectory
383END INTERFACE
384
385!-------------------------------------------------------------------------------
386! 8. Inverse Abel transform
387!-------------------------------------------------------------------------------
388
389 INTERFACE
390 SUBROUTINE ropp_pp_invert_exp(impact, bangle, nr, refrac)
391 USE typesizes, ONLY: wp => EightByteReal
392 REAL(wp), DIMENSION(:), INTENT(in) :: impact ! impact parameter
393 REAL(wp), DIMENSION(:), INTENT(in) :: bangle ! bending angle obs
394 REAL(wp), DIMENSION(:), INTENT(in) :: nr ! x=nr product
395 REAL(wp), DIMENSION(:), INTENT(out) :: refrac ! refractivity
396 END SUBROUTINE ropp_pp_invert_exp
397 END INTERFACE
398
399 INTERFACE ropp_pp_invert
400 SUBROUTINE ropp_pp_invert_lin(impact, bangle, nr, refrac, scale)
401 USE typesizes, ONLY: wp => EightByteReal
402 REAL(wp), DIMENSION(:), INTENT(in) :: impact ! impact parameter
403 REAL(wp), DIMENSION(:), INTENT(in) :: bangle ! bending angle obs
404 REAL(wp), DIMENSION(:), INTENT(in) :: nr ! x=nr product
405 REAL(wp), OPTIONAL, INTENT(in) :: scale ! vertical scale
406 REAL(wp), DIMENSION(:), INTENT(out) :: refrac ! refractivity
407 END SUBROUTINE ropp_pp_invert_lin
408 END INTERFACE
409
410!-------------------------------------------------------------------------------
411! 9. Forward Abel transform
412!-------------------------------------------------------------------------------
413
414 INTERFACE
415 SUBROUTINE ropp_pp_abel_exp(nr, refrac, impact, bangle)
416 USE typesizes, ONLY: wp => EightByteReal
417 REAL(wp), DIMENSION(:), INTENT(in) :: nr ! x=nr product
418 REAL(wp), DIMENSION(:), INTENT(in) :: refrac ! refractivity
419 REAL(wp), DIMENSION(:), INTENT(in) :: impact ! impact parameter
420 REAL(wp), DIMENSION(:), INTENT(out) :: bangle ! bending angle
421 END SUBROUTINE ropp_pp_abel_exp
422 END INTERFACE
423
424 INTERFACE ropp_pp_abel
425 SUBROUTINE ropp_pp_abel_lin(nr, refrac, impact, bangle, dln, scale)
426 USE typesizes, ONLY: wp => EightByteReal
427 REAL(wp), DIMENSION(:), INTENT(in) :: nr ! x=nr product
428 REAL(wp), DIMENSION(:), INTENT(in) :: refrac ! refractivity
429 REAL(wp), DIMENSION(:), INTENT(in) :: impact ! impact parameter
430 REAL(wp), OPTIONAL, DIMENSION(:), INTENT(in) :: dln ! ref index gradient
431 REAL(wp), OPTIONAL, INTENT(in) :: scale ! scale factor
432 REAL(wp), DIMENSION(:), INTENT(out) :: bangle ! bending angle
433 END SUBROUTINE ropp_pp_abel_lin
434 END INTERFACE
435
436!-------------------------------------------------------------------------------
437! 10. Ionospheric correction
438!-------------------------------------------------------------------------------
439
440 INTERFACE
441 SUBROUTINE ropp_pp_ionospheric_correction(impact_L1, bangle_L1, &
442 impact_L2, bangle_L2, impact_LM, bangle_LM, config, &
443 impact_LC, bangle_LC, diag, WLC) !HGL!
444 USE typesizes, ONLY: wp => EightByteReal
445 USE ropp_pp_types
446 REAL(wp), DIMENSION(:), INTENT(in) :: impact_L1 ! L1 impact parameters
447 REAL(wp), DIMENSION(:), INTENT(in) :: bangle_L1 ! L1 bending angles
448 REAL(wp), DIMENSION(:), INTENT(in) :: impact_L2 ! L2 impact parameters
449 REAL(wp), DIMENSION(:), INTENT(in) :: bangle_L2 ! L2 bending angles
450 REAL(wp), DIMENSION(:), INTENT(in) :: impact_LM ! Model bending angles
451 REAL(wp), DIMENSION(:), INTENT(in) :: bangle_LM ! Model bending angles
452 TYPE(ppConfig), INTENT(inout) :: config ! Configuration
453 REAL(wp), DIMENSION(:), INTENT(out) :: impact_LC ! LC impact parameters
454 REAL(wp), DIMENSION(:), INTENT(out) :: bangle_LC ! Corrected bangle
455 TYPE(ppDiag), INTENT(inout) :: diag ! Output diagnostics
456 REAL(wp), DIMENSION(:), INTENT(inout), OPTIONAL :: WLC ! SO-weight of observed LC bending angles !HGL!
457 END SUBROUTINE ropp_pp_ionospheric_correction
458 END INTERFACE
459
460 INTERFACE
461 SUBROUTINE ropp_pp_linear_combination(impact_L1, bangle_L1, impact_L2, &
462 bangle_L2, impact_LC, bangle_LC)
463 USE typesizes, ONLY: wp => EightByteReal
464 REAL(wp), DIMENSION(:), INTENT(in) :: impact_L1 ! L1 impact parameters
465 REAL(wp), DIMENSION(:), INTENT(in) :: bangle_L1 ! L1 bending angles
466 REAL(wp), DIMENSION(:), INTENT(in) :: impact_L2 ! L2 impact parameters
467 REAL(wp), DIMENSION(:), INTENT(in) :: bangle_L2 ! L2 bending angles
468 REAL(wp), DIMENSION(:), INTENT(out) :: impact_LC ! LC impact parameters
469 REAL(wp), DIMENSION(:), INTENT(out) :: bangle_LC ! Corrected bangle
470 END SUBROUTINE ropp_pp_linear_combination
471 END INTERFACE
472
473 INTERFACE
474 SUBROUTINE ropp_pp_merge_profile(impact_L1,bangle_L1,impact_L2,bangle_L2, &
475 impact_I1,bangle_I1,impact_I2,bangle_I2, &
476 Pmin, Pmax)
477 USE typesizes, ONLY: wp => EightByteReal
478 REAL(wp), DIMENSION(:), INTENT(in) :: impact_L1 ! L1 impact parameters
479 REAL(wp), DIMENSION(:), INTENT(in) :: bangle_L1 ! L1 bending angles
480 REAL(wp), DIMENSION(:), INTENT(in) :: impact_L2 ! L2 impact parameters
481 REAL(wp), DIMENSION(:), INTENT(in) :: bangle_L2 ! L2 bending angles
482 REAL(wp), DIMENSION(:), INTENT(out) :: impact_I1 ! Interpolated impact
483 REAL(wp), DIMENSION(:), INTENT(out) :: bangle_I1 ! Interpolated L1 ba
484 REAL(wp), DIMENSION(:), INTENT(out) :: impact_I2 ! Interpolated impact
485 REAL(wp), DIMENSION(:), INTENT(out) :: bangle_I2 ! Interpolated L2 ba
486 REAL(wp), OPTIONAL, INTENT(in) :: Pmin ! Minimum impact
487 REAL(wp), OPTIONAL, INTENT(in) :: Pmax ! Maximum impact
488 END SUBROUTINE ropp_pp_merge_profile
489 END INTERFACE
490
491!-------------------------------------------------------------------------------
492! 11. Fitting to model bending angle profile
493!-------------------------------------------------------------------------------
494
495 INTERFACE
496 SUBROUTINE ropp_pp_invert_refraction(mfile, month, lat, lon, impact, &
497 bangle, geop, refrac, config)
498 USE typesizes, ONLY: wp => EightByteReal
499 USE ropp_pp_types
500 CHARACTER(len=*), INTENT(inout) :: mfile ! Coefficients file
501 INTEGER, INTENT(in) :: month ! Month of year
502 REAL(wp), INTENT(in) :: lat ! Latitude
503 REAL(wp), INTENT(in) :: lon ! Longitude
504 REAL(wp), DIMENSION(:), INTENT(in) :: impact ! Impact parameter
505 REAL(wp), DIMENSION(:), INTENT(in) :: bangle ! Bending angle
506 REAL(wp), DIMENSION(:), INTENT(out) :: geop ! Geopotential height
507 REAL(wp), DIMENSION(:), INTENT(out) :: refrac ! Refractivity
508 TYPE(PPConfig), INTENT(in) :: config ! Configuration
509 END SUBROUTINE ropp_pp_invert_refraction
510 END INTERFACE
511
512 INTERFACE
513 SUBROUTINE ropp_pp_model_refraction(mfile, month, lat, lon, impact, &
514 bangle_MSIS, config)
515 USE typesizes, ONLY: wp => EightByteReal
516 USE ropp_pp_types
517 CHARACTER(len=*), INTENT(inout) :: mfile ! Coefficients file
518 INTEGER, INTENT(in) :: month ! Month of year
519 REAL(wp), INTENT(in) :: lat ! Latitude
520 REAL(wp), INTENT(in) :: lon ! Longitude
521 REAL(wp), DIMENSION(:), INTENT(in) :: impact ! Impact parameter
522 REAL(wp), DIMENSION(:), INTENT(out) :: bangle_MSIS ! Model bending angle
523 TYPE(PPConfig), INTENT(in) :: config ! Configuration
524 END SUBROUTINE ropp_pp_model_refraction
525 END INTERFACE
526
527 INTERFACE
528 SUBROUTINE ropp_pp_bg_refraction(bfile, month, lat, lon, impact, &
529 bangle_BG, config)
530 USE typesizes, ONLY: wp => EightByteReal
531 USE ropp_pp_types
532 CHARACTER(len=*), INTENT(in) :: bfile ! Background file
533 INTEGER, INTENT(in) :: month ! Month of year
534 REAL(wp), INTENT(in) :: lat ! Latitude
535 REAL(wp), INTENT(in) :: lon ! Longitude
536 REAL(wp), DIMENSION(:), INTENT(in) :: impact ! Impact parameter
537 REAL(wp), DIMENSION(:), INTENT(out) :: bangle_BG ! BG bending angle
538 TYPE(PPConfig), INTENT(in) :: config ! Configuration
539 END SUBROUTINE ropp_pp_bg_refraction
540 END INTERFACE
541
542 INTERFACE
543 SUBROUTINE ropp_pp_search_model_refraction(mfile,in_month,in_lat,in_lon, &
544 in_impact, in_bangle, &
545 impact, bangle_MSIS, config)
546 USE typesizes, ONLY: wp => EightByteReal
547 USE ropp_pp_types
548 CHARACTER(len=*), INTENT(inout) :: mfile ! Coefficients file
549 INTEGER, INTENT(in) :: in_month ! Month of year
550 REAL(wp), INTENT(in) :: in_lat ! Latitude
551 REAL(wp), INTENT(in) :: in_lon ! Longitude
552 REAL(wp), DIMENSION(:), INTENT(in) :: in_impact ! Input impact
553 REAL(wp), DIMENSION(:), INTENT(in) :: in_bangle ! Input bangle
554 REAL(wp), DIMENSION(:), INTENT(in) :: impact ! Impact parameter
555 REAL(wp), DIMENSION(:), INTENT(out) :: bangle_MSIS ! Model bangle
556 TYPE(PPConfig), INTENT(in) :: config ! Configuration
557 END SUBROUTINE ropp_pp_search_model_refraction
558 END INTERFACE
559
560 INTERFACE
561 SUBROUTINE ropp_pp_fit_model_refraction(impact_LC, bangle_LC, &
562 impact_model, bangle_model, config)
563 USE typesizes, ONLY: wp => EightByteReal
564 USE ropp_pp_types
565 REAL(wp), DIMENSION(:), INTENT(in) :: impact_LC ! Impact parameters
566 REAL(wp), DIMENSION(:), INTENT(in) :: bangle_LC ! Bending angle
567 REAL(wp), DIMENSION(:), INTENT(in) :: impact_model ! Model impact
568 REAL(wp), DIMENSION(:), INTENT(inout) :: bangle_model ! Model bangle
569 TYPE(PPConfig), INTENT(in) :: config ! Configuration
570 END SUBROUTINE ropp_pp_fit_model_refraction
571 END INTERFACE
572
573 INTERFACE
574 SUBROUTINE ropp_pp_smooth_profile(impact, bangle, smooth, config)
575 USE typesizes, ONLY: wp => EightByteReal
576 USE ropp_pp_types
577 REAL(wp), DIMENSION(:), INTENT(in) :: impact ! Impact parameter
578 REAL(wp), DIMENSION(:), INTENT(in) :: bangle ! Bending angle
579 REAL(wp), DIMENSION(:), INTENT(out) :: smooth ! Smoothed bangle
580 TYPE(PPConfig), INTENT(inout) :: config ! Configuration
581 END SUBROUTINE ropp_pp_smooth_profile
582 END INTERFACE
583
584!-------------------------------------------------------------------------------
585! 12. Vertical interpolation
586!-------------------------------------------------------------------------------
587
588 INTERFACE ropp_pp_interpol
589 SUBROUTINE ropp_pp_interpol_scl(x, newx, array, interp, Cext)
590 USE typesizes, ONLY: wp => EightByteReal
591 REAL(wp), DIMENSION(:), INTENT(in) :: x
592 REAL(wp), INTENT(in) :: newx
593 REAL(wp), DIMENSION(:), INTENT(in) :: array
594 REAL(wp), INTENT(out) :: interp
595 LOGICAL, OPTIONAL, INTENT(in) :: Cext
596 END SUBROUTINE ropp_pp_interpol_scl
597 SUBROUTINE ropp_pp_interpol_arr(x, newx, array, interp, Cext)
598 USE typesizes, ONLY: wp => EightByteReal
599 REAL(wp), DIMENSION(:), INTENT(in) :: x
600 REAL(wp), DIMENSION(:), INTENT(in) :: newx
601 REAL(wp), DIMENSION(:), INTENT(in) :: array
602 REAL(wp), DIMENSION(:), INTENT(out) :: interp
603 LOGICAL, OPTIONAL, INTENT(in) :: Cext
604 END SUBROUTINE ropp_pp_interpol_arr
605 SUBROUTINE ropp_pp_interpol_int(x, newx, array, interp)
606 USE typesizes, ONLY: wp => EightByteReal
607 REAL(wp), DIMENSION(:), INTENT(in) :: x
608 REAL(wp), INTENT(in) :: newx
609 INTEGER, DIMENSION(:), INTENT(in) :: array
610 INTEGER, INTENT(out) :: interp
611 END SUBROUTINE ropp_pp_interpol_int
612 END INTERFACE
613
614 INTERFACE
615 SUBROUTINE ropp_pp_interpol_log(x, newx, array, interp)
616 USE typesizes, ONLY: wp => EightByteReal
617 REAL(wp), DIMENSION(:), INTENT(in) :: x
618 REAL(wp), DIMENSION(:), INTENT(in) :: newx
619 REAL(wp), DIMENSION(:), INTENT(in) :: array
620 REAL(wp), DIMENSION(:), INTENT(out) :: interp
621 END SUBROUTINE ropp_pp_interpol_log
622 END INTERFACE
623
624!-------------------------------------------------------------------------------
625! 13. Monotonization
626!-------------------------------------------------------------------------------
627
628 INTERFACE
629 SUBROUTINE ropp_pp_uni_monotonous(x, d)
630 USE typesizes, ONLY: wp => EightByteReal
631 REAL(wp), DIMENSION(:), INTENT(inout) :: x
632 INTEGER, OPTIONAL :: d
633 END SUBROUTINE ropp_pp_uni_monotonous
634 END INTERFACE
635
636 INTERFACE
637 SUBROUTINE ropp_pp_monotonous(x, d)
638 USE typesizes, ONLY: wp => EightByteReal
639 REAL(wp), DIMENSION(:), INTENT(inout) :: x
640 INTEGER, OPTIONAL :: d
641 END SUBROUTINE ropp_pp_monotonous
642 END INTERFACE
643
644!-------------------------------------------------------------------------------
645! 14. Read Config file
646!-------------------------------------------------------------------------------
647
648 INTERFACE
649 SUBROUTINE ropp_pp_read_config(file, config)
650 USE ropp_pp_types
651 CHARACTER(len=*), INTENT(in) :: file
652 TYPE(PPConfig), INTENT(inout) :: config
653 END SUBROUTINE ropp_pp_read_config
654 END INTERFACE
655
656!-------------------------------------------------------------------------------
657! 15. Dry temperature and pressure calculation
658!-------------------------------------------------------------------------------
659
660 INTERFACE
661 SUBROUTINE ropp_pp_tdry(lat, alt, refrac, shum, t_dry, p_dry, Zmax)
662 USE typesizes, ONLY: wp => EightByteReal
663 REAL(wp), INTENT(in) :: lat ! Latitude
664 REAL(wp), DIMENSION(:), INTENT(in) :: alt ! Altitude
665 REAL(wp), DIMENSION(:), INTENT(in) :: refrac ! Refractivity
666 REAL(wp), DIMENSION(:), INTENT(in) :: shum ! Specific humidity
667 REAL(wp), DIMENSION(:), INTENT(out) :: t_dry ! Dry temperature
668 REAL(wp), DIMENSION(:), INTENT(out) :: p_dry ! Dry pressure
669 REAL(wp), OPTIONAL, INTENT(in) :: Zmax ! Maximum altitude
670 END SUBROUTINE ropp_pp_tdry
671 END INTERFACE
672
673!-------------------------------------------------------------------------------
674! 16. FFT
675!-------------------------------------------------------------------------------
676
677 INTERFACE ropp_pp_FFT
678 SUBROUTINE ropp_pp_FFT_real(data, isign)
679 USE typesizes, ONLY: wp => EightByteReal
680 REAL(wp), DIMENSION(:), INTENT(INOUT) :: data ! Complex signal
681 INTEGER, INTENT(IN) :: isign ! FFT direction
682 END SUBROUTINE ropp_pp_FFT_real
683 SUBROUTINE ropp_pp_FFT_complex(data, isign)
684 USE typesizes, ONLY: wp => EightByteReal
685 COMPLEX(wp), DIMENSION(:), INTENT(INOUT) :: data ! Complex signal
686 INTEGER, INTENT(IN) :: isign ! FFT direction
687 END SUBROUTINE ropp_pp_FFT_complex
688 END INTERFACE
689
690 INTERFACE
691 SUBROUTINE ropp_pp_fourier_filter(data, window)
692 USE typesizes, ONLY: wp => EightByteReal
693 COMPLEX(wp), DIMENSION(:), INTENT(INOUT) :: data ! Complex signal
694 REAL(wp), INTENT(IN) :: window ! Window width
695 END SUBROUTINE ropp_pp_fourier_filter
696 END INTERFACE
697
698!-------------------------------------------------------------------------------
699! 17. Signal Filtering (optimal estimation)
700!-------------------------------------------------------------------------------
701
702 INTERFACE ropp_pp_filter
703 SUBROUTINE ropp_pp_filter_1d(DT, S, W, ND, FS, DS)
704 USE typesizes, ONLY: wp => EightByteReal
705 REAL(wp), INTENT(in) :: DT ! Time step
706 REAL(wp), DIMENSION(:), INTENT(in) :: S ! Signal samples [time]
707 INTEGER, INTENT(in) :: W ! Window width [points]
708 INTEGER, INTENT(in) :: ND ! Differentiation points
709 REAL(wp), DIMENSION(:), OPTIONAL, INTENT(out) :: FS ! Filtered signal
710 REAL(wp), DIMENSION(:), OPTIONAL, INTENT(out) :: DS ! Signal derivative
711 END SUBROUTINE ropp_pp_filter_1d
712 SUBROUTINE ropp_pp_filter_2d(DT, S, W, ND, FS, DS)
713 USE typesizes, ONLY: wp => EightByteReal
714 REAL(wp), INTENT(in) :: DT ! Time step
715 REAL(wp), DIMENSION(:,:), INTENT(in) :: S ! Signal samples [ch,time]
716 INTEGER, INTENT(in) :: W ! Window width [points]
717 INTEGER, INTENT(in) :: ND ! Differentiation points
718 REAL(wp), DIMENSION(:,:), OPTIONAL, INTENT(out) :: FS ! Filtered signal
719 REAL(wp), DIMENSION(:,:), OPTIONAL, INTENT(out) :: DS ! Signal derivative
720 END SUBROUTINE ropp_pp_filter_2d
721 END INTERFACE
722
723!-------------------------------------------------------------------------------
724! 18. Sliding Polynomial Filtering
725!-------------------------------------------------------------------------------
726
727 INTERFACE ropp_pp_sliding_polynomial
728 SUBROUTINE ropp_pp_sliding_poly_1d(t, s, w, np, fs, ds)
729 USE typesizes, ONLY: wp => EightByteReal
730 REAL(wp), DIMENSION(:), INTENT(in) :: T ! Time
731 REAL(wp), DIMENSION(:), INTENT(in) :: S ! Signal samples (time)
732 INTEGER, INTENT(in) :: W ! Window width [samples]
733 INTEGER, INTENT(in) :: NP ! Polynomial degree
734 REAL(wp), DIMENSION(:), INTENT(out) :: FS ! Filtered signal
735 REAL(wp), DIMENSION(:), OPTIONAL, INTENT(out) :: DS ! Signal deriv
736 END SUBROUTINE ropp_pp_sliding_poly_1d
737 SUBROUTINE ropp_pp_sliding_poly_2d(t, s, w, np, fs, ds)
738 USE typesizes, ONLY: wp => EightByteReal
739 REAL(wp), DIMENSION(:), INTENT(in) :: T ! Time
740 REAL(wp), DIMENSION(:,:), INTENT(in) :: S ! Signal [ch,t]
741 INTEGER, INTENT(in) :: W ! Window width [samples]
742 INTEGER, INTENT(in) :: NP ! Polynomial degree
743 REAL(wp), DIMENSION(:,:), INTENT(out) :: FS ! Filtered signal
744 REAL(wp), DIMENSION(:,:), OPTIONAL, INTENT(out) :: DS ! Signal deriv
745
746 END SUBROUTINE ropp_pp_sliding_poly_2d
747 SUBROUTINE ropp_pp_sliding_poly_vec1d(t, s, w, np, fs, ds)
748 USE typesizes, ONLY: wp => EightByteReal
749 REAL(wp), DIMENSION(:), INTENT(in) :: T ! Time
750 REAL(wp), DIMENSION(:), INTENT(in) :: S ! Signal samples (time)
751 INTEGER, DIMENSION(:), INTENT(in) :: W ! Window width (time)
752 INTEGER, INTENT(in) :: NP ! Polynomial degree
753 REAL(wp), DIMENSION(:), INTENT(out) :: FS ! Filtered signal
754 REAL(wp), DIMENSION(:), OPTIONAL, INTENT(out) :: DS ! Signal derivative
755 END SUBROUTINE ropp_pp_sliding_poly_vec1d
756 END INTERFACE
757
758END MODULE ropp_pp