Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDA daily binning misaligned due to mislabeled data in 8hour mean calculation #1323

Closed
thorbjoernl opened this issue Aug 22, 2024 · 0 comments · Fixed by #1322
Closed

MDA daily binning misaligned due to mislabeled data in 8hour mean calculation #1323

thorbjoernl opened this issue Aug 22, 2024 · 0 comments · Fixed by #1322
Labels
bug 🐛 Something isn't working

Comments

@thorbjoernl
Copy link
Collaborator

thorbjoernl commented Aug 22, 2024

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:

  1. 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]
        ),
  1. 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

@thorbjoernl thorbjoernl added the bug 🐛 Something isn't working label Aug 22, 2024
@thorbjoernl thorbjoernl mentioned this issue Aug 23, 2024
9 tasks
@thorbjoernl thorbjoernl changed the title Bug in MDA8 calculation MDA daily binning misaligned due to mislabeled data in 8hour mean calculation Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant