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
dpois(0,1) # prob of zero 100-year floods in 100 years | |
dpois(0,1) # prob of zero 100-year floods in 100 years | |
[1] 0.3678794 | |
dpois(1,1) # prob of one 100-year floods in 100 years | |
[1] 0.3678794 | |
dpois(2,1) # prob of two 100-year floods in 100 years | |
[1] 0.1839397 | |
# simulation |
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
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 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 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
# This script takes the standard download of annual max, min, mean data from | |
# http://data.water.vic.gov.au/monitoring.htm | |
# Plots a bar plot with ggplot | |
library(stringr) | |
library(dplyr) | |
library(lubridate) | |
library(ggplot2) | |
library(devtools) | |
library(scales) |
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
# Usage | |
# | |
# source_gist('https://gist.github.com/TonyLadson/280fd3ae3e730b3bb370') | |
# DeltaTable_Kite(g = 0.1, aep = 0.02) | |
# [1] 2.3425 | |
DeltaTable_Kite <- function(g, aep){ | |
# g = skew | |
# aep = annual exceedance probability |
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
# Routing | |
# Based on discussion in | |
# Mein, R. G., E. M. Laurenson and T. A. McMahon (1974). | |
# "Simple nonlinear model for flood estimation." Journal of the Hydraulics Division, American Society of Civil Engineers 100(HY11): 1507-1518. | |
# Time stepping solution - ideas from Section 23.2, p490 of | |
# Jones, O., Maillardet, R. and Robinson, A. (2014) Introduction to scientific programming and simulation using R. | |
# CRC Press |
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
BwTheme = theme_bw() + | |
theme( | |
panel.background = element_rect(fill="gray98"), | |
axis.title.x = element_text(colour="grey20", size=20, margin=margin(20,0,0,0)), | |
axis.text.x = element_text(colour="grey20",size=14), | |
axis.title.y = element_text(colour="grey20",size=20, margin = margin(0,20,0,0)), | |
axis.text.y = element_text(colour="grey20",size=14), | |
legend.title = element_text(colour="grey20",size=12), | |
plot.margin = unit(c(0.5, 0.5, 1, 0.5), "cm")) # top, right, bottom, left |
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
# | |
# Interpolating design rainfall intensities | |
# | |
library(dplyr) | |
library(stringr) | |
library(optimx) | |
# Assemble data |
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(deSolve) | |
# dQ/dt = (I - Q)/(kmQ^(m-1)) | |
# Specify the inflow hydrograph, using a function as discussed at | |
# https://tonyladson.wordpress.com/2015/07/21/hydrograph-as-a-function/ | |
my.Qmin <- 0 | |
my.Qmax <- 1 |
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(repmis) | |
library(dplyr) | |
library(ggplot2) | |
library(grid) | |
library(scales) | |
# download sample files from dropbox | |
wq <- repmis::source_data('https://dl.dropboxusercontent.com/u/10963448/wq.csv') | |
flow <- repmis::source_data('https://dl.dropboxusercontent.com/u/10963448/flow.csv') |