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
### calculate total flow through S333 below and above 9.2' from WY 2006-2019. | |
if(!"devtools" %in% installed.packages()) install.packages("devtools", repos='http://cran.us.r-project.org') | |
if(!"SFNRC" %in% installed.packages()) devtools::install_github("troyhill/SFNRC") | |
library(SFNRC) | |
theme_set(theme_bw()) | |
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
### function to calculate equations 4, 3, and 5 from Browder et al. 2002 | |
sv.rate <- function(salinity, temperature, daily = FALSE) { | |
LP <- -4.6019 + (0.7039 * temperature) + (0.2186 * salinity) + | |
(-0.0250 * temperature^2) + (-0.0077 * salinity^2) + | |
(0.0115 * temperature * salinity) # equation 4, using survival rate coefficients from Table 1 | |
ifelse(daily == TRUE, | |
M1 <- -log(exp(LP)) * (exp(LP) + 1)^-1 / 28, # daily survival # equation 3 | |
M1 <- -log(exp(LP)) * (exp(LP) + 1)^-1 # 28-day survival |
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
# script to explore the SFWMD's rainfall formula | |
a <- list.files("C:/RDATA/rainfall_formula/", pattern = "\\.txt$", full.names = TRUE) | |
rain <- read.delim(a[4], skip = 1) | |
head(rain) | |
pet <- read.delim(a[3], skip = 1) | |
head(pet) |
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
### may be necessary: install dev version of curl for google drive | |
# install.packages("https://github.com/jeroenooms/curl/archive/master.tar.gz", repos = NULL) | |
pkgs.used <- c("devtools", "sf", "ggplot2", "gmailr", "googledrive") | |
pkgs.to.install <- pkgs.used[!pkgs.used %in% installed.packages()] | |
if (length(pkgs.to.install) > 0) { | |
install.packages(pkgs.to.install) | |
} | |
if (!"fireHydro" %in% installed.packages()) { |
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
### | |
discharge_section_join.sh L67_L30 > /home/thill/RDATA/dataForEver/data_L67_L30_flow.csv | |
### | |
#!/bin/bash | |
# Script pulls coordinates for all stations in DataForEver database | |
# Usage: ./bash/dataForEver_getCoords.sh |
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
export PATH=$PATH:/opt/physical/appaserver/src_waterquality:/opt/physical/appaserver/src_appaserver:/opt/physical/appaserver/utility:/opt/physical/appaserver/src_hydrology:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:.:/home/thill/bash:.:/opt/physical/appaserver/utility:/opt/physical/appaserver/src_appaserver:/opt/physical/appaserver/src_waterquality:/opt/physical/appaserver/src_hydrology:/opt/physical/sql:/opt/physical/util/ | |
source ~/.profile |
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
### script to download and summarize DataForEver hydro data for a set of stations | |
### install.packages("devtools") # install devtools package, if it's not installed already | |
devtools::install_github("troyhill/SFNRC") | |
library(SFNRC) | |
library(plyr) | |
library(ggplot2) | |
### stations can be defined manually |
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
getFireHydro(EDEN_date = "20181018", dataToPlot = "WF_Use", output_shapefile = NULL, | |
imageExport = "output_WFuse_20181018.png") | |
# beepr::beep(2) | |
getFireHydro(EDEN_date = "20170630", dataToPlot = "WL_des", output_shapefile = NULL, | |
imageExport = "output_WLdes_20170630.png") | |
# beepr::beep(2) |
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
### Weighted regression using time, discharge, and season | |
### Application of EGRET tools to DataForEver data | |
library(plyr) | |
library(SFNRC) | |
# Meta-analysis ----------------------------------------------------------- | |
targStns <- c("S333", "S12A", "S12B", "S12C", "S12D") #, "S151", "S343", "S332") |
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
assignTide <- function(data, timeCol = "time", levelCol = "level", tideCol = "tide") { | |
### this works well with output from HL() | |
### arguments: | |
### data = the data frame | |
### timeCol = name of column with time stamp data, in format "YYYY-MM-DD ..." | |
### levelCol = name of column with water level data (numeric) | |
### tideCol = name of column with tide indicator (H/L) - this is tailored to HL() output | |
data[, "day"] <- substr(data[, timeCol], 1, 10) # weak point - assumes YYYY-MM-DD format |
NewerOlder