Skip to main content

nwac

A Python package for downloading historical Northwest Avalanche Center (NWAC) telemetry data. Currently, the package supports downloading historical telemetry data by year and weather station.

This project is not affiliated with NWAC in any way. Please go to https://nwac.us/ to visit NWAC's website, and if you find their telemetry or forecasts useful please consider donating to them to help their nonprofit mission of providing avalanche information to help keep PNW backcountry users safe.

Backcountry skiers traversing to Illumination Saddle

Install

pip install nwac

Usage

To see all of the available weather stations, use the stations function to get a Pandas Dataframe of station metadata:

import nwac
nwac_stations = nwac.stations()

To download telemetry data, use the download_historical_data function. You can specify station names or ids along with years, or if you leave all function arguments blank it will download data from every NWAC station from 2014 to present. The downloading process will take ~ 10 minutes, so please consider only downloading data from the stations and timeframes that you require for your analysis. For example, if you just need 2021-2022 data for Hurricane Ridge:

hurricane_ridge_data = nwac.download_historical_data(
    station_names=["Hurricane Ridge"],
    years=[2021, 2022]
)

Here let's plot daily median snow depth values for the Paradise, Heather Meadows, and Washington Pass Base stations for 2021:

%matplotlib inline

import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns


# Data
nwac_data = nwac.download_historical_data(
    station_names=["Paradise", "Mt Baker - Heather Meadows", "Washington Pass Base"],
    years=[2021]
)
plotting_data = (
    nwac_data
    .assign(Date=lambda df: pd.to_datetime(df["Date_Time"]).dt.date)
    .groupby(["Station_Name", "Date"])
    ["Total_Snow_Depth"]
    .median()
    .reset_index()
    .assign(Date=lambda df: pd.to_datetime(df["Date"]))
    .rename(columns={"Station_Name":"Station"})
)

# Plot
plt.figure(figsize=(16, 7))
ax = sns.lineplot(data=plotting_data, x="Date", y="Total_Snow_Depth", hue="Station")
ax.set_title("Median Daily Snow Depth", fontsize=18)
ax.set(xlabel="Date", ylabel="Snow depth (in)")
plt.show()

Daily median snow depth plot

Development

I would welcome any feedback, suggestions, and most importantly contributions! Please feel free to open issues or pull requests here in this repo. To run the current pytest unit tests:

pytest tests/test_nwac.py

Ideas for future improvement:

  • Downloader for historical avalanche forecasts
  • Out-of-the-box sensible imputation/smoothing (look at the early November snow depths for Paradise above as an example of some obviously wrong data)

Thanks!

Metadata

Release files for nwac 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nwac 0.1.1
File Size Uploaded
nwac-0.1.1.tar.gz 6.5 kB Details

Release files / nwac-0.1.1.tar.gz

Download URL nwac-0.1.1.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b267d9c0bd407298e98f287508f170cb55ae0f5767e0d1f2d7722a03c7c664b8
BLAKE2b-256 checksum
How to use checksums
425367df266c61d66f7884987a6d21b0e820de1dcb53368df4b525837e34924d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.8

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page