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

Method __apply__

xarray/coding/cftime_offsets.py:430–441  ·  view source on GitHub ↗
(self, other)

Source from the content-addressed store, hash-verified

428 self.month = _validate_month(month, self._default_month)
429
430 def __apply__(self, other):
431 # months_since: find the calendar quarter containing other.month,
432 # e.g. if other.month == 8, the calendar quarter is [Jul, Aug, Sep].
433 # Then find the month in that quarter containing an onOffset date for
434 # self. `months_since` is the number of months to shift other.month
435 # to get to this on-offset month.
436 months_since = other.month % 3 - self.month % 3
437 qtrs = roll_qtrday(
438 other, self.n, self.month, day_option=self._day_option, modby=3
439 )
440 months = qtrs * 3 - months_since
441 return _shift_month(other, months, self._day_option)
442
443 def onOffset(self, date) -> bool:
444 """Check if the given date is in the set of possible dates created

Callers

nothing calls this directly

Calls 2

roll_qtrdayFunction · 0.85
_shift_monthFunction · 0.85

Tested by

no test coverage detected