-
Notifications
You must be signed in to change notification settings - Fork 32
Description
If I'm reading the code of cdfmoy_freq correctly, there is a bug in how it associates the input periods to target averaging periods if the boundaries of the input periods do not exactly match those of the desired outputs.
For the case of 5d inputs and 1mo outputs, it will do the following (considering noleap here):
-
Based on the month lenghts in
njmand based on the number of hours in the input binsLine 212 in 22e3eb0
njm(:)= (/ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 /) nhfrithe number of full bins within each monthLine 198 in 22e3eb0
nhfri = 24*ndyr/npt ! input frequency in hours iboxis calculated:Line 244 in 22e3eb0
ibox(:) = njm(:)*24/nhfri -
The resulting list of full bins per month is (I read this as a floor division, but this may be where I'm wrong)
(/ 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 /)(eleven sixes and one five for February). -
Then, the resulting
iboxis used to construct the iteration that groups input time bins without taking into account the truncation that happened in constructingiboxLine 317 in 22e3eb0
it2=it1+ibox(jframe)-1
So this will lead to the first 6 bins (Jan-01 to Jan-30) to be counted for the January mean, the following 5 bins (Jan-31 to Feb-24) to go into the February mean, the following 6 bins (Feb-25 to Mar-26) to go into March, ..., and the 65th to 71st bins (Nov-21 to Dec-21) to be counted for December.