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

Current Datetime Creator #296

Open
jrleeman opened this issue Jan 7, 2020 · 1 comment
Open

Current Datetime Creator #296

jrleeman opened this issue Jan 7, 2020 · 1 comment

Comments

@jrleeman
Copy link
Contributor

jrleeman commented Jan 7, 2020

Doing this to get data is clunky (say for the top of the current hour):

date = datetime.utcnow()
request_time = date.replace(minute=0, second=0, microsecond=0)
ds = cat.datasets.filter_time_nearest(request_time)

What about a utcnow type function that takes a precision argument or similar that zeros out everything smaller than it:

roundedutcnow(precision='day')  # or month, hour, minute, second

Naming is the hard thing here, but it sure seems useful - or maybe its a rounder that operates on a datetime?

@dopplershift
Copy link
Member

I think the feature seems reasonable. Could also make it take a datetime as an optional argument, defaulting to utcnow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants