-
Notifications
You must be signed in to change notification settings - Fork 85
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
H:M:S for Date_To in the Temporal function defaults to 0:0:0 #190
Comments
The current behavior in earthaccess (using a module that is one step "under-the-hood" compared to query = earthaccess.search.DataGranules().temporal("2000-01-01", "2000-01-01")
query.params["temporal"]
# ['2000-01-01T00:00:00Z,2000-01-01T00:00:00Z'] The feature requested is for the second ( query = earthaccess.search.DataGranules().temporal("2000-01", "2000-01")
query.params["temporal"]
# ['2000-01-01T00:00:00Z,2000-01-01T00:00:00Z'] Should an implementation of this feature also round up the missing day, giving It is not possible to match the behavior of Earthdata Search here, because their temporal filter uses a date-picker and autocorrects user input. Yes, it changes As an alternative, the user could provide a So my question(s):
|
Personally, I think it's too surprising. When I put in an end date I always expect that whole date to be included. That said, I don't know how to handle the other complexities you raised. I think the simplest approach is to round up both times and partial date strings for the end value to provide one uniform rule users need to remember -- the end of a temporal window is always rounded up at the level of granularity provided, i.e. a yyyy end date includes the whole year, a yyyy-mm end date includes the whole month, and a yyyy-mm-dd end date includes the whole day. Personal opinion though, if other tools familiar to our users have a standard behavior, let's use that. On that note:
Perhaps this is the best approach for our library too, except using Python datetimes. Don't let the user pass a Once those questions are answered, I think this issue is a good candidate for |
I think the round down behavior is a bit counterintuitive for me. My expectation would be the round-up behavior. When I look at the second example ("2000-01", "2000-01") my expectation is the full month of January, 2000 (i.e., ['2000-01-01T00:00:00Z,2000-01-01T23:59:59Z']). If the example was ("2000-01", "2000-02"), I'd expect the full months for both January and February. |
@itcarroll and I had a bit of a discussion about rounding here: #486 (comment)
I think this overall would be bad behavior from a user perspective. Earthacess
For
This isn't strictly true, as # up/down or floor/ceil would work for the round parameter values
def _normalize_datetime(raw: Union[None, str, dt.date], round: Literal['up', 'down'] = 'down') -> Union[None, dt.datetime]:
if round == 'down':
default_date = datetime.datetime(datetime.MINYEAR, 1, 1, 0, 0, 0, 0, timezone.utc)
elif round == 'up':
default_date = datetime.datetime(datetime.MAXYEAR, 12, 31, 23, 59, 59, 999999, timezone.utc)
else:
raise ValueError(...)
... at least for my proposed implementation in #486 (wich requires roundtripping date/datetime -> str -> datetime). |
A few things of interest:
So, ISO_8601 is generally inclusive for lower precision date-times, CMR allows for open-ended intervals but does require a full date-time representation of any provided dates, which is inclusive in some ways but exclusive in others. So, I think overall I'd prefer to follow the IOS_8601 for partial dates and be inclusive (rounding down |
I’m on team @jhkennedy!
|
Thanks, all, for the feedback and clear direction! I'll be working on an implementation today, but FYI we're going to try to send this upstream to python-cmr. You'll see some references popping in below. |
The H:M:S for the Date_To parameter in the Temporal function defaults to 0:0:0 when only the date is supplied (e.g. 2020-01-01 defaults to 2020-01-01T00:00:00). I think the H:M:S for the Date_To parameter should default to 23:59:59 unless specified by the user. This would match the behavior of NASA's Earthdata Search.
The text was updated successfully, but these errors were encountered: