1 subroutine da_chgvres(nlath,nsig,kz,sigmah,sigma_avn,&
2 corz_avn,cord_avn,corh_avn,corq_avn,hwll_avn,vztdq_avn,agv_avn,bv_avn,wgv_avn,&
3 corz_kz, cord_kz, corh_kz, corq_kz, hwll_kz, vztdq_kz, agv_kz, bv_kz, wgv_kz)
5 !---------------------------------------------------------------------------
6 ! Purpose: Change vertical resolution of background stats for cv_options=3
7 !---------------------------------------------------------------------------
11 integer, intent(in) :: nlath,nsig,kz
12 real, intent(in) :: sigmah(kz),sigma_avn(1:nsig)
14 real, intent(out) :: corz_kz(1:2*nlath+1,1:kz),cord_kz(1:2*nlath+1,1:kz)
15 real, intent(out) :: corh_kz(1:2*nlath+1,1:kz),corq_kz(1:2*nlath+1,1:kz)
16 real, intent(out) :: hwll_kz(0:nlath*2+1,1:kz,1:4)
17 real, intent(out) :: vztdq_kz(1:kz,0:nlath*2+1,1:4)
18 real, intent(out) :: agv_kz(0:nlath*2+1,1:kz,1:kz)
19 real, intent(out) :: bv_kz(0:nlath*2+1,1:kz),wgv_kz(0:nlath*2+1,1:kz)
21 real, intent(in) :: corz_avn(1:2*nlath+1,1:nsig),cord_avn(1:2*nlath+1,1:nsig)
22 real, intent(in) :: corh_avn(1:2*nlath+1,1:nsig),corq_avn(1:2*nlath+1,1:nsig)
23 real, intent(in) :: hwll_avn(0:nlath*2+1,1:nsig,1:4)
24 real, intent(in) :: vztdq_avn(1:nsig,0:nlath*2+1,1:4)
25 real, intent(in) :: agv_avn(0:nlath*2+1,1:nsig,1:nsig)
26 real, intent(in) :: bv_avn(0:nlath*2+1,1:nsig),wgv_avn(0:nlath*2+1,1:nsig)
28 integer :: i,j,k,m,l,l1,m1,n
29 real :: rsigo(nsig),rsig(kz)
30 real :: coef1(kz),coef2(kz)
33 if (trace_use) call da_trace_entry("da_chgvres")
45 if (trace_use) call da_trace_exit("da_chgvres")
50 rsig(k)=log(sigmah(k))
53 rsigo(k)=log(sigma_avn(k))
57 if (rsig(k).ge.rsigo(1)) then
63 else if (rsig(k).lt.rsigo(nsig)) then
72 if ((rsig(k).le.rsigo(m)) .and. &
73 (rsig(k).gt.rsigo(m1)) )then
79 coef1(k)=(rsigo(m1)-rsig(k))/(rsigo(m1)-rsigo(m))
81 if (lsig(k)==nsig) then
94 wgv_kz(i,k)=wgv_avn(i,m)*coef1(k)+wgv_avn(i,m1)*coef2(k)
95 bv_kz(i,k)=bv_avn(i,m)*coef1(k)+bv_avn(i,m1)*coef2(k)
102 agv_kz(i,j,k)=(agv_avn(i,l,m)*coef1(j)+agv_avn(i,l1,m)*coef2(j))*coef1(k) &
103 +(agv_avn(i,l,m1)*coef1(j)+agv_avn(i,l1,m1)*coef2(j))*coef2(k)
108 agv_kz(0,:,:)=agv_kz(1,:,:)
109 wgv_kz(0,:)=wgv_kz(1,:)
110 bv_kz(0,:)=bv_kz(1,:)
111 agv_kz(nlath*2+1,:,:)=agv_kz(nlath*2,:,:)
112 wgv_kz(nlath*2+1,:)=wgv_kz(nlath*2,:)
113 bv_kz(nlath*2+1,:)=bv_kz(nlath*2,:)
119 ! corz,cord,corh,corq
121 corz_kz(i,k)=corz_avn(i,m)*coef1(k)+corz_avn(i,m1)*coef2(k)
122 cord_kz(i,k)=cord_avn(i,m)*coef1(k)+cord_avn(i,m1)*coef2(k)
123 corh_kz(i,k)=corh_avn(i,m)*coef1(k)+corh_avn(i,m1)*coef2(k)
124 corq_kz(i,k)=corq_avn(i,m)*coef1(k)+corq_avn(i,m1)*coef2(k)
130 hwll_kz(i,k,n)=hwll_avn(i,m,n)*coef1(k)+hwll_avn(i,m1,n)*coef2(k)
132 vztdq_kz(k,i,n)=vztdq_avn(m,i,n)*coef1(k)+vztdq_avn(m1,i,n)*coef2(k)
137 if (trace_use) call da_trace_exit("da_chgvres")
139 end subroutine da_chgvres