1 subroutine da_rescale_background_errors (var_scaling, len_scaling, &
4 !---------------------------------------------------------------------------
5 ! Purpose: Rescale wrfvar background errors.
7 ! Method: Empirical scaling and inclusion of recursive filter rescaling.
8 !---------------------------------------------------------------------------
12 real, intent(in) :: var_scaling ! Variance factor.
13 real, intent(in) :: len_scaling ! Lengthscale factor.
14 real, intent(in) :: ds ! Resolution (m)
15 real*8, intent(inout) :: s(:) ! RF lengthscale.
16 type (be_subtype), intent(inout) :: be_sub ! Backgrd error struct.
18 integer :: mz ! Vertical truncation.
20 real*8, allocatable :: rf_scale_factor(:)! RF rescaling.
22 if (trace_use_dull) call da_trace_entry("da_rescale_background_errors")
24 write(unit=stdout,fmt='(3x,"Scaling: var, len, ds: ",a10,a,3e15.6 )') &
25 trim(be_sub % name), ' ', var_scaling, len_scaling, ds
27 !--------------------------------------------------------------------------
29 !--------------------------------------------------------------------------
33 !--------------------------------------------------------------------------
34 ! [2.0] Perform various rescalings:
35 !--------------------------------------------------------------------------
39 ! [2.1] Empirical rescaling of lengthscales:
40 s(1:mz) = len_scaling * s(1:mz)
42 if (print_detail_be) then
43 write(unit=stdout,fmt='(a,a)')trim(be_sub % name), ' Error Lengthscales (m):'
45 write(unit=stdout,fmt='(a,i4,1pe13.5)')be_sub % name, m, s(m)
49 ! [2.2] Make lengthscale nondimensional:
50 s(1:mz) = s(1:mz) / ds
52 ! [2.3] Empirical rescaling of variances:
53 be_sub % val(:,:) = var_scaling * be_sub % val(:,:)
55 ! Calculate recursive filter rescaling:
57 allocate(rf_scale_factor(1:mz))
59 call da_calculate_rf_factors(s(:), be_sub % rf_alpha(:), &
63 be_sub % val(:,m) = rf_scale_factor(m) * be_sub % val(:,m)
66 deallocate (rf_scale_factor)
70 if (trace_use_dull) call da_trace_exit("da_rescale_background_errors")
72 end subroutine da_rescale_background_errors