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

Class YearEnd

xarray/coding/cftime_offsets.py:587–609  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

585
586
587class YearEnd(YearOffset):
588 _freq = "YE"
589 _day_option = "end"
590 _default_month = 12
591
592 def onOffset(self, date) -> bool:
593 """Check if the given date is in the set of possible dates created
594 using a length-one version of this offset class."""
595 return date.day == date.daysinmonth and date.month == self.month
596
597 def rollforward(self, date):
598 """Roll date forward to nearest end of year"""
599 if self.onOffset(date):
600 return date
601 else:
602 return date + YearEnd(month=self.month)
603
604 def rollback(self, date):
605 """Roll date backward to nearest end of year"""
606 if self.onOffset(date):
607 return date
608 else:
609 return date - YearEnd(month=self.month)
610
611
612class Day(BaseCFTimeOffset):

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…