Merge remote-tracking branch 'origin/release-v4.5.2'
[WRF.git] / var / da / da_define_structures / da_allocate_obs_info.inc
blob3f953ba12b28da233cc40af806c170c4e469f54a
1 subroutine da_allocate_obs_info (iv, ob_index)
3    !---------------------------------------------------------------------------
4    ! Purpose: Allocate info components of observation structure.
5    !---------------------------------------------------------------------------
7    implicit none
9    type (iv_type), intent(inout) :: iv       ! Observation structure.
10    integer, intent(in), optional :: ob_index ! ob type index as defined in da_control.f90
12    integer :: i
13    integer :: istart, iend
15    if (trace_use) call da_trace_entry("da_allocate_obs_info")
17    ! default loop through all types
18    istart = 1
19    iend   = num_ob_indexes
21    if ( present(ob_index) ) then
22       ! allocate for specific ob type
23       istart = ob_index
24       iend   = ob_index
25    end if
27    do i = istart, iend
29       if (iv%info(i)%nlocal > 0) then
30          allocate (iv%info(i)%name(iv%info(i)%nlocal))
31          allocate (iv%info(i)%platform(iv%info(i)%nlocal))
32          allocate (iv%info(i)%id(iv%info(i)%nlocal))
33          allocate (iv%info(i)%date_char(iv%info(i)%nlocal))
34          allocate (iv%info(i)%levels(iv%info(i)%nlocal))
35          allocate (iv%info(i)%lat(iv%info(i)%max_lev,iv%info(i)%nlocal))
36          allocate (iv%info(i)%lon(iv%info(i)%max_lev,iv%info(i)%nlocal))
37          allocate (iv%info(i)%elv(iv%info(i)%nlocal))
38          allocate (iv%info(i)%pstar(iv%info(i)%nlocal))
40          allocate (iv%info(i)%slp(iv%info(i)%nlocal))
41          allocate (iv%info(i)%pw(iv%info(i)%nlocal))
43          allocate (iv%info(i)%x  (kms:kme,iv%info(i)%nlocal))
44          allocate (iv%info(i)%y  (kms:kme,iv%info(i)%nlocal))
45          allocate (iv%info(i)%i  (kms:kme,iv%info(i)%nlocal))
46          allocate (iv%info(i)%j  (kms:kme,iv%info(i)%nlocal))
47          allocate (iv%info(i)%dx (kms:kme,iv%info(i)%nlocal))
48          allocate (iv%info(i)%dxm(kms:kme,iv%info(i)%nlocal))
49          allocate (iv%info(i)%dy (kms:kme,iv%info(i)%nlocal))
50          allocate (iv%info(i)%dym(kms:kme,iv%info(i)%nlocal))
51          allocate (iv%info(i)%k  (iv%info(i)%max_lev,iv%info(i)%nlocal))
52          allocate (iv%info(i)%dz (iv%info(i)%max_lev,iv%info(i)%nlocal))
53          allocate (iv%info(i)%dzm(iv%info(i)%max_lev,iv%info(i)%nlocal))
54          allocate (iv%info(i)%zk (iv%info(i)%max_lev,iv%info(i)%nlocal))
55          allocate (iv%info(i)%proc_domain(iv%info(i)%max_lev,iv%info(i)%nlocal))
56          allocate (iv%info(i)%thinned(iv%info(i)%max_lev,iv%info(i)%nlocal))
57          allocate (iv%info(i)%obs_global_index(iv%info(i)%nlocal))
59          iv%info(i)%proc_domain(:,:)  = .false.
60          iv%info(i)%thinned(:,:)      = .false.
61          iv%info(i)%zk(:,:)           = missing_r
62       end if
63    end do
65    if (trace_use) call da_trace_exit("da_allocate_obs_info")
67 end subroutine da_allocate_obs_info