File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 28
28
SEASON_ORIGIN_DAY = 1
29
29
30
30
31
+ def get_date_offset_breaks_and_labels () -> tuple [list [int ], list [str ]]:
32
+ """
33
+ Get offset breaks used for axis major plotting breaks,
34
+ which are the number of days into the ski season in the Northern Hemisphere.
35
+ Also return offset labels, which are the month and day of the first day of each month.
36
+ Assumes a non-leap year.
37
+ """
38
+ offset_breaks = [0 ]
39
+ offset_labels = []
40
+ for month_offset in range (12 ):
41
+ month = (SEASON_ORIGIN_MONTH - 1 + month_offset ) % 12 + 1
42
+ _ , days_in_month = calendar .monthrange (2025 , month ) # 2025 is not a leap year
43
+ offset_breaks .append (offset_breaks [- 1 ] + days_in_month )
44
+ offset_labels .append (calendar .month_abbr [month ] + " 1" )
45
+ offset_breaks .pop ()
46
+ return offset_breaks , offset_labels
47
+
48
+
31
49
@dataclass (frozen = True )
32
50
class NewEnglandSkiHistoryTimelineScraper :
33
51
season : int
You can’t perform that action at this time.
0 commit comments