Skip to content

Commit

Permalink
test visualization, fix second test ski area
Browse files Browse the repository at this point in the history
  • Loading branch information
dhimmel committed Oct 28, 2024
1 parent c125fb9 commit 4de1dbd
Show file tree
Hide file tree
Showing 8 changed files with 5,074 additions and 2,137 deletions.
13 changes: 10 additions & 3 deletions ski_bearings/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def bearing_dists_by_country() -> pl.DataFrame:
)


def ski_rose_the_world() -> pl.DataFrame:
def ski_rose_the_world(min_combined_vertical: int = 10_000) -> pl.DataFrame:
path = get_data_directory().joinpath("ski-roses.pdf")
pdf_pages = PdfPages(
filename=path,
Expand All @@ -232,8 +232,15 @@ def ski_rose_the_world() -> pl.DataFrame:
}
figures = []
for grouping_col, groups_pl in grouping_col_to_stats.items():
logging.info(f"Plotting ski rose the world by {grouping_col}")
groups_pl = groups_pl.filter(pl.col("combined_vertical") > 10_000)
logging.info(f"Plotting ski roses by {grouping_col}")
groups_pl = groups_pl.filter(
pl.col("combined_vertical") >= min_combined_vertical
)
if groups_pl.is_empty():
logging.info(
f"Skipping {grouping_col} plot which returns no groups with combined_vertical >= {min_combined_vertical:,}m."
)
continue
fig = subplot_orientations(
groups_pl=groups_pl,
grouping_col=grouping_col,
Expand Down
2 changes: 1 addition & 1 deletion ski_bearings/openskimap_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def _clean_coordinates(

test_ski_area_ids = [
"8896cde00150e73de1f1237320c88767c91ce099", # Whaleback Mountain
"0dd6fca32f6c8a9cc7f681a9267f86b58415ea60", # Storrs Hill Ski Area
"dc24f332f3117625dc09479b5d10cbb31a592be4", # Storrs Hill Ski Area
]


Expand Down
6 changes: 5 additions & 1 deletion ski_bearings/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,11 @@ def subplot_orientations(
n_rows = math.ceil(n_subplots / n_cols)
figsize = (n_cols * SUBPLOT_FIGSIZE, n_rows * SUBPLOT_FIGSIZE)
fig, axes = plt.subplots(
n_rows, n_cols, figsize=figsize, subplot_kw={"projection": "polar"}
nrows=n_rows,
ncols=n_cols,
squeeze=False,
figsize=figsize,
subplot_kw={"projection": "polar"},
)
dists_pl = (
groups_pl.select(grouping_col, "bearings")
Expand Down
3 changes: 2 additions & 1 deletion ski_bearings/tests/data/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.parquet
*.parquet
*.pdf
Loading

0 comments on commit 4de1dbd

Please sign in to comment.