to_datetime#

drms.to_datetime(tstr, *, force=False)[source]#

Parse JSOC time strings.

In general, this is quite complicated, because of the many different (non-standard) time strings supported by the DRMS. For more (much more!) details on this matter, see Rick Bogart’s notes.

The current implementation only tries to convert typical HMI time strings, with a format like “%Y.%m.%d_%H:%M:%S_TAI”, to an ISO time string, that is then parsed by pandas. Note that “_TAI”, as well as other timezone identifiers like “Z”, will not be taken into account, so the result will be a naive timestamp without any associated timezone.

If you know the time string format, it might be better calling pandas.to_datetime() directly. For handling TAI timestamps, e.g. converting between TAI and UTC, the astropy.time package can be used.

Parameters:
  • tstr (str or List[str] or pandas.Series) – Datetime strings.

  • force (bool) – Set to True to omit the endswith('_TAI') check.

Returns:

result – Pandas series or a single Timestamp object.

Return type:

pandas.Series or pandas.Timestamp