Calculate step length properly#141
Conversation
Updated step_length account for dt >= 24h
|
@joeloskarsson fixed a minor issue with step length calculation >= 24h. Reviewer and assignee needed here |
joeloskarsson
left a comment
There was a problem hiding this comment.
This change looks good to me, but there are issues with the tests that are unrelated to this PR. We will have to fix those first, before we can merge this. I'll just approve this for now, and we can merge it once that is fixed.
I think the linting failing is just because we are using an old version of https://github.com/pre-commit/action, that stopped working when gh cache servers were updated. The pip test requires a bit more digging, but sadly I don't have capacity for solving it right now, so it will have to wait a bit.
|
#140 potentially fixes the testing issues unrelated to this PR |
|
Oh that is great with the tests 😄 I clearly have not kept up with things here for a bit. I could see a value in not restricting the step length to hours. How do you envision that being implemented @observingClouds ? As separate functions for seconds/minutes/hours, or as some argument you give to step_length? As it just returns an int we could not just return different things depending on the temporal resolution of the data, as that would become ambiguous. I guess the better solution would be to return a timedelta. However reworking the function and its downstream usage is maybe a bit much for just a bugfix. |
|
Yeah, I envision the latter, where we return a timedelta object or the steps in seconds (instead of hours). If this was meant to just be a bugfix my suggestion should not stop this. |
|
Hi @observingClouds generalizing |
|
@deinal the CICD should be fixed now. I am updating your branch to see if the tests will also succeed for your new contribution :) |
|
Seems that the test actually caught something, so that is useful 😃 (I did not even know we had a test for step length). Function says it should return int, so maybe reasonable to just cast the return value to int. |
Describe your changes
Updated step_length to account for dt >= 24h by calculating total seconds between steps.
Before the change a 24h step would yield a length of 0, for example.
Type of change
Checklist before requesting a review
pullwith--rebaseoption if possible).Checklist for reviewers
Each PR comes with its own improvements and flaws. The reviewer should check the following:
Author checklist after completed review
reflecting type of change (add section where missing):
Checklist for assignee