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

Fix time overlap handling in concatenation #2247

Merged
merged 8 commits into from
Oct 30, 2023
Merged

Conversation

zklaus
Copy link

@zklaus zklaus commented Oct 30, 2023

Description

Closes #2248

Link to documentation:


Before you get started

Checklist

It is the responsibility of the author to make sure the pull request is ready to review. The icons indicate whether the item will be subject to the 🛠 Technical or 🧪 Scientific review.


To help with the number pull requests:

@codecov
Copy link

codecov bot commented Oct 30, 2023

Codecov Report

Merging #2247 (962a367) into main (f39d14a) will decrease coverage by 0.01%.
The diff coverage is 97.87%.

@@            Coverage Diff             @@
##             main    #2247      +/-   ##
==========================================
- Coverage   93.47%   93.47%   -0.01%     
==========================================
  Files         238      238              
  Lines       12917    12932      +15     
==========================================
+ Hits        12074    12088      +14     
- Misses        843      844       +1     
Files Coverage Δ
esmvalcore/preprocessor/_io.py 90.69% <97.87%> (+0.16%) ⬆️

@zklaus zklaus changed the title Fix check time overlaps Fix time overlap handling in concatenation Oct 30, 2023
@zklaus zklaus added bug Something isn't working preprocessor Related to the preprocessor labels Oct 30, 2023
@zklaus zklaus marked this pull request as ready for review October 30, 2023 11:54
@zklaus
Copy link
Author

zklaus commented Oct 30, 2023

The coverage fails only due to one line, the special case when the passed cube list is shorter than two (i.e. has zero or one entries), in which case the function returns the input cube list unmodified. This is not covered by tests because the test works at the level of the concatenate function, which performs this check before, thus even though concatenate is tested with an empty cube list, this does not reach _check_time_overlaps.

There are two possible solutions: Add a test for _check_time_overlaps itself or remove the check inside the function, taking it as a guarantee by the caller. A third approach is to ignore the code coverage deterioration.

What do the reviewers think?

Copy link
Member

@bouweandela bouweandela left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@valeriupredoi
Copy link
Contributor

well you can mock the concatenate func with that single cube, but nay bother, if Bouwe is OK with that am too 👍

@valeriupredoi
Copy link
Contributor

plus 97.87% is pretty much 100% in my books 😁

@valeriupredoi valeriupredoi added this to the v2.10.0 milestone Oct 30, 2023
Copy link
Contributor

@valeriupredoi valeriupredoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice refactoring @zklaus - many thanks! I added M2.10 to it since I reckon it's good to have it in the bugfix bit of the release - feel free to remove it if you think we should wait 🍺

@valeriupredoi valeriupredoi merged commit 56cc385 into main Oct 30, 2023
@valeriupredoi valeriupredoi deleted the fix-check-time-overlaps branch October 30, 2023 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working preprocessor Related to the preprocessor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Concatenate implementation is broken
3 participants