MDA daily binning misaligned due to mislabeled data in 8hour mean calculation
thorbjoernl opened this issue · 0 comments
thorbjoernl commented
Describe the bug
Please provide a clear and concise description of what the bug is.
- Pyaerocom version: 0.22.dev0
- Computing platform: NA
- Configuration file (if applicable): NA
- Error message (if applicable): NA
To Reproduce
Steps to reproduce the behavior:
- Add the following parametrization to
test_mda8.py:test_calc_mda8
pytest.param(
xr.date_range(start="2024-01-01 06:00:00", periods=30, freq="1h"),
np.arange(30),
[np.nan, 25.5]
),
- The test fails because the last 8 hour mean included in the first day is for the period 0000-0800 the next day, instead of 1600-2400. Therefore not enough data is included in day two and it results in nan.
Expected behavior
MDA8 for 2024-01-02 should be a non-nan numeric value (25.5).
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Caused by wrong alignment. xarray's DataArray.rolling labels data to the left, but labeling it to the right is expected by the current implementation. DataArray.rolling does not support a label-argument so another fix needs to be found.
Related: #1322