Open source tools at Utah DWQ

Jake Vander Laan ()
Elise Hinman ()

Use arrow keys or navigator at bottom right to change slides. Press escape for slide overview.


What is open source?

Source code made publicly available for use and modification.

Why use open source?

  • Transparency
  • Repeatability
  • Efficiency
  • Flexibility
  • Ownership

What do we use open source tools for?

  • Querying/downloading data
  • Water quality assessments
  • Data visualization
  • Documenting & communicating analyses

Our general approach

  1. Reusable, generalizable functions with flexible inputs
  2. Use arguments to modify functions, instead of re-programming
  3. Link functions in series to perform analyses
  4. Document functions and analyses
  5. Use interactive figures and applications to enhance user understanding

What platforms do we use?

R

R is an open source statistical program and coding language.
r-project.org


Robust user community of coders & problem solvers.
Fully customizable.

R

Functions & packages

  • Function:
    A block of code that performs a particular task or set of tasks. A function has a name, arguments, a body (code), and a return value.

  • Argument:
    Change-able inputs to a function.

  • Package:
    A portable collection of R functions.

R documentation

Markdown

Text formatting syntax that allows conversion of plain text to rich text HTML, PDF, and other document types including tables, figures, and code.

  • Documents (package rmarkdown)
  • Chapters & books (package bookdown)
  • Presentations
  • Dashboards
  • Websites

Markdown - Bookdown

Compile documents into books. Document complex processes & user build guides.

Example: Utah IR R tools user guide

Data portals & web services

Water quality data portal
waterqualitydata.us/portal

Data portals & web services

Web service capabilities

Data portals & web services

two_site_nr=readWQP(type="narrowresult",
                    siteid=c("UTAHDWQ_WQX-4900440","UTAHDWQ_WQX-4900470"), 
                    start_date="01/01/2016", end_date="12/31/2018")

utah_lake_nr=readWQP(type="narrowresult",
                     auid=c('UT-L-16020201-004_01', 'UT-L-16020201-004_02'),
                     start_date="01/01/2016", end_date="12/31/2018",
                     siteType="Lake, Reservoir, Impoundment")

Data portals & web services

ECHO

Data portals & web services

ECHO

UT0021717_tp_001=readECHO_ec(p_id="UT0021717", 
    parameter_code="00665", outfall="001", print=F)
UT0021717_tp_001_effluent=subset(UT0021717_tp_001, 
    monitoring_location_desc=="Effluent Gross")
Permit ID Date Parameter Result Units Stat
UT0021717 12/31/2019 Phosphorus, total [as P] 2.50 mg/L 30DA AVG
UT0021717 11/30/2019 Phosphorus, total [as P] 2.61 mg/L 30DA AVG
UT0021717 10/31/2019 Phosphorus, total [as P] 2.40 mg/L 30DA AVG
UT0021717 09/30/2019 Phosphorus, total [as P] 2.60 mg/L 30DA AVG
UT0021717 08/31/2019 Phosphorus, total [as P] 2.40 mg/L 30DA AVG
UT0021717 07/31/2019 Phosphorus, total [as P] 2.48 mg/L 30DA AVG

GitHub

Collaborative code writing, versioning, & sharing platform.
Individuals, organizations, teams, and repositories.

GitHub

DWQ GitHub organization
A location for DWQ staff to store, collaborate, and share repositories.
github.com/utah-dwq

DWQ R packages
DWQ has two packages in current development. These can be viewed and installed via GitHub.

R-Shiny

Shiny is an R package for building interactive web applications to visualize and analyze data and communicate analytical results.

Examples

Querying & processing data

Full page

Salinity in Great Salt Lake

An analysis of changes in salinity in Great Salt Lake in response to changes to in hydrologic connectivity through a railroad causeway that bisects the lake.

GSL Salinity Dashboard

Utah’s Lake Dashboard

Interactively visualize lake profile & trophic indicator data.
View on the DWQ Shiny apps server Source code

Utah Water Quality Data Viewer

wqTools::wqDD()

Source code

Utah Lake Data Explorer

Analyze and visualize water quality data in Utah Lake.

View on the DWQ Shiny apps server

Source code

TMDL development

Fremont River E.coli TMDL

TMDL development

View on the DWQ Shiny apps server

Source code

TMDL development

Timeseries

TMDL development

Monthly trends

TMDL development

Load duration curves

Questions

Slides: bookdown.org/jakevl/udwq-open-source
Source code: github.com/jakevl/utah-dwq-open-source