scipp.datetimes
scipp.datetimes#
- scipp.datetimes(*, dims, values, unit=<automatically deduced unit>)#
Constructs an array
Variable
with a dtype of datetime64.- Parameters
dims – Dimension labels
values (
numpy.typing.ArrayLike
) – Numpy array or something that can be converted to a Numpy array of datetimes.unit (
Union
[Unit
,str
,None
], default:<automatically deduced unit>
) – Unit for the resulting Variable. Can be deduced ifvalues
contains strings or np.datetime64’s.
- Returns
Variable
– An array variable containing a datetime.
Examples
>>> sc.datetimes(dims=['t'], values=['2021-01-10T01:23:45', ... '2021-01-11T01:23:45']) <scipp.Variable> (t: 2) datetime64 [s] [2021-01-10T01:23:45, 2021-01-11T01:23:45] >>> sc.datetimes(dims=['t'], values=['2021-01-10T01:23:45', ... '2021-01-11T01:23:45'], unit='h') <scipp.Variable> (t: 2) datetime64 [h] [2021-01-10T01:00:00, 2021-01-11T01:00:00] >>> sc.datetimes(dims=['t'], values=[0, 1610288175], unit='s') <scipp.Variable> (t: 2) datetime64 [s] [1970-01-01T00:00:00, 2021-01-10T14:16:15]