semantique.extent.TemporalExtent.discretize

semantique.extent.TemporalExtent.discretize#

TemporalExtent.discretize(resolution=None, tz=None)[source]#

Discretize the temporal extent into an array.

Discretizing the temporal extent creates a one-dimensional regular grid that covers the entire temporal extent. Each grid cell corresponds to a single time instant within this extent, and gets the numpy.datetime64 object belonging to that instant assigned as value.

Parameters:
  • resolution (str or pandas.tseries.offsets.DateOffset) – Temporal resolution of the grid. Can be given as offset alias as defined in pandas, e.g. “D” for a daily frequency. These aliases can have multiples, e.g. “5D”. If None, only the bounds of the extent will be coordinates in the grid.

  • tz (optional) – Timezone of the datetime values in the grid. Can be given as str referring to the name of a timezone in the tz database, or as instance of any class inheriting from datetime.tzinfo. If None, the timezone of the extent is used.

Returns:

xarray.DataArray