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(tidyverse) | |
library(deming) | |
# Functions --------------------------------------------------------------- | |
# given a point (x1, y1) and a line defined by a slope m and intercept c1 | |
# function to return the point x on the line where a line drawn perpendicular to x1, y1 | |
# will intercept the line |
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(tidyverse) | |
#pbinom(q, size, prob, lower.tail = TRUE, log.p = FALSE) | |
# Probability of 1, 1% flood in 100 years | |
dbinom(1, size = 100, prob = 0.01, log = FALSE) | |
choose(100,1) *0.01^1*0.99^99 | |
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(tidyverse) | |
issues <- tribble(~issue, ~pc, | |
'Inflows', 6, | |
'Demand changes', 6, | |
'System operation', 18, | |
'Equity of water sharing arrangements', 10, | |
'State entitlements and policies', 10, | |
'Environmental water', 11, | |
'Reliability of different licences', 4, | |
'Miscellaneous', 4, |
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
# Smooth interpolation between long and short duration ARFs using a cubic. | |
library(tidyverse) | |
library(pracma) | |
devtools::source_url("https://gist.githubusercontent.com/TonyLadson/fc870cf7ebfe39ea3d1a812bcc53c8fb/raw/d8112631a92a32be749cabe334a22931c035711e/ARF2019.R?raw=TRUE") |
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(tidyverse) | |
xdf <- tribble(~area_min, ~area_max, ~dur_min, ~dur_max, ~type, | |
10, 1000, 0, 12, 'short', | |
10, 30000, 24, 168, 'long', | |
10, 30000, 12, 24, 'interpolation', | |
0, 1, 0, 168, 'ARF = 1', | |
1, 10, 0, 12, 'Interp3', | |
1, 10, 12, 24, 'Interp2', | |
1, 10, 24, 168, 'Interp1') |
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
# Load the functions we need | |
devtools::source_url("https://gist.githubusercontent.com/TonyLadson/fc870cf7ebfe39ea3d1a812bcc53c8fb/raw/d8112631a92a32be749cabe334a22931c035711e/ARF2019.R?raw=TRUE") | |
#source(file.path('ARR2019_ARF', "ARF_2019.R")) | |
#source(file.path('ARR2019_ARF', "ARF_tests.R")) # Check that we pass tests | |
# Functions and constants ------------------------------------------------------ |
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(tidyverse) | |
library(optimx) | |
devtools::source_url("https://gist.githubusercontent.com/TonyLadson/fc870cf7ebfe39ea3d1a812bcc53c8fb/raw/d8112631a92a32be749cabe334a22931c035711e/ARF2019.R?raw=TRUE") | |
#source(file.path('ARR2019_ARF', "ARF_2019.R")) | |
#source(file.path('ARR2019_ARF', "ARF_tests.R")) # Check that we pass tests | |
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(tidyverse) | |
devtools::source_url("https://gist.githubusercontent.com/TonyLadson/fc870cf7ebfe39ea3d1a812bcc53c8fb/raw/d8112631a92a32be749cabe334a22931c035711e/ARF2019.R?raw=TRUE") | |
#source(file.path('ARR2019_ARF', "ARF_2019.R")) | |
#source(file.path('ARR2019_ARF', "ARF_tests.R")) | |
# Functions and 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(stringr) | |
library(testthat) | |
region_names <- | |
c("East Coast North", "Semi-arid Inland QLD", "Tasmania", "SW WA", | |
"Central NSW", "SE Coast", "Southern Semi-arid", "Southern Temperate", | |
"Northern Coastal", "Inland Arid") | |
params <- | |
structure(list(`East Coast North` = c(0.327, 0.241, 0.448, 0.36, 0.00096, 0.48, -0.21, 0.012, -0.0013), |
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(tidyverse) | |
library(patchwork) | |
dat_wide <- tibble( | |
x = 1:3, | |
top = c(4.5, 4, 5.5), | |
middle = c(4, 4.75, 5), | |
bottom = c(3.5, 3.75, 4.5) | |
) |
NewerOlder