-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
Time of day subsetting by hour only giving unexpected result #326
Comments
Thanks for the report! You are the first to identify and report this bug. Some background: this functionality used to be handled by I just pushed a change to replace the It would be great if you could try to fix this, and even better if you add unit tests to cover this case. As you suggested in an email, it would make sense to add some intraday data to the package to use for examples and tests. Similar to how we use I imagine there are going to be several edge cases we need to cover. So please don't hesitate to discuss them here before spending time coding a solution. |
A couple of edge cases related to a "standard" time of day subset, e.g.
might be:
Does the subsetting want to support this, or enforce users to do "T02:00/T03:00"?
In the case of just supplying the hours, would you now expect |
e.g. subsetting with "T01/T03" does not currently give expected results. This requires fixing .subsetTimeOfDay() Unit tests also updated for time of day subsetting. Fixes joshuaulrich#326
Remove support for non-zero-padded minutes and seconds. The ISO 8601 standard requires all time components be zero-padded. That said, we do support hours that aren't zero-padded, for convenience. Also make the validation regex stricter. The first digit for minutes and seconds cannot be > 5. Separate regex into multiple pieces, to make them easier to understand later. See joshuaulrich#326. See joshuaulrich#327.
The initial change for this fix only supports the extended format. (hh:mm:ss.sss). We supported the basic format (hhmmss.sss) previously. This restores the original functionality, making the colon optional. I noticed how lastof() was being used to get the last timestamp for the time string, and thought it would be good to find the first timestamp in a similar manner. The getTimeComponents() function extracts the hours, minutes, seconds, and sub-seconds into a list that we can use with firstof() and lastof(). Note that firstof() returns the first timestamp in 1970, and lastof() returns a timestamp at the end of 1970. The difference in years, months, and days does not matter because we're only concerned with the time of day components. See joshuaulrich#326. See joshuaulrich#327.
e.g. subsetting with "T01/T03" does not currently give expected results. This requires fixing .subsetTimeOfDay() Unit tests also updated for time of day subsetting. Fixes joshuaulrich#326
Remove support for non-zero-padded minutes and seconds. The ISO 8601 standard requires all time components be zero-padded. That said, we do support hours that aren't zero-padded, for convenience. Also make the validation regex stricter. The first digit for minutes and seconds cannot be > 5. Separate regex into multiple pieces, to make them easier to understand later. See joshuaulrich#326. See joshuaulrich#327.
The initial change for this fix only supports the extended format. (hh:mm:ss.sss). We supported the basic format (hhmmss.sss) previously. This restores the original functionality, making the colon optional. I noticed how lastof() was being used to get the last timestamp for the time string, and thought it would be good to find the first timestamp in a similar manner. The getTimeComponents() function extracts the hours, minutes, seconds, and sub-seconds into a list that we can use with firstof() and lastof(). Note that firstof() returns the first timestamp in 1970, and lastof() returns a timestamp at the end of 1970. The difference in years, months, and days does not matter because we're only concerned with the time of day components. See joshuaulrich#326. See joshuaulrich#327.
e.g. subsetting with "T01/T03" does not currently give expected results. This requires fixing .subsetTimeOfDay() Unit tests also updated for time of day subsetting. Fixes #326
Remove support for non-zero-padded minutes and seconds. The ISO 8601 standard requires all time components be zero-padded. That said, we do support hours that aren't zero-padded, for convenience. Also make the validation regex stricter. The first digit for minutes and seconds cannot be > 5. Separate regex into multiple pieces, to make them easier to understand later. See #326. See #327.
The initial change for this fix only supports the extended format. (hh:mm:ss.sss). We supported the basic format (hhmmss.sss) previously. This restores the original functionality, making the colon optional. I noticed how lastof() was being used to get the last timestamp for the time string, and thought it would be good to find the first timestamp in a similar manner. The getTimeComponents() function extracts the hours, minutes, seconds, and sub-seconds into a list that we can use with firstof() and lastof(). Note that firstof() returns the first timestamp in 1970, and lastof() returns a timestamp at the end of 1970. The difference in years, months, and days does not matter because we're only concerned with the time of day components. See #326. See #327.
The recent time of day subsetting changes have generated some unexpected results.
Subsetting by just hour used to work, but now gives incorrect results, and also seems to still depend on
indexTZ
:But we do at least get expected results if including the minutes (but still have the
indexTZ
issue)Happy to work on a PR to fix this issue if it hasn't been identified yet?
The text was updated successfully, but these errors were encountered: