1 subroutine da_allocate_y_lightning (iv, y)
3 !---------------------------------------------------------------------------
4 ! Purpose: Allocate arrays used in y and residual obs structures.
5 ! Authors: Z Chen (zchen@fjnu.edu.cn), Jenny Sun (NCAR), X Qie (IAP)
6 !---------------------------------------------------------------------------
10 type (iv_type), intent(in) :: iv ! Ob type input.
11 type (y_type), intent(inout) :: y ! Residual type structure.
13 integer :: n ! Loop counter.
14 integer :: nlevels ! Number of levels.
16 !---------------------------------------------------------------------------
17 ! [1.0] Copy number of observations:
18 !---------------------------------------------------------------------------
20 if (trace_use) call da_trace_entry("da_allocate_y_lightning")
22 y % nlocal(lightning) = iv%info(lightning)%nlocal
23 y % ntotal(lightning) = iv%info(lightning)%ntotal
25 !---------------------------------------------------------------------------
27 !---------------------------------------------------------------------------
29 if (y % nlocal(lightning) > 0) then
30 allocate (y % lightning(1:y % nlocal(lightning)))
31 do n = 1, y % nlocal(lightning)
32 nlevels = iv%info(lightning)%levels(n)
33 allocate (y % lightning(n) % w(1:nlevels))
34 allocate (y % lightning(n) % div(1:nlevels))
35 allocate (y % lightning(n) % qv(1:nlevels))
36 y % lightning(n) % w(1:nlevels) = 0.0
37 y % lightning(n) % div(1:nlevels) = 0.0
38 y % lightning(n) % qv(1:nlevels) = 0.0
42 if (trace_use) call da_trace_exit("da_allocate_y_lightning")
44 end subroutine da_allocate_y_lightning