1 subroutine da_get_time_slots(nt,tmin,tana,tmax,time_slots,itime_ana)
3 !------------------------------------------------------------------------------
4 ! Purpose: Calculate time slots for FGAT option.
5 !------------------------------------------------------------------------------
9 integer, intent (in) :: nt ! number of time slots
10 character(len=19), intent (in) :: tmin ! begin of time window
11 character(len=19), intent (in) :: tana ! analysis time
12 character(len=19), intent (in) :: tmax ! end of time window
13 real*8, intent (out) :: time_slots(0:nt) !
14 integer, intent (out) :: itime_ana ! first guess index of analysis time
16 integer :: ana_yyyy,ana_mm,ana_dd,ana_hh,ana_mn,ana_ss
17 integer :: min_yyyy,min_mm,min_dd,min_hh,min_mn,min_ss
18 integer :: max_yyyy,max_mm,max_dd,max_hh,max_mn,max_ss
21 real*8 :: time_ana, time_tmp
24 if (trace_use) call da_trace_entry("da_get_time_slots")
26 read(unit=tana,fmt='(i4,5(a1,i2))') ana_yyyy,s,ana_mm,s,ana_dd,s,ana_hh,s,ana_mn,s,ana_ss
27 read(unit=tmin,fmt='(i4,5(a1,i2))') min_yyyy,s,min_mm,s,min_dd,s,min_hh,s,min_mn,s,min_ss
28 read(unit=tmax,fmt='(i4,5(a1,i2))') max_yyyy,s,max_mm,s,max_dd,s,max_hh,s,max_mn,s,max_ss
30 if (print_detail_obs) then
31 write(unit=stdout,fmt='(3X,A,I4,5(1X,I2))') 'Analysis julian time : ',ana_yyyy,ana_mm,ana_dd,ana_hh,ana_mn,ana_ss
32 write(unit=stdout,fmt='(3X,A,I4,5(1X,I2))') 'Start julian time : ',min_yyyy,min_mm,min_dd,min_hh,min_mn,min_ss
33 write(unit=stdout,fmt='(3X,A,I4,5(1X,I2))') 'End julian time : ',max_yyyy,max_mm,max_dd,max_hh,max_mn,max_ss
36 call da_get_julian_time(ana_yyyy,ana_mm,ana_dd,ana_hh,ana_mn,time_ana)
37 call da_get_julian_time(min_yyyy,min_mm,min_dd,min_hh,min_mn,time_slots(0))
38 call da_get_julian_time(max_yyyy,max_mm,max_dd,max_hh,max_mn,time_slots(nt))
40 ! dt/2 between time_slots 0 and 1
41 ! dt/2 between time_slots nt-1 and nt
42 ! dt between time_slots 1 and 2, 2 and 3, ..., nt-2 and nt-1
44 dt = (time_slots(nt)-time_slots(0))/float(nt-1)
45 time_slots(1) = time_slots(0)+dt*0.5
47 time_slots(it) = time_slots(it-1)+dt
51 ! find the first guess index of analysis time
52 ! usually it is at the beginning of the time window for 4dvar
53 ! and at the center time window for 3dvar
54 ! tmin i.e. time_slots(0) corresponds to fg index 1
55 ! tmax i.e. time_slots(nt) corresponds to fg index nt
56 ! (time_slots(i)-time_slots(i-1))/2 corresponds to fg index i
57 if ( nt == 1 .or. abs(time_ana-time_slots(0)) < 0.1 ) then
59 else if ( abs(time_ana-time_slots(nt)) < 0.1 ) then
63 time_tmp = time_slots(0) + (it-1) * dt
64 if ( abs(time_ana-time_tmp) < 0.1 ) then
71 if (print_detail_obs) then
72 write(unit=stdout,fmt='(3x,a,240f10.0)') 'Time_slots ', time_slots(0:nt)
73 write (unit=stdout,fmt='(A)') " "
76 if (trace_use) call da_trace_exit("da_get_time_slots")
78 end subroutine da_get_time_slots