1 subroutine da_search_obs (ob_type_string, unit_in, num_obs, nth, iv, found_flag)
3 !-----------------------------------------------------------------------
4 ! Purpose: Search obs. in gts_omb.000
5 !-----------------------------------------------------------------------
7 !-------------------------------------------------------------------------
8 ! read iv=O-B structure written by WRFVAR
9 !-------------------------------------------------------------------------
13 type (iv_type), intent(inout) :: iv ! O-B structure.
14 integer, intent(in) :: unit_in, nth, num_obs
15 character(len=20), intent(in) :: ob_type_string
16 logical, intent(out) :: found_flag
20 integer :: n, n_dummy, k, levels
21 real, parameter :: MIN_ERR=1.0E-6
23 if (trace_use) call da_trace_entry("da_search_obs")
26 SELECT CASE (trim(adjustl(ob_type_string)))
31 read(unit_in,'(i8,a5,2E22.13)') n_dummy, stn_id, lat, lon
32 if ( trim(iv%info(synop)%id(nth)) == trim(adjustl(stn_id)) .and. &
33 abs(iv%info(synop)%lat(1,nth) - lat ) < MIN_ERR .and. &
34 abs(iv%info(synop)%lon(1,nth) - lon ) < MIN_ERR ) then
36 read(unit_in,'(E22.13,5(E22.13,i8,3E22.13))')&
38 iv%synop(nth)%u, &! O-B u
39 iv%synop(nth)%v, &! O-B v
40 iv%synop(nth)%t, &! O-B t
41 iv%synop(nth)%p, &! O-B p
42 iv%synop(nth)%q ! O-B q
46 if (trace_use) call da_trace_exit("da_search_obs")
59 read(unit_in,'(i8,a5,2E22.13)') n_dummy, stn_id, lat, lon
60 if ( trim(iv%info(metar)%id(nth)) == trim(adjustl(stn_id)) .and. &
61 abs(iv%info(metar)%lat(1,nth) - lat ) < MIN_ERR .and. &
62 abs(iv%info(metar)%lon(1,nth) - lon ) < MIN_ERR ) then
64 read(unit_in,'(E22.13,5(E22.13,i8,3E22.13))')&
66 iv%metar(nth)%u, &! O-B u
67 iv%metar(nth)%v, &! O-B v
68 iv%metar(nth)%t, &! O-B t
69 iv%metar(nth)%p, &! O-B p
70 iv%metar(nth)%q ! O-B q
74 if (trace_use) call da_trace_exit("da_search_obs")
87 read(unit_in,'(i8,a5,2E22.13)') n_dummy, stn_id, lat, lon
88 if ( trim(iv%info(ships)%id(nth)) == trim(adjustl(stn_id)) .and. &
89 abs(iv%info(ships)%lat(1,nth) - lat ) < MIN_ERR .and. &
90 abs(iv%info(ships)%lon(1,nth) - lon ) < MIN_ERR ) then
92 read(unit_in,'(E22.13,5(E22.13,i8,3E22.13))')&
94 iv%ships(nth)%u, &! O-B u
95 iv%ships(nth)%v, &! O-B v
96 iv%ships(nth)%t, &! O-B t
97 iv%ships(nth)%p, &! O-B p
98 iv%ships(nth)%q ! O-B q
102 if (trace_use) call da_trace_exit("da_search_obs")
108 !found_flag = .false.
115 read(unit_in,'(i8,a5,2E22.13)') n_dummy, stn_id, lat, lon
116 if ( trim(iv%info(sonde_sfc)%id(nth)) == trim(adjustl(stn_id)) .and. &
117 abs(iv%info(sonde_sfc)%lat(1,nth) - lat ) < MIN_ERR .and. &
118 abs(iv%info(sonde_sfc)%lon(1,nth) - lon ) < MIN_ERR ) then
120 read(unit_in,'(E22.13,5(E22.13,i8,3E22.13))')&
121 iv%sonde_sfc(nth)%h, &
122 iv%sonde_sfc(nth)%u, &! O-B u
123 iv%sonde_sfc(nth)%v, &! O-B v
124 iv%sonde_sfc(nth)%t, &! O-B t
125 iv%sonde_sfc(nth)%p, &! O-B p
126 iv%sonde_sfc(nth)%q ! O-B q
130 if (trace_use) call da_trace_exit("da_search_obs")
136 !found_flag = .false.
143 read(unit_in,'(2i8,a5,2E22.13)') n_dummy, levels, stn_id, lat, lon
144 if ( trim(iv%info(sound)%id(nth)) == trim(adjustl(stn_id)) .and. &
145 abs(iv%info(sound)%lat(1,nth) - lat ) < MIN_ERR .and. &
146 abs(iv%info(sound)%lon(1,nth) - lon ) < MIN_ERR ) then
149 read(unit_in,'(2E22.13,4(E22.13,i8,3E22.13))')&
150 iv % sound(nth) % h(k), &
151 iv % sound(nth) % p(k), & ! Obs Pressure
152 iv%sound(nth)%u(k), &! O-B u
153 iv%sound(nth)%v(k), &! O-B v
154 iv%sound(nth)%t(k), &! O-B t
155 iv%sound(nth)%q(k) ! O-B q
160 if (trace_use) call da_trace_exit("da_search_obs")
168 !found_flag = .false.
175 read(unit_in,'(2i8,a5,2E22.13)') n_dummy, levels, stn_id, lat, lon
176 if ( trim(iv%info(mtgirs)%id(nth)) == trim(adjustl(stn_id)) .and. &
177 abs(iv%info(mtgirs)%lat(1,nth) - lat ) < MIN_ERR .and. &
178 abs(iv%info(mtgirs)%lon(1,nth) - lon ) < MIN_ERR ) then
181 read(unit_in,'(2E22.13,4(E22.13,i8,3E22.13))')&
182 iv % mtgirs(nth) % h(k), &
183 iv % mtgirs(nth) % p(k), & ! Obs Pressure
184 iv%mtgirs(nth)%u(k), &! O-B u
185 iv%mtgirs(nth)%v(k), &! O-B v
186 iv%mtgirs(nth)%t(k), &! O-B t
187 iv%mtgirs(nth)%q(k) ! O-B q
192 if (trace_use) call da_trace_exit("da_search_obs")
200 !found_flag = .false.
207 read(unit_in,'(2i8,a5,2E22.13)') n_dummy, levels, stn_id, lat, lon
208 if ( trim(iv%info(tamdar)%id(nth)) == trim(adjustl(stn_id)) .and. &
209 abs(iv%info(tamdar)%lat(1,nth) - lat ) < MIN_ERR .and. &
210 abs(iv%info(tamdar)%lon(1,nth) - lon ) < MIN_ERR ) then
213 read(unit_in,'(2E22.13,4(E22.13,i8,3E22.13))')&
214 iv % tamdar(nth) % h(k), &
215 iv % tamdar(nth) % p(k), & ! Obs Pressure
216 iv%tamdar(nth)%u(k), &! O-B u
217 iv%tamdar(nth)%v(k), &! O-B v
218 iv%tamdar(nth)%t(k), &! O-B t
219 iv%tamdar(nth)%q(k) ! O-B q
224 if (trace_use) call da_trace_exit("da_search_obs")
232 !found_flag = .false.
239 read(unit_in,'(i8,a5,2E22.13)') n_dummy, stn_id, lat, lon
240 if ( trim(iv%info(tamdar_sfc)%id(nth)) == trim(adjustl(stn_id)) .and. &
241 abs(iv%info(tamdar_sfc)%lat(1,nth) - lat ) < MIN_ERR .and. &
242 abs(iv%info(tamdar_sfc)%lon(1,nth) - lon ) < MIN_ERR ) then
244 read(unit_in,'(E22.13,5(E22.13,i8,3E22.13))')&
245 iv%tamdar_sfc(nth)%h, &
246 iv%tamdar_sfc(nth)%u, &! O-B u
247 iv%tamdar_sfc(nth)%v, &! O-B v
248 iv%tamdar_sfc(nth)%t, &! O-B t
249 iv%tamdar_sfc(nth)%p, &! O-B p
250 iv%tamdar_sfc(nth)%q ! O-B q
254 if (trace_use) call da_trace_exit("da_search_obs")
260 !found_flag = .false.
267 read(unit_in,'(i8,a5,2E22.13)') n_dummy, stn_id, lat, lon
268 if ( trim(iv%info(buoy)%id(nth)) == trim(adjustl(stn_id)) .and. &
269 abs(iv%info(buoy)%lat(1,nth) - lat ) < MIN_ERR .and. &
270 abs(iv%info(buoy)%lon(1,nth) - lon ) < MIN_ERR ) then
272 read(unit_in,'(E22.13,5(E22.13,i8,3E22.13))')&
274 iv%buoy(nth)%u, &! O-B u
275 iv%buoy(nth)%v, &! O-B v
276 iv%buoy(nth)%t, &! O-B t
277 iv%buoy(nth)%p, &! O-B p
278 iv%buoy(nth)%q ! O-B q
282 if (trace_use) call da_trace_exit("da_search_obs")
288 !found_flag = .false.
295 read(unit_in,'(2i8,a5,2E22.13)') n_dummy, levels, stn_id, lat, lon
296 if ( trim(iv%info(geoamv)%id(nth)) == trim(adjustl(stn_id)) .and. &
297 abs(iv%info(geoamv)%lat(1,nth) - lat ) < MIN_ERR .and. &
298 abs(iv%info(geoamv)%lon(1,nth) - lon ) < MIN_ERR ) then
300 read(unit_in,'(E22.13,2(E22.13,i8,3E22.13))')&
301 iv % geoamv(nth) % p(k), & ! Obs Pressure
302 iv%geoamv(nth)%u(k), &! O-B u
308 if (trace_use) call da_trace_exit("da_search_obs")
316 !found_flag = .false.
323 read(unit_in,'(i8,a5,2E22.13)') n_dummy, stn_id, lat, lon
324 if ( trim(iv%info(gpspw)%id(nth)) == trim(adjustl(stn_id)) .and. &
325 abs(iv%info(gpspw)%lat(1,nth) - lat ) < MIN_ERR .and. &
326 abs(iv%info(gpspw)%lon(1,nth) - lon ) < MIN_ERR ) then
328 read(unit_in,'(E22.13,i8,3E22.13)')&
333 if (trace_use) call da_trace_exit("da_search_obs")
339 !found_flag = .false.
346 read(unit_in,'(2i8,2E22.13)') n_dummy, levels, lat, lon
348 if ( abs(iv%info(radar)%lat(1,nth) - lat ) < MIN_ERR .and. &
349 abs(iv%info(radar)%lon(1,nth) - lon ) < MIN_ERR ) then
352 read(unit_in,'(E22.13,i8,3E22.13)')&
359 if (trace_use) call da_trace_exit("da_search_obs")
367 !found_flag = .false.
374 read(unit_in,'(i8,2E22.13)') n_dummy, lat, lon
375 if ( abs(iv%info(ssmi_rv)%lat(1,nth) - lat ) < MIN_ERR .and. &
376 abs(iv%info(ssmi_rv)%lon(1,nth) - lon ) < MIN_ERR ) then
378 read(unit_in,'(2(E22.13,i8,3E22.13))')&
379 iv%ssmi_rv(nth)%speed, & ! O-B speed
380 iv%ssmi_rv(nth)%tpw ! O-BA tpw
384 if (trace_use) call da_trace_exit("da_search_obs")
390 !found_flag = .false.
397 read(unit_in,'(2i8,a5,2E22.13)') n_dummy, levels, stn_id, lat, lon
399 if ( trim(iv%info(airep)%id(nth)) == trim(adjustl(stn_id)) .and. &
400 abs(iv%info(airep)%lat(1,nth) - lat ) < MIN_ERR .and. &
401 abs(iv%info(airep)%lon(1,nth) - lon ) < MIN_ERR ) then
404 read(unit_in,'(2E22.13,4(E22.13,i8,3E22.13))')&
405 iv % airep(nth) % h(k), &
406 iv % airep(nth) % p(k), & ! Obs pressure
407 iv%airep(nth)%u(k), &! O-B u
408 iv%airep(nth)%v(k), &! O-B v
409 iv%airep(nth)%t(k), &!
416 if (trace_use) call da_trace_exit("da_search_obs")
424 !found_flag = .false.
431 read(unit_in,'(2i8,a5,2E22.13)') n_dummy, levels, stn_id, lat, lon
432 if ( trim(iv%info(polaramv)%id(nth)) == trim(adjustl(stn_id)) .and. &
433 abs(iv%info(polaramv)%lat(1,nth) - lat ) < MIN_ERR .and. &
434 abs(iv%info(polaramv)%lon(1,nth) - lon ) < MIN_ERR ) then
437 read(unit_in,'(E22.13,2(E22.13,i8,3E22.13))')&
438 iv % polaramv(nth) % p(k), & ! Obs Pressure
439 iv%polaramv(nth)%u(k), &! O-B u
440 iv%polaramv(nth)%v(k)
445 if (trace_use) call da_trace_exit("da_search_obs")
453 !found_flag = .false.
460 read(unit_in,'(2i8,a5,2E22.13)') n_dummy, levels, stn_id, lat, lon
461 if ( trim(iv%info(pilot)%id(nth)) == trim(adjustl(stn_id)) .and. &
462 abs(iv%info(pilot)%lat(1,nth) - lat ) < MIN_ERR .and. &
463 abs(iv%info(pilot)%lon(1,nth) - lon ) < MIN_ERR ) then
466 read(unit_in,'(E22.13,2(E22.13,i8,3E22.13))')&
467 iv % pilot(nth) % p(k), & ! Obs Pressure
468 iv%pilot(nth)%u(k), &! O-B u
474 if (trace_use) call da_trace_exit("da_search_obs")
482 !found_flag = .false.
489 read(unit_in,'(i8,2E22.13)') n_dummy, lat, lon
490 if ( abs(iv%info(ssmi_tb)%lat(1,nth) - lat ) < MIN_ERR .and. &
491 abs(iv%info(ssmi_tb)%lon(1,nth) - lon ) < MIN_ERR ) then
493 read(unit_in,'(7(E22.13,i8,3E22.13))')&
494 iv%ssmi_tb(nth)%tb19h, & ! O-B Tb19h
495 iv%ssmi_tb(nth)%tb19v, & ! O-B Tb19v
496 iv%ssmi_tb(nth)%tb22v, & ! O-B Tb22v
497 iv%ssmi_tb(nth)%tb37h, & ! O-B Tb37h
498 iv%ssmi_tb(nth)%tb37v, & ! O-B Tb37v
499 iv%ssmi_tb(nth)%tb85h, & ! O-B Tb85h
500 iv%ssmi_tb(nth)%tb85v ! O-B Tb85v
504 if (trace_use) call da_trace_exit("da_search_obs")
510 !found_flag = .false.
517 read(unit_in,'(2i8,a5,2E22.13)') n_dummy, levels, stn_id, lat, lon
518 if ( trim(iv%info(satem)%id(nth)) == trim(adjustl(stn_id)) .and. &
519 abs(iv%info(satem)%lat(1,nth) - lat ) < MIN_ERR .and. &
520 abs(iv%info(satem)%lon(1,nth) - lon ) < MIN_ERR ) then
523 read(unit_in,'(E22.13,(E22.13,i8,3E22.13))')&
524 iv % satem(nth) % p(k), & ! Obs Pressure
525 iv%satem(nth)%thickness(k)
530 if (trace_use) call da_trace_exit("da_search_obs")
538 !found_flag = .false.
545 read(unit_in,'(2i8,a5,2E22.13)') n_dummy, levels, stn_id, lat, lon
546 if ( trim(iv%info(ssmt1)%id(nth)) == trim(adjustl(stn_id)) .and. &
547 abs(iv%info(ssmt1)%lat(1,nth) - lat ) < MIN_ERR .and. &
548 abs(iv%info(ssmt1)%lon(1,nth) - lon ) < MIN_ERR ) then
551 read(unit_in,'(E22.13,(E22.13,i8,3E22.13))')&
552 iv % ssmt1(nth) % h(k), & ! Obs Pressure
558 if (trace_use) call da_trace_exit("da_search_obs")
566 !found_flag = .false.
573 read(unit_in,'(2i8,a5,2E22.13)') n_dummy, levels, stn_id, lat, lon
574 if ( trim(iv%info(ssmt2)%id(nth)) == trim(adjustl(stn_id)) .and. &
575 abs(iv%info(ssmt2)%lat(1,nth) - lat ) < MIN_ERR .and. &
576 abs(iv%info(ssmt2)%lon(1,nth) - lon ) < MIN_ERR ) then
579 read(unit_in,'(E22.13,(E22.13,i8,3E22.13))')&
580 iv % ssmt2(nth) % h(k), & ! Obs Pressure
586 if (trace_use) call da_trace_exit("da_search_obs")
594 !found_flag = .false.
601 read(unit_in,'(i8,a5,2E22.13)') n_dummy, stn_id, lat, lon
602 if ( trim(iv%info(qscat)%id(nth)) == trim(adjustl(stn_id)) .and. &
603 abs(iv%info(qscat)%lat(1,nth) - lat ) < MIN_ERR .and. &
604 abs(iv%info(qscat)%lon(1,nth) - lon ) < MIN_ERR ) then
606 read(unit_in,'(E22.13,2(E22.13,i8,3E22.13))')&
607 iv % qscat(nth) % h, & ! Obs height
608 iv%qscat(nth)%u, &! O-B u
609 iv%qscat(nth)%v ! O-B v
613 if (trace_use) call da_trace_exit("da_search_obs")
619 !found_flag = .false.
626 read(unit_in,'(2i8,a5,2E22.13)') n_dummy, levels, stn_id, lat, lon
627 if ( trim(iv%info(profiler)%id(nth)) == trim(adjustl(stn_id)) .and. &
628 abs(iv%info(profiler)%lat(1,nth) - lat ) < MIN_ERR .and. &
629 abs(iv%info(profiler)%lon(1,nth) - lon ) < MIN_ERR ) then
632 read(unit_in,'(E22.13,2(E22.13,i8,3E22.13))')&
633 iv % profiler(nth) % p(k), & ! Obs Pressure
634 iv%profiler(nth)%u(k), &! O-B u
635 iv%profiler(nth)%v(k) ! O-B v
640 if (trace_use) call da_trace_exit("da_search_obs")
648 !found_flag = .false.
655 read(unit_in,'(2i8,a5,2E22.13)') n_dummy, levels, stn_id, lat, lon
656 if ( trim(iv%info(bogus)%id(nth)) == trim(adjustl(stn_id)) .and. &
657 abs(iv%info(bogus)%lat(1,nth) - lat ) < MIN_ERR .and. &
658 abs(iv%info(bogus)%lon(1,nth) - lon ) < MIN_ERR ) then
660 read(unit_in,'(E22.13,i8,3E22.13)') iv%bogus(nth)%slp
662 read(unit_in,'(2E22.13,4(E22.13,i8,3E22.13))')&
663 iv % bogus(nth) % h(k), &
664 iv % bogus(nth) % p(k), & ! Obs Pressure
665 iv%bogus(nth)%u(k), &! O-B u
666 iv%bogus(nth)%v(k), &! O-B v
667 iv%bogus(nth)%t(k), &! O-B t
668 iv%bogus(nth)%q(k) ! O-B q
673 if (trace_use) call da_trace_exit("da_search_obs")
682 !found_flag = .false.
689 read(unit_in,'(2i8,a5,2E22.13)') n_dummy, levels, stn_id, lat, lon
690 if ( trim(iv%info(airsr)%id(nth)) == trim(adjustl(stn_id)) .and. &
691 abs(iv%info(airsr)%lat(1,nth) - lat ) < MIN_ERR .and. &
692 abs(iv%info(airsr)%lon(1,nth) - lon ) < MIN_ERR ) then
695 read(unit_in,'(E22.13,2(E22.13,i8,3E22.13))')&
696 iv % airsr(nth) % p(k), & ! Obs Pressure
697 iv%airsr(nth)%t(k), &! O-B t
698 iv%airsr(nth)%q(k) ! O-B q
703 if (trace_use) call da_trace_exit("da_search_obs")
711 !found_flag = .false.
718 read(unit_in,'(2i8,a5,2E22.13)') n_dummy, levels, stn_id, lat, lon
719 if ( trim(iv%info(gpsref)%id(nth)) == trim(adjustl(stn_id)) .and. &
720 abs(iv%info(gpsref)%lat(1,nth) - lat ) < MIN_ERR .and. &
721 abs(iv%info(gpsref)%lon(1,nth) - lon ) < MIN_ERR ) then
724 read(unit_in,'(E22.13,(E22.13,i8,3E22.13))')&
725 iv % gpsref(nth) % h(k), & ! Obs Height
726 iv%gpsref(nth)%ref(k) ! O-B ref
731 if (trace_use) call da_trace_exit("da_search_obs")
739 !found_flag = .false.
746 read(unit_in,'(2i8,2E22.13)') n_dummy, levels, lat, lon
748 if ( abs(iv%info(lightning)%lat(1,nth) - lat ) < MIN_ERR .and. &
749 abs(iv%info(lightning)%lon(1,nth) - lon ) < MIN_ERR ) then
752 read(unit_in,'(3(E22.13,i8,3E22.13))')&
753 iv%lightning(nth)%w(k),&
754 iv%lightning(nth)%div(k),&
755 iv%lightning(nth)%qv(k)
761 if (trace_use) call da_trace_exit("da_search_obs")
767 !found_flag = .false.
773 write(unit=message(1), fmt='(a,a20,a,i3)') &
774 'Got unknown obs_type string:', trim(ob_type_string),' on unit ',unit_in
775 call da_error(__FILE__,__LINE__,message(1:1))
779 if (trace_use) call da_trace_exit("da_search_obs")
781 end subroutine da_search_obs