Describe the bug
The weight
optional argument is passed into accept_data
from send_data
and it is copied into the field_weight
(field_weight will be 1 if weight was not passed in)
|
field_weight = set_weight(weight) |
The field_weight is then passed into fms_diag_do_reduction
|
error_string = this%fms_diag_do_reduction(field_data, diag_field_id, oor_mask, field_weight, & |
|
bounds, using_blocking, Time=Time) |
and it is then not used at all
To Reproduce
Add an a time varying weight to a send_data
call and you will see that answers are not correct
This is what was causing small answer changes between the old and new diag manager in fields where the "weight" was passed in and it was constant.
The old diag was doing
(x(t1)*weight + x(t2)*weight) / 2*(weight)
The new diag was doing
overtime the differences accumulated!
Expected behavior
The weight should be passed in to the do_time_sum_wrapper
subroutines.
|
case (time_sum) |
|
error_msg = buffer_ptr%do_time_sum_wrapper(field_data, oor_mask, field_ptr%get_var_is_masked(), & |
|
field_ptr%get_mask_variant(), bounds_in, bounds_out, missing_value, field_ptr%has_missing_value()) |
|
if (trim(error_msg) .ne. "") then |
|
return |
|
endif |
|
case (time_average) |
|
error_msg = buffer_ptr%do_time_sum_wrapper(field_data, oor_mask, field_ptr%get_var_is_masked(), & |
|
field_ptr%get_mask_variant(), bounds_in, bounds_out, missing_value, field_ptr%has_missing_value()) |
|
if (trim(error_msg) .ne. "") then |
|
return |
|
endif |
|
case (time_power) |
|
error_msg = buffer_ptr%do_time_sum_wrapper(field_data, oor_mask, field_ptr%get_var_is_masked(), & |
|
field_ptr%get_mask_variant(), bounds_in, bounds_out, missing_value, field_ptr%has_missing_value(), & |
|
pow_value=field_yaml_ptr%get_pow_value()) |
|
if (trim(error_msg) .ne. "") then |
|
return |
|
endif |
|
case (time_rms) |
|
error_msg = buffer_ptr%do_time_sum_wrapper(field_data, oor_mask, field_ptr%get_var_is_masked(), & |
|
field_ptr%get_mask_variant(), bounds_in, bounds_out, missing_value, field_ptr%has_missing_value(), & |
|
pow_value = 2) |
|
if (trim(error_msg) .ne. "") then |
|
return |
|
endif |
|
case (time_diurnal) |
|
if(.not. present(time)) call mpp_error(FATAL, & |
|
"fms_diag_do_reduction:: time must be present when using diurnal reductions") |
|
! sets the diurnal index for reduction within the buffer object |
|
call buffer_ptr%set_diurnal_section_index(time) |
|
error_msg = buffer_ptr%do_time_sum_wrapper(field_data, oor_mask, field_ptr%get_var_is_masked(), & |
|
field_ptr%get_mask_variant(), bounds_in, bounds_out, missing_value, field_ptr%has_missing_value()) |
|
if (trim(error_msg) .ne. "") then |
|
return |
|
endif |
System Environment
This happens in any system
Additional context
N/A