When trying to plot time series of volume averages of 3D FESOM data with multiple regions defined in the template_var_t, I noticed that for the first box region results seem plausible, but for second they seem 3 orders of magnitude too small, for third 6 OOM too small, and for fourth 9 OOM too small. This attempts to fix this:
I think there are 2 problems:
Old code overwrote data variable. → Only calculation of first box would be correct and subsequent calculations would compute mean/int of already weighted data, because every region iterated over uses the same data variable. Fix this by defining new variable
idx_IN was not used for volume average/integral operations → Always global mean would be computed. Fix by doing selection before calculation of weights like in the other cases
When trying to plot time series of volume averages of 3D FESOM data with multiple regions defined in the
template_var_t
, I noticed that for the first box region results seem plausible, but for second they seem 3 orders of magnitude too small, for third 6 OOM too small, and for fourth 9 OOM too small. This attempts to fix this:I think there are 2 problems:
Old code overwrote
data
variable. → Only calculation of first box would be correct and subsequent calculations would compute mean/int of already weighted data, because every region iterated over uses the samedata
variable. Fix this by defining new variableidx_IN
was not used for volume average/integral operations → Always global mean would be computed. Fix by doing selection before calculation of weights like in the other cases