-
Notifications
You must be signed in to change notification settings - Fork 145
/
mpas_dart_obs_preprocess.f90
2349 lines (1845 loc) · 87.4 KB
/
mpas_dart_obs_preprocess.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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
! DART software - Copyright UCAR. This open source software is provided
! by UCAR, "as is", without charge, subject to all terms of use at
! http://www.image.ucar.edu/DAReS/DART/DART_download
program mpas_dart_obs_preprocess
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! mpas_dart_obs_preprocess
!
! MPAS-DART utility program that adds observations from supplimental obs sequences.
! An actual observation time for each obs can be overwritten as the analysis time,
! and/or the observations beyond the specified time window can be removed.
! In addition, this program allows users to do the following functions:
!
! - remove observations above certain pressure/height levels
! - remove observations where the model and obs topography are large.
! - remove significant level rawinsonde data
! - remove rawinsonde observations near TC core
! - superob aircraft and satellite wind data
! - average over observations within each voxel (in 3D).
! - voxels are defined by mpas grid cells (read from grid_definition_filename
! in &model_nml) and the vertical ranges specified in the namelist.
! - bad observations with qc higher than superob_qc_threshold is not used.
! - the highest qc and obs error available in each voxel are assigned to
! the superobed observation.
! - merge acars and aircraft observations into acars.
!
! created based on wrf_dart_obs_preprocess by Soyoung Ha, NCAR/MMM (Dec. 2014)
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
use types_mod, only : r8, missing_r8, earth_radius, RAD2DEG, DEG2RAD, i8
use utilities_mod, only : error_handler, E_MSG, find_namelist_in_file, &
check_namelist_read, initialize_utilities, &
finalize_utilities
use time_manager_mod, only : time_type, operator(>=), operator(<), operator(>), operator(<=), &
increment_time, decrement_time, operator(-), operator(+), &
set_calendar_type, GREGORIAN, set_time, get_time
use location_mod, only : location_type, get_location, set_location, get_dist, &
VERTISUNDEF, VERTISSURFACE, VERTISPRESSURE, &
is_vertical, operator(==), get_close_type, get_close_init, &
get_close_obs, get_close_destroy, set_location_missing, write_location
use obs_sequence_mod, only : append_obs_to_seq, copy_obs, delete_obs_from_seq, &
destroy_obs_sequence, get_first_obs, get_last_obs, &
get_next_obs, get_next_obs_from_key, get_num_copies, &
get_num_obs, get_num_qc, get_obs_def, get_obs_key, &
get_obs_values, get_qc, get_qc_meta_data, init_obs, &
insert_obs_in_seq, obs_sequence_type, obs_type, set_obs, &
read_obs_seq, read_obs_seq_header, set_copy_meta_data, &
set_obs_def, set_obs_values, set_qc, set_qc_meta_data, &
static_init_obs_sequence, write_obs_seq, init_obs_sequence
use obs_def_mod, only : get_obs_def_error_variance, get_obs_def_location, &
get_obs_def_time, get_obs_def_type_of_obs, obs_def_type, &
set_obs_def_error_variance, set_obs_def_type_of_obs, &
set_obs_def_location, set_obs_def_time
use obs_kind_mod, only : ACARS_DEWPOINT, ACARS_RELATIVE_HUMIDITY, ACARS_SPECIFIC_HUMIDITY, &
ACARS_TEMPERATURE, ACARS_U_WIND_COMPONENT, ACARS_V_WIND_COMPONENT, &
AIRCRAFT_SPECIFIC_HUMIDITY, AIRCRAFT_TEMPERATURE, AIRCRAFT_U_WIND_COMPONENT, &
AIRCRAFT_V_WIND_COMPONENT, GPS_PRECIPITABLE_WATER, GPSRO_REFRACTIVITY, &
QTY_SURFACE_ELEVATION, LAND_SFC_ALTIMETER, LAND_SFC_DEWPOINT, &
LAND_SFC_RELATIVE_HUMIDITY, LAND_SFC_SPECIFIC_HUMIDITY, LAND_SFC_TEMPERATURE, &
LAND_SFC_U_WIND_COMPONENT, LAND_SFC_V_WIND_COMPONENT, MARINE_SFC_ALTIMETER, &
MARINE_SFC_DEWPOINT, MARINE_SFC_RELATIVE_HUMIDITY, MARINE_SFC_SPECIFIC_HUMIDITY, &
MARINE_SFC_TEMPERATURE, MARINE_SFC_U_WIND_COMPONENT, MARINE_SFC_V_WIND_COMPONENT, &
METAR_ALTIMETER, METAR_DEWPOINT_2_METER, METAR_RELATIVE_HUMIDITY_2_METER, &
METAR_SPECIFIC_HUMIDITY_2_METER, METAR_TEMPERATURE_2_METER, METAR_U_10_METER_WIND, &
METAR_V_10_METER_WIND, PROFILER_U_WIND_COMPONENT, PROFILER_V_WIND_COMPONENT, &
RADIOSONDE_DEWPOINT, RADIOSONDE_RELATIVE_HUMIDITY, RADIOSONDE_SPECIFIC_HUMIDITY, &
RADIOSONDE_SURFACE_ALTIMETER, RADIOSONDE_TEMPERATURE, RADIOSONDE_U_WIND_COMPONENT, &
RADIOSONDE_V_WIND_COMPONENT, SAT_U_WIND_COMPONENT, SAT_V_WIND_COMPONENT
use model_mod, only : static_init_model, get_grid_dims, get_xland, &
model_interpolate, find_closest_cell_center, &
cell_ok_to_interpolate, is_global_grid, &
get_bdy_mask, get_cell_center_coords
use ensemble_manager_mod, only : ensemble_type, init_ensemble_manager, end_ensemble_manager
use netcdf
implicit none
! version controlled file description for error handling, do not edit
character(len=*), parameter :: source = 'models/mpas_atm/mpas_dart_obs_preprocess.f90'
character(len=*), parameter :: revision = ''
character(len=*), parameter :: revdate = ''
! ----------------------------------------------------------------------
! Declare namelist parameters
! ----------------------------------------------------------------------
! Generic parameters
character(len=129) :: file_name_input = 'obs_seq.old', &
file_name_output = 'obs_seq.new', &
sonde_extra = 'obs_seq.rawin', &
acars_extra = 'obs_seq.acars', &
land_sfc_extra = 'obs_seq.land_sfc', &
metar_extra = 'obs_seq.metar', &
marine_sfc_extra = 'obs_seq.marine', &
sat_wind_extra = 'obs_seq.satwnd', &
profiler_extra = 'obs_seq.profiler', &
gpsro_extra = 'obs_seq.gpsro', &
gpspw_extra = 'obs_seq.gpspw', &
trop_cyclone_extra = 'obs_seq.tc'
integer :: max_num_obs = 1000000 ! Largest number of obs in one sequence
! parameters to deal with obs near boundary if regional grid
logical :: increase_bdy_error = .false. ! true to increase obs error near boundary
real(r8) :: maxobsfac = 2.5_r8 ! maximum increase in obs error near boundary
real(r8) :: obsdistbdy = 150000.0_r8 ! within X meters of boundary will have err changed
! parameters used to reduce observations
logical :: sfc_elevation_check = .false. ! remove obs where model-obs topography is large
real(r8) :: sfc_elevation_tol = 300.0_r8 ! largest difference between model and obs. topo.
real(r8) :: obs_pressure_top = 0.0_r8 ! remove all obs at lower pressure
real(r8) :: obs_height_top = 2.0e10_r8 ! remove all obs at higher height
! Rawinsonde-specific parameters
logical :: include_sig_data = .true. ! include significant-level data
real(r8) :: tc_sonde_radii = -1.0_r8 ! remove sonde obs closer than this to TC
! aircraft-specific parameters
logical :: superob_aircraft = .false. ! super-ob aircraft data
real(r8) :: aircraft_pres_int = 2500.0_r8 ! pressure interval for super-ob
integer :: superob_qc_threshold = 4 ! reject obs with qc > 4 (applied for both aircraft and satwnd)
! sat wind specific parameters
logical :: superob_sat_winds = .false. ! super-ob sat wind data
real(r8) :: sat_wind_pres_int = 2500.0_r8 ! pressure interval for super-ob
logical :: overwrite_ncep_satwnd_qc = .false. ! true to overwrite NCEP QC (see instructions)
! surface obs. specific parameters
logical :: overwrite_ncep_sfc_qc = .false. ! true to overwrite NCEP QC (see instructions)
! lowest height for GPS REFRACTIVITY (SYHA)
real(r8) :: gpsro_lowest_meter = 3000.0 ! remove all obs at lower height
! overwrite or windowing obs time
logical :: overwrite_obs_time = .false. ! true to overwrite all observation times
logical :: windowing_obs_time = .false. ! true to remove obs beyond the time window
real(r8) :: windowing_int_hour = 1.5_r8 ! time window [hr] centered on the analysis time
! debug
integer :: print_every_nth_obs = -1 ! if positive, print a reassuring message as you loop
! over the list of obs
namelist /mpas_dart_obs_preprocess_nml/ file_name_input, file_name_output, max_num_obs, &
include_sig_data, superob_aircraft, superob_sat_winds, superob_qc_threshold, &
sfc_elevation_check, overwrite_ncep_sfc_qc, overwrite_ncep_satwnd_qc, &
aircraft_pres_int, sat_wind_pres_int, sfc_elevation_tol, &
obs_pressure_top, obs_height_top, gpsro_lowest_meter, sonde_extra, metar_extra, &
acars_extra, land_sfc_extra, marine_sfc_extra, sat_wind_extra, profiler_extra, &
trop_cyclone_extra, gpsro_extra, gpspw_extra, tc_sonde_radii, overwrite_obs_time, &
increase_bdy_error, maxobsfac, obsdistbdy, windowing_obs_time, windowing_int_hour, &
print_every_nth_obs
!----------------------------------------------------------------------
! Declare other variables
!----------------------------------------------------------------------
character(len=129) :: obs_seq_read_format
character(len=80) :: name
integer :: io, iunit, fid, var_id, obs_seq_file_id, num_copies, &
num_qc, num_obs, max_obs_seq, gday, gsec
logical :: file_exist, pre_I_format
type(obs_sequence_type) :: seq_all, seq_rawin, seq_sfc, seq_acars, seq_satwnd, &
seq_prof, seq_tc, seq_gpsro, seq_other, seq_gpspw, seq_air
type(time_type) :: anal_time
type(ensemble_type) :: dummy_ens
integer :: nCells = -1 ! Total number of cells making up the grid
integer :: nVertices = -1 ! Unique points in grid that are corners of cells
integer :: nEdges = -1 ! Straight lines between vertices making up cells
integer :: nVertLevels = -1 ! Vertical levels; count of vert cell centers
integer :: vertexDegree = -1 ! Max number of cells/edges that touch any vertex
integer :: nSoilLevels = -1 ! Number of soil layers
integer :: dimid, ncid, VarID
real(r8), allocatable :: xland(:) ! indicator for land (1.0_r8) or ocean (> 1.0_r8)
real(r8) :: radius_meters = earth_radius * 1000.0_r8 ! radius in meters, not km.
call initialize_utilities('mpas_dart_obs_preprocess')
print*,'Enter target assimilation time (gregorian day, second): '
read*, gday,gsec
call set_calendar_type(GREGORIAN)
anal_time = set_time(gsec, gday)
call find_namelist_in_file("input.nml", "mpas_dart_obs_preprocess_nml", iunit)
read(iunit, nml = mpas_dart_obs_preprocess_nml, iostat = io)
call check_namelist_read(iunit, io, "mpas_dart_obs_preprocess_nml")
call static_init_obs_sequence()
call static_init_model()
call init_ensemble_manager(dummy_ens, 1, 1_i8)
call get_grid_dims(nCells, nVertices, nEdges, nVertLevels, vertexDegree, nSoilLevels)
allocate(xland(nCells))
call get_xland(nCells,xland)
!print*,'xland: ',minval(xland),maxval(xland)
! if obs_seq file exists, read in the data, otherwise, create a blank one.
inquire(file = trim(adjustl(file_name_input)), exist = file_exist)
if ( file_exist ) then
print*,'file_name_input: ',trim(file_name_input)
call read_obs_seq_header(file_name_input, num_copies, num_qc, num_obs, max_obs_seq, &
obs_seq_file_id, obs_seq_read_format, pre_I_format, close_the_file = .true.)
if( max_obs_seq < max_num_obs ) max_obs_seq = max_num_obs
else
num_copies = 1 ; num_qc = 1 ; max_obs_seq = max_num_obs
call create_new_obs_seq(num_copies, num_qc, max_obs_seq, seq_all)
end if
! create obs sequences for different obs types
call create_new_obs_seq(num_copies, num_qc, max_obs_seq, seq_rawin)
call create_new_obs_seq(num_copies, num_qc, max_obs_seq, seq_sfc)
call create_new_obs_seq(num_copies, num_qc, max_obs_seq, seq_acars)
call create_new_obs_seq(num_copies, num_qc, max_obs_seq, seq_air)
call create_new_obs_seq(num_copies, num_qc, max_obs_seq, seq_satwnd)
call create_new_obs_seq(num_copies, num_qc, max_obs_seq, seq_prof)
call create_new_obs_seq(num_copies, num_qc, max_obs_seq, seq_gpsro)
call create_new_obs_seq(num_copies, num_qc, 100, seq_tc)
call create_new_obs_seq(num_copies, num_qc, max_obs_seq, seq_other)
call create_new_obs_seq(num_copies, num_qc, max_obs_seq, seq_gpspw)
print *, 'calling read_and_parse_input_seq'
! read input obs_seq file, divide into platforms
call read_and_parse_input_seq(file_name_input, xland, obsdistbdy, &
include_sig_data, obs_pressure_top, obs_height_top, sfc_elevation_check, &
sfc_elevation_tol, overwrite_ncep_sfc_qc, overwrite_ncep_satwnd_qc, &
overwrite_obs_time, anal_time, windowing_obs_time, windowing_int_hour, &
seq_rawin, seq_sfc, seq_acars, seq_air, seq_satwnd, seq_tc, seq_gpsro, &
seq_gpspw, seq_other)
!print *, 'calling add supplimental obs 1 of 10'
! add supplimental rawinsonde observations from file
call add_supplimental_obs(sonde_extra, seq_rawin, max_obs_seq, &
RADIOSONDE_U_WIND_COMPONENT, include_sig_data, &
obs_pressure_top, obs_height_top, gpsro_lowest_meter, sfc_elevation_check, sfc_elevation_tol, &
overwrite_obs_time, anal_time, windowing_obs_time, windowing_int_hour)
!print *, 'calling add supplimental obs 2 of 10'
! add supplimental ACARS observations from file
call add_supplimental_obs(acars_extra, seq_acars, max_obs_seq, &
ACARS_U_WIND_COMPONENT, include_sig_data, &
obs_pressure_top, obs_height_top, gpsro_lowest_meter, sfc_elevation_check, sfc_elevation_tol, &
overwrite_obs_time, anal_time, windowing_obs_time, windowing_int_hour)
!print *, 'calling add supplimental obs 3 of 10'
! add supplimental marine observations from file
call add_supplimental_obs(marine_sfc_extra, seq_sfc, max_obs_seq, &
MARINE_SFC_U_WIND_COMPONENT, include_sig_data, &
obs_pressure_top, obs_height_top, gpsro_lowest_meter, sfc_elevation_check, sfc_elevation_tol, &
overwrite_obs_time, anal_time, windowing_obs_time, windowing_int_hour)
!print *, 'calling add supplimental obs 4 of 10'
! add supplimental land surface observations from file
call add_supplimental_obs(land_sfc_extra, seq_sfc, max_obs_seq, &
LAND_SFC_U_WIND_COMPONENT, include_sig_data, &
obs_pressure_top, obs_height_top, gpsro_lowest_meter, sfc_elevation_check, sfc_elevation_tol, &
overwrite_obs_time, anal_time, windowing_obs_time, windowing_int_hour)
!print *, 'calling add supplimental obs 5 of 10'
! add supplimental metar observations from file
call add_supplimental_obs(metar_extra, seq_sfc, max_obs_seq, &
METAR_U_10_METER_WIND, include_sig_data, &
obs_pressure_top, obs_height_top, gpsro_lowest_meter, sfc_elevation_check, sfc_elevation_tol, &
overwrite_obs_time, anal_time, windowing_obs_time, windowing_int_hour)
!print *, 'calling add supplimental obs 6 of 10'
! add supplimental satellite wind observations from file
call add_supplimental_obs(sat_wind_extra, seq_satwnd, max_obs_seq, &
SAT_U_WIND_COMPONENT, include_sig_data, &
obs_pressure_top, obs_height_top, gpsro_lowest_meter, sfc_elevation_check, sfc_elevation_tol, &
overwrite_obs_time, anal_time, windowing_obs_time, windowing_int_hour)
!print *, 'calling add supplimental obs 7 of 10'
! add supplimental profiler observations from file
call add_supplimental_obs(profiler_extra, seq_prof, max_obs_seq, &
PROFILER_U_WIND_COMPONENT, include_sig_data, &
obs_pressure_top, obs_height_top, gpsro_lowest_meter, sfc_elevation_check, sfc_elevation_tol, &
overwrite_obs_time, anal_time, windowing_obs_time, windowing_int_hour)
!print *, 'calling add supplimental obs 8 of 10'
! add supplimental GPSRO observations from file
call add_supplimental_obs(gpsro_extra, seq_gpsro, max_obs_seq, &
GPSRO_REFRACTIVITY, include_sig_data, &
obs_pressure_top, obs_height_top, gpsro_lowest_meter, sfc_elevation_check, sfc_elevation_tol, &
overwrite_obs_time, anal_time, windowing_obs_time, windowing_int_hour)
!print *, 'calling add supplimental obs 9 of 10'
! add supplimental GPSPW observations from file
call add_supplimental_obs(gpspw_extra, seq_gpspw, max_obs_seq, &
GPS_PRECIPITABLE_WATER, include_sig_data, &
obs_pressure_top, obs_height_top, gpsro_lowest_meter, sfc_elevation_check, sfc_elevation_tol, &
overwrite_obs_time, anal_time, windowing_obs_time, windowing_int_hour)
!print *, 'calling add supplimental obs 10 of 10'
! add supplimental tropical cyclone vortex observations from file
!call add_supplimental_obs(trop_cyclone_extra, seq_tc, max_obs_seq, &
!VORTEX_LAT, include_sig_data, &
!obs_pressure_top, obs_height_top, gpsro_lowest_meter, sfc_elevation_check, sfc_elevation_tol, &
!overwrite_obs_time, anal_time, windowing_obs_time, windowing_int_hour)
! remove all sonde observations within radius of TC if desired
if ( tc_sonde_radii > 0.0_r8 ) call remove_sondes_near_tc(seq_tc, &
seq_rawin, tc_sonde_radii)
print *, 'ready to superob'
! super-ob ACARS data
if ( superob_aircraft ) then
call superob_aircraft_data(seq_acars, nCells, anal_time, &
aircraft_pres_int, superob_qc_threshold, obs_pressure_top, 'ACAR')
call superob_aircraft_data(seq_air, nCells, anal_time, &
aircraft_pres_int, superob_qc_threshold, obs_pressure_top, 'AIRS')
endif
! super-ob satellite wind data
if ( superob_sat_winds ) call superob_sat_wind_data(seq_satwnd, nCells, anal_time, &
sat_wind_pres_int, superob_qc_threshold, obs_pressure_top)
print*, 'Number of obs processed:'
print*, 'num_rawin: ', get_num_obs(seq_rawin)
print*, 'num_sfc: ', get_num_obs(seq_sfc)
print*, 'num_acars: ', get_num_obs(seq_acars)
print*, 'num_airs: ', get_num_obs(seq_air)
print*, 'num_satwnd: ', get_num_obs(seq_satwnd)
print*, 'num_prof: ', get_num_obs(seq_prof)
print*, 'num_gpsro: ', get_num_obs(seq_gpsro)
print*, 'num_gpspw: ', get_num_obs(seq_gpspw)
print*, 'num_tc: ', get_num_obs(seq_tc)
print*, 'num_other: ', get_num_obs(seq_other)
max_obs_seq = get_num_obs(seq_tc) + get_num_obs(seq_rawin) + &
get_num_obs(seq_sfc) + get_num_obs(seq_acars) + &
get_num_obs(seq_satwnd) + get_num_obs(seq_prof) + &
get_num_obs(seq_gpsro) + get_num_obs(seq_gpspw) + &
get_num_obs(seq_other) + get_num_obs(seq_air)
print*, 'num_total: ', max_obs_seq
call create_new_obs_seq(num_copies, num_qc, max_obs_seq, seq_all)
call build_master_sequence(seq_tc, seq_all)
call destroy_obs_sequence(seq_tc)
call build_master_sequence(seq_rawin, seq_all)
call destroy_obs_sequence(seq_rawin)
call build_master_sequence(seq_sfc, seq_all)
call destroy_obs_sequence(seq_sfc)
call build_master_sequence(seq_acars, seq_all)
call destroy_obs_sequence(seq_acars)
call build_master_sequence(seq_air, seq_all)
call destroy_obs_sequence(seq_air)
call build_master_sequence(seq_gpsro, seq_all)
call destroy_obs_sequence(seq_gpsro)
call build_master_sequence(seq_gpspw, seq_all)
call destroy_obs_sequence(seq_gpspw)
call build_master_sequence(seq_satwnd, seq_all)
call destroy_obs_sequence(seq_satwnd)
call build_master_sequence(seq_prof, seq_all)
call destroy_obs_sequence(seq_prof)
call build_master_sequence(seq_other, seq_all)
call destroy_obs_sequence(seq_other)
write(6,*) 'Total number of observations after superobing:', get_num_obs(seq_all)
write(6,*) ''
print *, 'ready to call increase_obs_err_bdy'
! increase the observation error along the regional boundary
if ( increase_bdy_error ) call increase_obs_err_bdy(seq_all, &
obsdistbdy, maxobsfac)
! write the observation sequence to file
call write_obs_seq(seq_all, file_name_output)
call destroy_obs_sequence(seq_all)
! release any other allocated space and close down cleanly
deallocate(xland)
call finalize_utilities()
contains
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! aircraft_obs_check - function that determines whether to include an
! aircraft observation in the sequence. For now,
! this function is a placeholder and returns true.
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function aircraft_obs_check()
logical :: aircraft_obs_check
aircraft_obs_check = .true.
end function aircraft_obs_check
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! acars_obs_check - function that determines whether to include an
! acars observation in the sequence. For now,
! this function is a placeholder and returns true.
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function acars_obs_check()
logical :: acars_obs_check
acars_obs_check = .true.
end function acars_obs_check
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! add_supplimental_obs - subroutine that reads observation data from
! a supplimental obs sequence file, performs
! validation checks and adds it to the
! platform-specific obs sequence.
!
! filename - name of supplimental obs sequence file
! obs_seq - platform-specific obs sequence
! max_obs_seq - maximum number of observations in sequence
! plat_kind - integer kind of platform (used for print statements)
! siglevel - true to include sonde significant level data
! ptop - lowest pressure to include in sequence
! htop - highest height level to include in sequence
! sfcelev - true to perform surface obs. elevation check
! elev_max - maximum difference between model and obs. height
! overwrite_time - if true, replace actual observation time with atime
! atime - analysis time, for windowing and overwriting obs times
! obs_window - if true, exclude obs earlier or later than window interval
! window_hours - hours for time window, obs more than +/- away discarded
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine add_supplimental_obs(filename, obs_seq, max_obs_seq, plat_kind, &
siglevel, ptop, htop, hbot, sfcelev, elev_max, &
overwrite_time, atime, obs_window, window_hours)
character(len=129), intent(in) :: filename
type(obs_sequence_type), intent(inout) :: obs_seq
integer, intent(in) :: max_obs_seq, plat_kind
logical, intent(in) :: siglevel, sfcelev, overwrite_time
real(r8), intent(in) :: ptop, htop, hbot, elev_max
type(time_type), intent(in) :: atime
logical, intent(in) :: obs_window
real(r8), intent(in) :: window_hours
integer :: nloc, okind
integer :: gsec, gday, dsec, bday, bsec, eday, esec, num_excluded_bytime
logical :: file_exist, last_obs, pass_checks, first_obs
real(r8) :: llv_loc(3)
type(location_type) :: obs_loc_list(max_obs_seq), obs_loc
type(obs_def_type) :: obs_def
type(obs_sequence_type) :: supp_obs_seq
type(obs_type) :: obs_in, prev_obsi, prev_obso, obs
type(time_type) :: obs_time, prev_time
type(time_type) :: window_min, window_max
inquire(file = trim(adjustl(filename)), exist = file_exist)
if ( .not. file_exist ) return
write(6,*) ''
select case (plat_kind)
case (RADIOSONDE_U_WIND_COMPONENT)
write(6,*) 'Adding Supplimental Rawinsonde Data'
case (ACARS_U_WIND_COMPONENT)
write(6,*) 'Adding Supplimental ACARS Data'
case (MARINE_SFC_U_WIND_COMPONENT)
write(6,*) 'Adding Supplimental Marine Surface Data'
case (LAND_SFC_U_WIND_COMPONENT)
write(6,*) 'Adding Supplimental Land Surface Data'
case (METAR_U_10_METER_WIND)
write(6,*) 'Adding Supplimental METAR Data'
case (SAT_U_WIND_COMPONENT)
write(6,*) 'Adding Supplimental Satellite Wind Data'
! case (VORTEX_LAT)
! write(6,*) 'Adding Supplimental Tropical Cyclone Data'
case (GPSRO_REFRACTIVITY)
write(6,*) 'Adding Supplimental GPS RO Data'
case (GPS_PRECIPITABLE_WATER)
write(6,*) 'Adding Supplimental GPS PW Data'
end select
call init_obs(obs_in, get_num_copies(obs_seq), get_num_qc(obs_seq))
call init_obs(obs, get_num_copies(obs_seq), get_num_qc(obs_seq))
call init_obs(prev_obsi, get_num_copies(obs_seq), get_num_qc(obs_seq))
call init_obs(prev_obso, get_num_copies(obs_seq), get_num_qc(obs_seq))
! create list of observations in plaform sequence
call build_obs_loc_list(obs_seq, max_obs_seq, nloc, obs_loc_list)
! find the last observation in the sequence
if ( get_last_obs(obs_seq, prev_obso) ) then
first_obs = .false.
call get_obs_def(prev_obso, obs_def)
prev_time = get_obs_def_time(obs_def)
else
first_obs = .true.
end if
last_obs = .false.
call read_obs_seq(trim(adjustl(filename)), 0, 0, 0, supp_obs_seq)
if ( .not. get_first_obs(supp_obs_seq, obs_in) ) last_obs = .true.
! windowing obs - don't compute these things if not going to use them
if ( obs_window ) then
dsec = nint(window_hours * 3600.)
window_min = decrement_time(atime, dsec)
window_max = increment_time(atime, dsec)
num_excluded_bytime = 0 ! total number of obs beyond the time window
end if
ObsLoop: do while ( .not. last_obs ) ! loop over all observations in a sequence
! read data from observation
call get_obs_def(obs_in, obs_def)
okind = get_obs_def_type_of_obs(obs_def)
obs_loc = get_obs_def_location(obs_def)
llv_loc = get_location(obs_loc)
obs_time = get_obs_def_time(obs_def)
! check if the observation is within vertical bounds of domain
if ( (is_vertical(obs_loc, "PRESSURE") .and. llv_loc(3) < ptop) .or. &
(is_vertical(obs_loc, "HEIGHT") .and. llv_loc(3) > htop) ) then
prev_obsi = obs_in
call get_next_obs(supp_obs_seq, prev_obsi, obs_in, last_obs)
cycle ObsLoop
end if
! check if the observation already exists
if ( .not. original_observation(obs_loc, obs_loc_list, nloc) ) then
prev_obsi = obs_in
call get_next_obs(supp_obs_seq, prev_obsi, obs_in, last_obs)
cycle ObsLoop
end if
if ( obs_window ) then
if ( obs_time <= window_min .or. obs_time > window_max ) then
prev_obsi = obs_in
call get_next_obs(supp_obs_seq, prev_obsi, obs_in, last_obs)
num_excluded_bytime = num_excluded_bytime + 1
cycle ObsLoop
end if
end if
! perform platform-specific checks
select case (plat_kind)
case (RADIOSONDE_U_WIND_COMPONENT)
pass_checks = rawinsonde_obs_check(obs_loc, okind, siglevel, &
sfcelev, elev_max)
case (ACARS_U_WIND_COMPONENT)
pass_checks = acars_obs_check()
case (AIRCRAFT_U_WIND_COMPONENT)
pass_checks = aircraft_obs_check()
case (MARINE_SFC_U_WIND_COMPONENT)
pass_checks = surface_obs_check(sfcelev, elev_max, llv_loc)
case (LAND_SFC_U_WIND_COMPONENT)
pass_checks = surface_obs_check(sfcelev, elev_max, llv_loc)
case (METAR_U_10_METER_WIND)
pass_checks = surface_obs_check(sfcelev, elev_max, llv_loc)
case (SAT_U_WIND_COMPONENT)
pass_checks = sat_wind_obs_check()
case (GPSRO_REFRACTIVITY)
pass_checks = minimum_height_check(hbot, llv_loc)
case default
pass_checks = .true.
end select
if ( pass_checks ) then
call copy_obs(obs, obs_in)
call get_obs_def(obs, obs_def)
obs_time = get_obs_def_time(obs_def)
! overwrite the observation time with the analysis time if desired
if ( overwrite_time ) then
call set_obs_def_time(obs_def, atime)
call set_obs_def(obs, obs_def)
end if
if (obs_time >= prev_time .and. (.not. first_obs)) then ! same time or later than previous obs
call insert_obs_in_seq(obs_seq, obs, prev_obso)
else ! earlier, search from start of seq
call insert_obs_in_seq(obs_seq, obs)
end if
first_obs = .false.
prev_obso = obs
prev_time = obs_time
end if
prev_obsi = obs_in
call get_next_obs(supp_obs_seq, prev_obsi, obs_in, last_obs)
end do ObsLoop
call destroy_obs_sequence(supp_obs_seq)
if ( obs_window ) &
print*, 'Number of obs outside the time window in this supplimental_obs:',num_excluded_bytime
end subroutine add_supplimental_obs
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! create_new_obs_seq - subroutine that is used to create a new
! observation sequence.
!
! num_copies - number of copies associated with each observation
! num_qc - number of quality control reports in each obs.
! max_num - maximum number of observations in sequence
! seq - observation sequence
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine create_new_obs_seq(num_copies, num_qc, max_num, seq)
integer, intent(in) :: num_copies, num_qc, max_num
type(obs_sequence_type), intent(out) :: seq
character(len=129) :: copy_meta_data, qc_meta_data
integer :: i
call init_obs_sequence(seq, num_copies, num_qc, max_num)
do i = 1, num_copies
copy_meta_data = 'NCEP BUFR observation'
call set_copy_meta_data(seq, i, copy_meta_data)
end do
do i = 1, num_qc
qc_meta_data = 'NCEP QC index'
call set_qc_meta_data(seq, i, qc_meta_data)
end do
end subroutine create_new_obs_seq
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! build_master_sequence - subroutine used to take observations from
! a smaller observation sequence and appends
! them to a larger observation sequence.
! Note that this routine only works if the
! observations are at the same time.
!
! seq_type - observation sequence with one observation type
! seq_all - observation sequence with more observations
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine build_master_sequence(seq_type, seq_all)
type(obs_sequence_type), intent(in) :: seq_type
type(obs_sequence_type), intent(inout) :: seq_all
logical :: last_obs, first_obs
type(obs_def_type) :: obs_def
type(obs_type) :: obs_in, obs, prev_obsi, prev_obsa
type(time_type) :: obs_time, prev_time
last_obs = .false. ; first_obs = .true.
call init_obs(obs_in, get_num_copies(seq_type), get_num_qc(seq_type))
call init_obs(obs, get_num_copies(seq_type), get_num_qc(seq_type))
call init_obs(prev_obsi, get_num_copies(seq_type), get_num_qc(seq_type))
call init_obs(prev_obsa, get_num_copies(seq_type), get_num_qc(seq_type))
if ( .not. get_first_obs(seq_type, obs_in) ) return
do while ( .not. last_obs )
call copy_obs(obs, obs_in)
call get_obs_def(obs, obs_def)
obs_time = get_obs_def_time(obs_def)
if (obs_time >= prev_time .and. (.not. first_obs)) then ! same time or later than previous obs
call insert_obs_in_seq(seq_all, obs, prev_obsa)
else ! earlier, search from start of seq
call insert_obs_in_seq(seq_all, obs)
end if
first_obs = .false.
prev_obsi = obs_in
prev_obsa = obs
prev_time = obs_time
call get_next_obs(seq_type, prev_obsi, obs_in, last_obs)
end do
end subroutine build_master_sequence
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! build_obs_loc_list - subroutine that creates an array of locations
! of the observations in a sequence.
!
! obs_seq - observation sequence to read locations from
! maxobs - maximum number of observations in a sequence
! nloc - number of individual locations
! obs_loc_list - array of observation locations
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine build_obs_loc_list(seq, maxobs, nloc, obs_loc_list)
integer, intent(in) :: maxobs
type(obs_sequence_type), intent(in) :: seq
integer, intent(out) :: nloc
type(location_type), intent(out) :: obs_loc_list(maxobs)
logical :: last_obs
type(obs_type) :: obs, prev_obs
type(obs_def_type) :: obs_def
type(location_type) :: obs_loc
call init_obs(obs, get_num_copies(seq), get_num_qc(seq))
call init_obs(prev_obs, get_num_copies(seq), get_num_qc(seq))
last_obs = .false. ; nloc = 0
if ( .not. get_first_obs(seq, obs) ) last_obs = .true.
do while ( .not. last_obs ) ! loop over all observations in a sequence
call get_obs_def(obs, obs_def)
obs_loc = get_obs_def_location(obs_def)
! construct a list of observation locations
if ( original_observation(obs_loc, obs_loc_list, nloc) ) then
nloc = nloc + 1
obs_loc_list(nloc) = obs_loc
end if
prev_obs = obs
call get_next_obs(seq, prev_obs, obs, last_obs)
end do
end subroutine build_obs_loc_list
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! create_obs_type - subroutine that is used to create an observation
! type from observation data.
!
! lat - latitude of observation
! lon - longitude of observation
! vloc - vertical location of observation
! vcord - DART vertical coordinate integer
! obsv - observation value
! okind - observation kind
! oerr - observation error
! day - gregorian day of the observation
! sec - gregorian second of the observation
! qc - integer quality control value
! obs - observation type that includes the observation information
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine create_obs_type(lat, lon, vloc, vcord, obsv, okind, oerr, qc, otime, obs)
integer, intent(in) :: okind, vcord
real(r8), intent(in) :: lat, lon, vloc, obsv, oerr, qc
type(time_type), intent(in) :: otime
type(obs_type), intent(inout) :: obs
real(r8) :: obs_val(1), qc_val(1)
type(obs_def_type) :: obs_def
call set_obs_def_location(obs_def, set_location(lon, lat, vloc, vcord))
call set_obs_def_type_of_obs(obs_def, okind)
call set_obs_def_time(obs_def, otime)
call set_obs_def_error_variance(obs_def, oerr)
call set_obs_def(obs, obs_def)
obs_val(1) = obsv
call set_obs_values(obs, obs_val)
qc_val(1) = qc
call set_qc(obs, qc_val)
end subroutine create_obs_type
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! isManLevel - function that returns a logical true if the input
! pressure level is a mandatory rawinsonde level.
!
! plevel - pressure level to check (Pa)
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function isManLevel(plevel)
real(r8), intent(in) :: plevel
integer, parameter :: nman = 16
integer :: kk
logical :: isManLevel
real (r8) :: raw_man_levels(nman) = &
(/ 100000.0_r8, 92500.0_r8, 85000.0_r8, 70000.0_r8, 50000.0_r8, 40000.0_r8, &
30000.0_r8, 25000.0_r8, 20000.0_r8, 15000.0_r8, 10000.0_r8, 7000.0_r8, &
5000.0_r8, 3000.0_r8, 2000.0_r8, 1000.0_r8 /)
isManLevel = .false.
do kk = 1, nman
if ( plevel == raw_man_levels(kk) ) then
isManLevel = .true.
return
end if
end do
end function isManLevel
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! original_observation - function that returns true if the location
! is not within an array of locations
!
! obsloc - location to check
! obsloc_list - array of locations to look through
! nloc - number of locations in array
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function original_observation(obsloc, obsloc_list, nloc)
integer, intent(in) :: nloc
type(location_type), intent(in) :: obsloc, obsloc_list(nloc)
logical :: original_observation
real(r8), parameter :: dist_epsilon = 0.00001_r8
integer :: n
original_observation = .true.
do n = 1, nloc
if ( get_dist(obsloc, obsloc_list(n), 1, 1, .true.) <= dist_epsilon ) then
original_observation = .false.
return
end if
end do
end function original_observation
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! rawinsonde_obs_check - function that performs obsrvation checks
! specific to rawinsonde observations.
!
! obs_loc - observation location
! obs_kind - DART observation kind
! siglevel - true to include significant level data
! elev_check - true to check differene between model and obs elev.
! elev_max - maximum difference between model and obs elevation
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function rawinsonde_obs_check(obs_loc, obs_kind, siglevel, &
elev_check, elev_max)
type(location_type), intent(in) :: obs_loc
integer, intent(in) :: obs_kind
logical, intent(in) :: siglevel, elev_check
real(r8), intent(in) :: elev_max
logical :: rawinsonde_obs_check
integer :: istatus(1)
real(r8) :: llv_loc(3), hsfc(1)
rawinsonde_obs_check = .true.
llv_loc = get_location(obs_loc)
if ( obs_kind /= RADIOSONDE_SURFACE_ALTIMETER ) then
! check if vertical level is mandatory level
if ( (.not. siglevel) .and. (.not. isManLevel(llv_loc(3))) ) then
rawinsonde_obs_check = .false.
return
end if
else
! perform elevation check for altimeter
if ( elev_check ) then
call model_interpolate(dummy_ens, 1, obs_loc, QTY_SURFACE_ELEVATION, hsfc, istatus)
if ( abs(hsfc(1) - llv_loc(3)) > elev_max ) rawinsonde_obs_check = .false.
end if
end if
end function rawinsonde_obs_check
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! read_and_parse_input_seq - subroutine that reads a generic
! observation sequence and divides the
! obs into sequences for each platform.
!
! filename - name of input obs sequence
! landmask - land/ocean mask, dimensioned (nCells), 1=land,2=water
! obs_bdy_dist - remove obs closer than this to boundary
! siglevel - true to include sonde significant level data
! ptop - lowest pressure to include in sequence
! htop - highest height level to include in sequence
! sfcelev - true to perform surface obs. elevation check
! elev_max - maximum difference between model and obs. height
! new_sfc_qc - true to replace NCEP surface QC
! new_satwnd_qc - true to replace NCEP sat wind QC over ocean
! overwrite_time - if true, replace actual observation time with atime
! atime - analysis time, for windowing and overwriting obs times
! obs_window - if true, exclude obs earlier or later than window interval
! window_hours - hours for time window, obs more than +/- away discarded
! rawin_seq - rawinsonde sequence
! sfc_seq - surface sequence
! acars_seq - aircraft sequence
! satwnd_seq - satellite wind sequence
! tc_seq - TC data sequence
! gpspw_seq - total precipitable water from GPS observations
! other_seq - remaining observation sequence
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine read_and_parse_input_seq(filename, landmask, obs_bdy_dist, siglevel,&
ptop, htop, sfcelev, elev_max, new_sfc_qc, &
new_satwnd_qc, overwrite_time, atime, &
obs_window, window_hours, &
rawin_seq, sfc_seq, acars_seq, air_seq, satwnd_seq, &
tc_seq, gpsro_seq, gpspw_seq, other_seq)
character(len=129), intent(in) :: filename
real(r8), intent(in) :: landmask(:)
real(r8), intent(in) :: obs_bdy_dist
real(r8), intent(in) :: ptop, htop, elev_max
logical, intent(in) :: siglevel, sfcelev, new_sfc_qc, &
new_satwnd_qc, overwrite_time
logical, intent(in) :: obs_window
real(r8), intent(in) :: window_hours
type(time_type), intent(in) :: atime
type(obs_sequence_type), intent(inout) :: rawin_seq, sfc_seq, acars_seq, gpspw_seq, &
satwnd_seq, tc_seq, gpsro_seq, other_seq, &
air_seq
real(r8), parameter :: satwnd_qc_ok = 15.0_r8
real(r8), parameter :: sfc_qc_ok1 = 9.0_r8
real(r8), parameter :: sfc_qc_ok2 = 15.0_r8
real(r8), parameter :: new_qc_value = 2.0_r8
character(len=129) :: qcmeta
integer :: fid, var_id, okind, cellid, dsec, nobs, nth_obs
integer :: bsec, bday, esec, eday, num_excluded_bytime
logical :: file_exist, last_obs, input_ncep_qc, global
real(r8), allocatable :: qc(:)
real(r8) :: llv_loc(3)
type(location_type) :: obs_loc
type(obs_def_type) :: obs_def
type(obs_sequence_type) :: seq
type(obs_type) :: obs, obs_in, prev_obs
type(time_type) :: window_min, window_max, obs_time