@@ -32,6 +32,8 @@ module fm_statistical_output
3232 real (dp), dimension (:), allocatable , target :: SBCX, SBCY, SBWX, SBWY, SSWX, SSWY, SSCX, SSCY
3333 real (dp), dimension (:), allocatable , target :: qplat_data
3434
35+ logical , public :: apply_statistics_on_output
36+
3537contains
3638
3739 subroutine close_fm_statistical_output ()
@@ -2469,7 +2471,7 @@ subroutine flow_init_statistical_output_his(output_config_set, output_set)
24692471 call add_stat_output_items(output_set, output_config_set% configs(IDX_HIS_DISCHARGE_MAGNITUDE), valobs(:, IPNT_QMAG))
24702472 end if
24712473 end if
2472-
2474+
24732475 ! Turbulence model
24742476 if (jahistur > 0 ) then
24752477 if (model_is_3D()) then
@@ -2953,6 +2955,7 @@ subroutine flow_init_statistical_output_his(output_config_set, output_set)
29532955 call process_output_quantity_configs(output_set)
29542956 call realloc(output_set, .true. ) ! set size to count
29552957 call initialize_statistical_output(output_set% statout)
2958+ apply_statistics_on_output = any (station_statistics_requested(output_set% statout))
29562959
29572960 end subroutine flow_init_statistical_output_his
29582961
@@ -2971,6 +2974,21 @@ subroutine process_output_quantity_configs(output_set)
29712974
29722975 end subroutine process_output_quantity_configs
29732976
2977+ ! > return whether the output variable item is a station where the requested operation type is a statistical one
2978+ elemental function station_statistics_requested (item ) result(res)
2979+ use m_statistical_output_types, only: SO_CURRENT, SO_NONE, SO_UNKNOWN
2980+
2981+ type (t_output_variable_item), intent (in ) :: item ! < output variable item to check
2982+ logical :: res ! < Return value
2983+
2984+ if (allocated (item% output_config)) then
2985+ res = (.not. any (item% operation_type == [SO_CURRENT, SO_NONE, SO_UNKNOWN])) .and. item% output_config% location_specifier == UNC_LOC_STATION
2986+ else
2987+ res = .false.
2988+ end if
2989+
2990+ end function station_statistics_requested
2991+
29742992 ! > Deactivate invalid dimension IDs depending on model parameters
29752993 subroutine process_nc_dim_ids (nc_dim_ids )
29762994 use m_sediment, only: stm_included
0 commit comments