MCPcopy Create free account
hub / github.com/pydata/xarray / _get_day_of_month

Function _get_day_of_month

xarray/coding/cftime_offsets.py:237–262  ·  view source on GitHub ↗

Find the day in `other`'s month that satisfies a BaseCFTimeOffset's onOffset policy, as described by the `day_option` argument. Parameters ---------- other : cftime.datetime day_option : 'start', 'end' 'start': returns 1 'end': returns last day of the month

(other, day_option: DayOption)

Source from the content-addressed store, hash-verified

235
236
237def _get_day_of_month(other, day_option: DayOption) -> int:
238 """Find the day in `other`'s month that satisfies a BaseCFTimeOffset's
239 onOffset policy, as described by the `day_option` argument.
240
241 Parameters
242 ----------
243 other : cftime.datetime
244 day_option : 'start', 'end'
245 'start': returns 1
246 'end': returns last day of the month
247
248 Returns
249 -------
250 day_of_month : int
251
252 """
253
254 if day_option == "start":
255 return 1
256 elif day_option == "end":
257 return other.daysinmonth
258 elif day_option is None:
259 # Note: unlike `_shift_month`, _get_day_of_month does not
260 # allow day_option = None
261 raise NotImplementedError()
262 raise ValueError(day_option)
263
264
265def _adjust_n_months(other_day, n, reference_day):

Callers 3

_get_offset_dayMethod · 0.85
roll_qtrdayFunction · 0.85
__apply__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…