Created
September 22, 2016 18:44
-
-
Save jkreft-usgs/5533c95032651e4e006ef02ae2133516 to your computer and use it in GitHub Desktop.
pulling hydrograph data and making a NWIS-web style graph
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dataRetrieval) | |
library(dplyr) | |
library(gsplot) | |
middleton_q <- readNWISuv(siteNumbers = '054279465', | |
parameterCd = '00060', | |
startDate = '2016-09-19') | |
middleton_q_median <- readNWISstat(siteNumbers = '054279465', | |
parameterCd = '00060', | |
statType = 'median') %>% | |
filter(month_nu==9) %>% | |
filter(day_nu >= 19 & day_nu <= 22) %>% | |
mutate(date = as.POSIXct(paste(paste("2016", month_nu, day_nu, sep="-"), "12:00"))) | |
middleton_attr <- attributes(middleton_q) | |
middleton_hydrograph <- gsplot(yaxs='r', ylog=TRUE) %>% | |
lines(x=middleton_q$dateTime, y=middleton_q$X_00060_00011, col="blue") %>% | |
points(x=middleton_q_median$date, y=middleton_q_median$p50_va, pch=2, | |
col="orange", legend.name="median") %>% | |
axis(side=2, n.minor=5) %>% | |
grid() %>% | |
legend(location="below") %>% | |
title(main=middleton_attr$siteInfo$siteName, | |
ylab=middleton_attr$variableInfo$variableDescription) | |
middleton_hydrograph |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment