default_datetime_range#
- geodesic.boson.default_datetime_range(start=None, end=None, before_now=None, input_collection=None, output_collection=None, asset=None)[source]#
Sets the default datetime range in a search request on a Dataset.
This is useful for when you are creating a dataset that points to a very long time history, but by default wish to show a specific time range. This can be useful for things like showing the last 24 hours of data.
- Parameters:
start (str | datetime | None) – start of the default datetime range. Defaults to None.
end (str | datetime | None) – end of the default datetime range. Defaults to None.
before_now (timedelta | None) – time delta before now to set the start of the default datetime range. If provided, will be used instead of start/end and will dynamically be used based on the current time whenever there is a new request. Defaults to None.
input_collection (str, optional) – name of the input collection to apply transform to. Defaults to None (all collections)
output_collection (str, optional) – name of the virtual collection that the transform will be applied to. Defaults to None (no virtual collection created)
asset (str, optional) – asset to use for the default datetime range. If provided, will apply the default datetime range to the asset. Use instead of input/output collection.
Example
>>> # Set the default datetime range to be the last 24 hours >>> default_datetime_transform = default_datetime_range(before_now=datetime.timedelta(days=1))
>>> # Set the default datetime range to be from 2021-01-01 to 2021-01-02 >>> default_datetime_transform = default_datetime_range(start="2021-01-01", end="2021-01-02")