Skip to content

dhimmel/openskistats

Repository files navigation

OpenSkiStats: Shredding Data Like Powder

GitHub Actions CI Tests Status

Important

This project is currently under heavy development. Methods and results are still preliminary and subject to change.

This project generates statistics on downhill ski slopes and areas from around the globe powered by the underlying OpenSkiMap/OpenStreetMap data. The first application is the creation of roses showing the compass orientations of ski areas.

Development

The analyze workflow performs a complete installation of dependencies on Linux and runs the analysis. It serves as the reference for installing dependencies and executing the analysis, as well as the sole deployment route. For convenience, we provide some local development instructions below.

Installation

Installation and execution requires several system dependencies, whose installation and presence varies by platform. The following commands are one method of installation on macOS:

brew install imagemagick@6

# install the fallback font if you don't have it
# otherwise uv run openskistats visualize will warn:
# WARNING:matplotlib.font_manager:findfont: Font family 'Noto Sans CJK JP' not found.
brew install --cask font-noto-sans-cjk

For initial Python setup, first install uv. Then run the following commands:

# install the uv environment in uv.lock
uv sync --extra=dev

# install the pre-commit git hooks
pre-commit install

Install quarto and extensions:

# install quarto story extension
(cd website/story && quarto add --no-prompt https://github.com/qmd-lab/closeread/archive/e3645070dd668004056ae508d2d25d05baca5ad1.zip)

Install R and the renv environment:

# Check that R is installed by running:
R --version

# Install the R environment by restoring the project's dependencies in the `renv.lock` file:
Rscript -e "setwd('r'); renv::restore()"

Execution

For commands that require access to the python environment, which includes those beginning with openskistats and quarto, you can activate the uv environment any of the following ways:

  • configure your IDE to activate the venv automatically, e.g. via "Python: Select Interpreter" in Visual Studio Code.
  • prefix the command with uv run, e.g. uv run openskistats --help
  • activate the venv like source .venv/bin/activate

To execute the Python analysis, run the following commands:

# download latest OpenSkiMap data
# run infrequently as we want to minimize stress on the OpenSkiMap servers
# downloads persist locally
openskistats download

# extract ski area metadata and metrics
openskistats analyze

openskistats visualize

# run python test suite
pytest

# run the full pre-commit suite
pre-commit run --all

To execute the R analysis, run the following command:

cd r
Rscript 01.data.R
Rscript 02.plot.R

To render the website, use either:

# using quarto preview to render and serve
quarto preview website

# render and serve to <http://localhost:8000> manually 
quarto render website
python -m http.server --directory=data/webapp

References

List of related webpages not yet mentioned in the manuscript:

Publicity

Wild Ideas

  • Table of all OpenStreetMap users that have contributed to ski areas, i.e. top skiers
  • Max slope v difficulty by region
  • fix matplotlib super title spacing

Upstream issue tracking

License

The code in this repository is released under a BSD-2-Clause Plus Patent License.

This project is built on data from OpenSkiMap, which is based on OpenStreetMap. OpenStreetMap and OpenSkiMap data are released under the Open Data Commons Open Database License. Learn more at https://www.openstreetmap.org/copyright.