MCPcopy
hub / github.com/pydata/xarray / _date_field

Method _date_field

xarray/core/accessor_dt.py:247–257  ·  view source on GitHub ↗
(self, name: str, dtype: DTypeLike | None)

Source from the content-addressed store, hash-verified

245 self._obj = obj
246
247 def _date_field(self, name: str, dtype: DTypeLike | None) -> T_DataArray:
248 if dtype is None:
249 dtype = self._obj.dtype
250 result = _get_date_field(_index_or_data(self._obj), name, dtype)
251 newvar = Variable(
252 dims=self._obj.dims,
253 attrs=self._obj.attrs,
254 encoding=self._obj.encoding,
255 data=result,
256 )
257 return self._obj._replace(newvar, name=name)
258
259 def _tslib_round_accessor(self, name: str, freq: str) -> T_DataArray:
260 result = _round_field(_index_or_data(self._obj), name, freq)

Callers 15

yearMethod · 0.80
monthMethod · 0.80
dayMethod · 0.80
hourMethod · 0.80
minuteMethod · 0.80
secondMethod · 0.80
microsecondMethod · 0.80
nanosecondMethod · 0.80
dayofweekMethod · 0.80
dayofyearMethod · 0.80
quarterMethod · 0.80
days_in_monthMethod · 0.80

Calls 4

VariableClass · 0.90
_get_date_fieldFunction · 0.85
_index_or_dataFunction · 0.85
_replaceMethod · 0.45

Tested by

no test coverage detected