Skip to content

Latest commit

 

History

History
76 lines (63 loc) · 3.14 KB

README.md

File metadata and controls

76 lines (63 loc) · 3.14 KB

Python access to snow depth data from the MountainHub REST API

This package provides simplified and standardized access to snow depth data from the MountainHub REST API, https://api.mountainhub.com/timeline.

Adapted from MountainHub.py module in the validation GitHub repository from the Community Snow Observations (CSO) Citizen Science project.

See Jupyter notebook example for usage documentation and examples, and api.mountainhumb.com_timeline.sample.json for an example of the API JSON response.

Usage

Use the snow_data function call:

mtnhubsnow.snow_data(
    publisher='all',
    obs_type='snow_conditions,snowpack_test',
    limit=1000,
    start=None,
    end=None,
    bbox=None,
    filter=True,
)

Arguments:

  • publisher -- all, pro (professional submitters), etc
  • obs_type -- Filters to only specific observation types. Can be an individual value or a comma-separated string of multiple values. Only snow depth values are processed, but accepted obs_type values are: snowpack_test, snow_conditions, weather, camera, dangerous_wildlife, other_hazard, point_of_interest, water_hazard, trail_conditions, trip_report, incident, avalanche
  • limit -- Maximum number of records to return (default 1000)
  • start -- Start datetime to return results from, as datetime object
  • end -- End datetime to return results from, as datetime object
  • bbox -- Bounding box to restrict results, specified as dictionary with items latmax, lonmax, latmin, lonmin
  • filter -- Flag indicating whether entries with no snow depth data should be filtered out.

Returns: A Pandas dataframe with the following columns:

  • id -- unique identifier for each observation
  • datetime_utc -- timestamp in UTC
  • latitude -- latitude in decimal degrees
  • longitude -- longitude in decimal degrees
  • author_name -- name of the person who collected the data
  • obs_type -- (see above)
  • snow_depth -- measured snow depth in centimeters
  • description

Installation

If the pandas and requests dependencies are installed, mtnhubsnow can be installed via pip install:

pip install git+https://github.com/communitysnowobs/mountainhub-api.git

Otherwise, the cso_environment.yml conda environment file can be used. It will additionally install matplotlib, geopandas and folium.

wget https://raw.githubusercontent.com/communitysnowobs/mountainhub-api/master/cso_environment.yml
conda env create -f cso_environment.yml

For development

git clone https://github.com/communitysnowobs/mountainhub-api.git
cd mountainhub-api
conda env create -f environment.yml
source activate mtnhubsnow
pip install -e .
# To be able to select conda environments in JupyterLab, install ipykernel
conda install ipykernel