Skip to content

Commit

Permalink
_nesh_timeline_aggregators
Browse files Browse the repository at this point in the history
dhimmel committed Jan 27, 2025
1 parent ad87511 commit 7012293
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -121,6 +121,7 @@ List of related webpages not yet mentioned in the manuscript:
- https://mapsynergy.com/ and https://mapsynergy.maps.arcgis.com/apps/dashboards/44d9c8422f3c4cc898642d75392337db
- https://snowbrains.com/inconsistencies-in-classification-of-ski-slope-difficulty-ratings/
- https://steepseeker.com/
- https://bestsnow.net/
- https://www.zrankings.com/

## Publicity & Users
37 changes: 37 additions & 0 deletions openskistats/nesh/timelines.py
Original file line number Diff line number Diff line change
@@ -24,6 +24,9 @@

from openskistats.utils import get_request_headers

SEASON_ORIGIN_MONTH = 9
SEASON_ORIGIN_DAY = 1


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


def _nesh_timeline_aggregators() -> list[pl.Expr]:
season_origin_date_col = pl.date(
year=pl.col.season,
month=SEASON_ORIGIN_MONTH,
day=SEASON_ORIGIN_DAY,
)
return [
pl.col("opening_date")
.sub(season_origin_date_col)
.dt.total_days()
.mean()
.alias("opening_date_offset_mean"),
pl.col("closing_date")
.sub(season_origin_date_col)
.dt.total_days()
.mean()
.alias("closing_date_offset_mean"),
pl.col("opening_date")
.to_physical()
.mean()
.cast(pl.Date)
.alias("opening_date_mean"),
pl.col("closing_date")
.to_physical()
.mean()
.cast(pl.Date)
.alias("closing_date_mean"),
pl.col.season_duration.mean().alias("season_duration_mean"),
pl.col.opening_date.count().alias("opening_date_count"),
pl.col.closing_date.count().alias("closing_date_count"),
pl.col.season_duration.count().alias("season_duration_count"),
]


nesh_to_skimap = {
"https://www.newenglandskihistory.com/NewHampshire/abenaki.php": "https://skimap.org/skiareas/view/4091",
"https://www.newenglandskihistory.com/NewHampshire/arrowhead.php": "https://skimap.org/skiareas/view/2146",

0 comments on commit 7012293

Please sign in to comment.