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 guess_period on datetimes, make it more precise + generic #484

Merged
merged 4 commits into from
Jul 19, 2024

Conversation

brookslogan
Copy link
Contributor

Checklist

Please:

  • Make sure this PR is against "dev", not "main" (unless this is a release
    PR).
  • Request a review from one of the current main reviewers:
    brookslogan, nmdefries.
  • Makes sure to bump the version number in DESCRIPTION. Always increment
    the patch version number (the third number), unless you are making a
    release PR from dev to main, in which case increment the minor version
    number (the second number).
  • Describe changes made in NEWS.md, making sure breaking changes
    (backwards-incompatible changes to the documented interface) are noted.
    Collect the changes under the next release number (e.g. if you are on
    1.7.2, then write your changes under the 1.8 heading).
  • See DEVELOPMENT.md for more information on the development
    process.

Change explanations for reviewer

This is to fix guess_period() on regularly-spaced datetimes, fixing epix_slide_ref_time_values_default() on regularly-spaced datetime versions... though the latter are going to be super rare actually. We might want to make some other changes, but it's probably worth throwing in this bugfix anyway in case thinking about alternative default time values takes a while.

Magic GitHub syntax to mark associated Issue(s) as resolved when this is merged into the default branch

- Don't discard units and effectively replace them with seconds
- Don't allow any tolerance in judging a remainder to be zero, since when we use
  it to generate the default `ref_time_values` that means we could miss
  reproducing some of the actual input time values.
- Make it into an S3 generic so it can be extended for more time classes.
@brookslogan brookslogan marked this pull request as ready for review July 18, 2024 06:45
tests/testthat/test-utils.R Outdated Show resolved Hide resolved
@brookslogan brookslogan merged commit a2c5154 into dev Jul 19, 2024
5 checks passed
@brookslogan brookslogan deleted the lcb/fix-guess-period-datetimes branch July 19, 2024 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

epix_slide_ref_time_values_default misbehaves on datetimes
2 participants