siphon
siphon copied to clipboard
Current Datetime Creator
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?
I think the feature seems reasonable. Could also make it take a datetime as an optional argument, defaulting to utcnow.