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

Class QuarterBegin

xarray/coding/cftime_offsets.py:473–495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

471
472
473class QuarterBegin(QuarterOffset):
474 # When converting a string to an offset, pandas converts
475 # 'QS' to a QuarterBegin offset starting in the month of
476 # January. When creating a QuarterBegin offset directly
477 # from the constructor, however, the default month is March.
478 # We follow that behavior here.
479 _default_month = 3
480 _freq = "QS"
481 _day_option = "start"
482
483 def rollforward(self, date):
484 """Roll date forward to nearest start of quarter"""
485 if self.onOffset(date):
486 return date
487 else:
488 return date + QuarterBegin(month=self.month)
489
490 def rollback(self, date):
491 """Roll date backward to nearest start of quarter"""
492 if self.onOffset(date):
493 return date
494 else:
495 return date - QuarterBegin(month=self.month)
496
497
498class QuarterEnd(QuarterOffset):

Callers 3

rollforwardMethod · 0.85
rollbackMethod · 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…