This file contains hidden or 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
| # Geometric Distribution of 1% floods | |
| # probability of 4 or fewer safe years | |
| pgeom(4, 0.01) | |
| # [1] 0.04900995 | |
| # probability of exactly 4 safe years and then a flood in the 5th | |
| dgeom(4, 0.01) | |
| #[1] 0.00960596 |
This file contains hidden or 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
| Hydro <- function(tt, t.peak = 1, Qmin = 1, Qmax = 10, beta = 5) { | |
| Qmin + (Qmax - Qmin)*( (tt/t.peak) * (exp(1 - tt/t.peak)))^beta | |
| } | |
| tt.seq <- seq(0,4,0.01) | |
| op <- par(oma = c(1, 2, 0, 0)) |
This file contains hidden or 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(ggplot) | |
| library(grid) | |
| library(devtools) | |
| library(dplyr) | |
| library(lubridate) | |
| source_gist('cc60bbb3cbadf0e72619') # ggplot theme | |
| # Data is stored in a data frame with the date, flow and quality code | |
| # You'll need to provide your own data for this to work. |
This file contains hidden or 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
| ########################################################## | |
| # | |
| # Plotting Flike Output | |
| # see https://tonyladson.wordpress.com/2015/10/20/better-frequency-plots-from-web-based-flike/ | |
| # | |
| ############################################################ | |
| library(stringr) |
This file contains hidden or 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
| require(ggplot2) | |
| require(zoo) | |
| require(dplyr) | |
| # MakeNames_Hydstra | |
| # Hydstra files have names spread across 4 rows. This gist, turns the data into a single string | |
| MakeNames_Hydstra <- function(Hydstra.csv){ | |
This file contains hidden or 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
| FDC <- function(Q, xnormal=TRUE, xlab='%time flow equalled or exceeded', | |
| ylab='flow',Qreturn=FALSE, plotFlow=FALSE, add=FALSE, alpha=0.5, ...) { | |
| # Q - flow data (vector of flow values) | |
| # xnormal - logical value to determine if the percentiles should be plotted in a normal (probit) scale | |
| # Qreturn - logical value indicating if quantiles should be returned | |
| # plotFlow - logical value indicating if a time series of flow should be overplotted on flow duration curve | |
| # add - should fdc be added to an existing plot? | |
| # alpha - transparency value for overplotting of flow time series | |
This file contains hidden or 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(dplyr) | |
| library(ggplot2) | |
| library(grid) | |
| library(scales) | |
| # download sample files from google drive | |
| file_id <- "1a5ksZpQbuAnbC6oNEBe8RJO4Z1L2HEic" | |
| url <- sprintf("https://docs.google.com/uc?id=%s&export=download", file_id) | |
| wq <- read.csv(url) |
This file contains hidden or 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
| # Confidence intervals for the mean for non-normal data | |
| # See https://tonyladson.wordpress.com/2016/01/11/plotting-water-quality-samples-on-a-hydrograph/ | |
| # Modified Cox function for calculating confidence intervals for the mean | |
| # Based on Olsson, 2005 | |
| # http://www.amstat.org/publications/jse/v13n1/olsson.html | |
| # x is a set of log-normal data |
This file contains hidden or 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
| # See https://tonyladson.wordpress.com/2016/02/08/envelop-curve-for-record-australian-rainfall/ | |
| # remove(list = objects()) | |
| library(XML) | |
| library(dplyr) | |
| library(MASS) | |
| library(xtable) | |
This file contains hidden or 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(quantreg) | |
| library(dplyr) | |
| library(lubridate) | |
| library(stringr) | |
| library(readr) | |
| library(ggplot2) | |
| library(devtools) | |
| library(splines) | |