obsplus.utils.time.to_utc¶
- obsplus.utils.time.to_utc(value)[source]¶
Convert an object or sequence to a UTCDateTime object.
- Parameters:
value (
str
|UTCDateTime
|float
|datetime64
|Timestamp
|Sequence
[str
|UTCDateTime
|float
|datetime64
|Timestamp
]) – Any value readable by ~:class:obspy.UTCDateTime, ~:class:numpy.datetime64 or a sequence of such.- Return type:
UTCDateTime
|ndarray
Examples
>>> import numpy as np >>> import obspy >>> inputs = [1, '2017-09-18', np.datetime64('2020-01-03')] >>> out = to_utc(inputs) >>> for utc in out: ... assert isinstance(utc, obspy.UTCDateTime)