diff --git a/var/da/da_varbc_tamdar/da_varbc_tamdar_tl.inc b/var/da/da_varbc_tamdar/da_varbc_tamdar_tl.inc index ba39a75b48..9e843e860c 100755 --- a/var/da/da_varbc_tamdar/da_varbc_tamdar_tl.inc +++ b/var/da/da_varbc_tamdar/da_varbc_tamdar_tl.inc @@ -14,6 +14,7 @@ type (y_type), intent(inout) :: y ! y = h (xa) integer :: isn,ivar,iflt,ipred,iobs,iphase + integer :: npred real :: delta_bc real, allocatable :: varbc_param_tl(:) @@ -21,7 +22,8 @@ if (trace_use) call da_trace_entry("da_varbc_tamdar_tl") - allocate( varbc_param_tl(iv%varbc_tamdar%npred) ) + npred = iv%varbc_tamdar%npred + allocate( varbc_param_tl(npred) ) do iflt = 1, iv%varbc_tamdar%nair do iphase = 1, iv%varbc_tamdar%nphase @@ -30,14 +32,14 @@ varbc_param_tl(:) = 0.0 - do ipred = 1, iv%varbc_tamdar%npred + do ipred = 1, npred varbc_param_tl(ipred) = & - SUM( cv(iv%varbc_tamdar%index(ipred,iphase,iflt)) * & - iv%varbc_tamdar%vtox(ipred,1:iv%varbc_tamdar%npred,iphase,iflt) ) + SUM( cv(iv%varbc_tamdar%index(1:npred,iphase,iflt)) * & + iv%varbc_tamdar%vtox(ipred,1:npred,iphase,iflt) ) end do - delta_bc = SUM( varbc_param_tl(1:iv%varbc_tamdar%npred)* & - iv%varbc_tamdar%pred(1:iv%varbc_tamdar%npred,iphase,iflt) ) + delta_bc = SUM( varbc_param_tl(1:npred)* & + iv%varbc_tamdar%pred(1:npred,iphase,iflt) ) do iobs = 1, iv%varbc_tamdar%nobs(iphase,iflt) isn = iv%varbc_tamdar%obs_sn(iobs,iphase,iflt) diff --git a/var/da/da_varbc_tamdar/da_varbc_tamdar_update.inc b/var/da/da_varbc_tamdar/da_varbc_tamdar_update.inc index 2dadb36dc7..0b078f467c 100755 --- a/var/da/da_varbc_tamdar/da_varbc_tamdar_update.inc +++ b/var/da/da_varbc_tamdar/da_varbc_tamdar_update.inc @@ -48,7 +48,7 @@ if (iv%varbc_tamdar%nobs(iphase,iflt) > 0 .and. iv%varbc_tamdar%ifuse(iphase,iflt) > 0) then do ipred = 1, npred varbc_param_tl(ipred,iphase,iflt) = & - SUM( cv(iv%varbc_tamdar%index(ipred,iphase,iflt)) * & + SUM( cv(iv%varbc_tamdar%index(1:npred,iphase,iflt)) * & iv%varbc_tamdar%vtox(ipred,1:npred,iphase,iflt) ) end do end if