Closed uramirez8707 closed 2 months ago
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) https://github.com/NOAA-GFDL/FMS/blob/d42f8aca45bfefaaa45295888a36548b9a9b5a29/diag_manager/fms_diag_object.F90#L575
weight
accept_data
send_data
field_weight
The field_weight is then passed into fms_diag_do_reduction https://github.com/NOAA-GFDL/FMS/blob/d42f8aca45bfefaaa45295888a36548b9a9b5a29/diag_manager/fms_diag_object.F90#L696-L697 and it is then not used at all
fms_diag_do_reduction
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
(x(t1)+x(t2))/2
overtime the differences accumulated!
Expected behavior The weight should be passed in to the do_time_sum_wrapper subroutines. https://github.com/NOAA-GFDL/FMS/blob/d42f8aca45bfefaaa45295888a36548b9a9b5a29/diag_manager/fms_diag_object.F90#L1051-L1086
do_time_sum_wrapper
System Environment This happens in any system
Additional context N/A
Describe the bug The
weight
optional argument is passed intoaccept_data
fromsend_data
and it is copied into thefield_weight
(field_weight will be 1 if weight was not passed in) https://github.com/NOAA-GFDL/FMS/blob/d42f8aca45bfefaaa45295888a36548b9a9b5a29/diag_manager/fms_diag_object.F90#L575The field_weight is then passed into
fms_diag_do_reduction
https://github.com/NOAA-GFDL/FMS/blob/d42f8aca45bfefaaa45295888a36548b9a9b5a29/diag_manager/fms_diag_object.F90#L696-L697 and it is then not used at allTo Reproduce Add an a time varying weight to a
send_data
call and you will see that answers are not correctThis 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
The new diag was doing
overtime the differences accumulated!
Expected behavior The weight should be passed in to the
do_time_sum_wrapper
subroutines. https://github.com/NOAA-GFDL/FMS/blob/d42f8aca45bfefaaa45295888a36548b9a9b5a29/diag_manager/fms_diag_object.F90#L1051-L1086System Environment This happens in any system
Additional context N/A