See the page live: https://labs.waterdata.usgs.gov/visualizations/snow-to-flow/index.html#/
A majority of the water in the Western United States comes from snowmelt. Winter snow accumulation, as well as spring snowmelt, affect streamflow and water availability for the rest of the year. Changes in the timing, magnitude, and duration of snowmelt may substantially alter downstream water availability. In fact, approximately 2 billion people are expected to experience diminished water supplies because of seasonal snowpack decline this century.
This data visualization explores the fundamentals of USGS snow hydrology research. The graphics describe important dynamics that determine how snow turns into flow, and the charts show the connection between snowpack (measured as snow water equivalent) and streamflow (measured as discharge). An R-based data pipeline using the targets
package is used to fetch and process data that are displayed in the website. These files are contained in the data_processing_pipeline
subdirectory.
All charts, data, and diagrams are free and open to the public. Take screencaptures of what you need, or browse through some extra images at: https://github.com/USGS-VIZLAB/snow-to-flow/tree/main/public/public_images
The project is Open Source and uses the Vue JavaScript framework in conjunction with animated Scalable Vector Graphics (SVG) and raster graphics. The build process uses the Jenkins task runner.
First, clone the project to your local system and cd
to the cloned directory.
To run the data processing pipeline:
data_processing_pipeline
subdirectory, open the data_processing_pipeline.Rproj
in Rtargets
package for R install.packages('targets')
and load it library(targets)
tar_make()
to start the pipelinep1_today
on the 1_fetch/src/1_fetch.R
scriptTo build the website locally:
npm install
in your terminal windownpm run serve
-- the address of the project will show on completion usually localhost:8080
npm rebuild node-sass
To fix that, do the following:
NODE_ENV=development
from that value"serve": "vue-cli-service serve --mode test_tier",
npm run serve
again, and the project should start
On Windows -
You might get this error when running npm run serve
'vue-cli-service' is not recognized as an internal or external command, operable program or batch file.
npm install @vue/cli-service -g
to install the Vue CLI-Service globally.The data processing steps behind the charts and maps on the Snow-to-flow page are documented in the data_processing_pipeline
subdirectory of this repo. Briefly, daily snow water equivalent values were pulled from all USDA NRCS snow telemetry sites since 1981 in 1_fetch/src/fetch_SNOTEL.R
. This data was used to calculate peak SWE and SM50 at all sites with a minimum of 20 years of data in the historic record (1981-2011) in 2_process/src/prep_SNOTEL.R
. In addition, April 1st SWE was accessed through time for each site and used to find the percentile in WY2021. These metrics were used to draw mouseover SWE curves and trendlines, that were pre-defined in R 6_visualize/src/trend_coords.R
. The trendline charts are displayed with an svg map of the Western U.S., that was also first pre-processed in R 6_visualize/src/make_map.R
and brought to life using D3.js and Vue.js. The final data files used to draw these charts are labelled SNOTEL_...csv
here:https://github.com/USGS-VIZLAB/snow-to-flow/tree/main/public/data
The SWE and streamflow ridgelines are drawn using daily gridded SWE values at 4-km resolution were obtained for the 2011 and 2012 water years at each location from the National Snow & Ice Data Center. Streamflow was obtained from the USGS National Water Information System. The data generating these charts is available here: https://github.com/USGS-VIZLAB/snow-to-flow/tree/main/public/data (mmd_df_2011.csv
, mmd_df_2012.csv
, swe_df_2011.csv
, swe_df_2012.csv
).
This software is preliminary or provisional and is subject to revision. It is being provided to meet the need for timely best science. The software has not received final approval by the U.S. Geological Survey (USGS). No warranty, expressed or implied, is made by the USGS or the U.S. Government as to the functionality of the software and related material nor shall the fact of release constitute any such warranty. The software is provided on the condition that neither the USGS nor the U.S. Government shall be held liable for any damages resulting from the authorized or unauthorized use of the software.
This software is provided "AS IS."