MCPcopy Index your code
hub / github.com/pydata/xarray / _cftimeindex_from_i8

Function _cftimeindex_from_i8

xarray/coding/cftimeindex.py:821–839  ·  view source on GitHub ↗

Construct a CFTimeIndex from an array of integers. Parameters ---------- values : np.array Integers representing microseconds since 1970-01-01. date_type : cftime.datetime Type of date for the index. name : str Name of the index. Returns -------

(values, date_type, name)

Source from the content-addressed store, hash-verified

819
820
821def _cftimeindex_from_i8(values, date_type, name):
822 """Construct a CFTimeIndex from an array of integers.
823
824 Parameters
825 ----------
826 values : np.array
827 Integers representing microseconds since 1970-01-01.
828 date_type : cftime.datetime
829 Type of date for the index.
830 name : str
831 Name of the index.
832
833 Returns
834 -------
835 CFTimeIndex
836 """
837 epoch = date_type(1970, 1, 1)
838 dates = np.array([epoch + timedelta(microseconds=int(value)) for value in values])
839 return CFTimeIndex(dates, name=name)
840
841
842def _total_microseconds(delta):

Callers 1

_round_via_methodMethod · 0.85

Calls 2

date_typeFunction · 0.85
CFTimeIndexClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…