siphon icon indicating copy to clipboard operation
siphon copied to clipboard

Current Datetime Creator

Open jrleeman opened this issue 6 years ago • 1 comments

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?

jrleeman avatar Jan 07 '20 14:01 jrleeman

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

dopplershift avatar Jan 07 '20 22:01 dopplershift