Skip to content

Commit 7012293

Browse files
committed
_nesh_timeline_aggregators
1 parent ad87511 commit 7012293

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ List of related webpages not yet mentioned in the manuscript:
121121
- https://mapsynergy.com/ and https://mapsynergy.maps.arcgis.com/apps/dashboards/44d9c8422f3c4cc898642d75392337db
122122
- https://snowbrains.com/inconsistencies-in-classification-of-ski-slope-difficulty-ratings/
123123
- https://steepseeker.com/
124+
- https://bestsnow.net/
124125
- https://www.zrankings.com/
125126

126127
## Publicity & Users

openskistats/nesh/timelines.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424

2525
from openskistats.utils import get_request_headers
2626

27+
SEASON_ORIGIN_MONTH = 9
28+
SEASON_ORIGIN_DAY = 1
29+
2730

2831
@dataclass(frozen=True)
2932
class NewEnglandSkiHistoryTimelineScraper:
@@ -171,6 +174,40 @@ def read_nesh_timelines_skimap_key() -> pl.DataFrame:
171174
)
172175

173176

177+
def _nesh_timeline_aggregators() -> list[pl.Expr]:
178+
season_origin_date_col = pl.date(
179+
year=pl.col.season,
180+
month=SEASON_ORIGIN_MONTH,
181+
day=SEASON_ORIGIN_DAY,
182+
)
183+
return [
184+
pl.col("opening_date")
185+
.sub(season_origin_date_col)
186+
.dt.total_days()
187+
.mean()
188+
.alias("opening_date_offset_mean"),
189+
pl.col("closing_date")
190+
.sub(season_origin_date_col)
191+
.dt.total_days()
192+
.mean()
193+
.alias("closing_date_offset_mean"),
194+
pl.col("opening_date")
195+
.to_physical()
196+
.mean()
197+
.cast(pl.Date)
198+
.alias("opening_date_mean"),
199+
pl.col("closing_date")
200+
.to_physical()
201+
.mean()
202+
.cast(pl.Date)
203+
.alias("closing_date_mean"),
204+
pl.col.season_duration.mean().alias("season_duration_mean"),
205+
pl.col.opening_date.count().alias("opening_date_count"),
206+
pl.col.closing_date.count().alias("closing_date_count"),
207+
pl.col.season_duration.count().alias("season_duration_count"),
208+
]
209+
210+
174211
nesh_to_skimap = {
175212
"https://www.newenglandskihistory.com/NewHampshire/abenaki.php": "https://skimap.org/skiareas/view/4091",
176213
"https://www.newenglandskihistory.com/NewHampshire/arrowhead.php": "https://skimap.org/skiareas/view/2146",

0 commit comments

Comments
 (0)