library(tidyverse)
library(here)
library(plotly)
library(lubridate)
library(tibbletime)
df <- read_csv(here('hydrology/3_dilution_gauging/R/data/COND_data_4_26_22.csv'))
df_tt <- as_tbl_time(df, index = Time)
ggplotly(df_tt %>%
ggplot(aes(x = Time, y = Cond_cor)) +
geom_point()
)
Create time since injection column with mutate call.
inj_3 <- inj_3 %>%
mutate(time_since_inj = Run_time - 715)
Background correct the breakthrough curve (BTC)
inj_3 <- inj_3 %>%
mutate(bg_sc = Cond_cor - 960)
ggplotly(inj_3 %>%
ggplot() +
geom_point(aes(x = time_since_inj, bg_sc))
)
Modal velocity in m/s
time_to_peak <- 110
modal_velocity_3 <- dist3/time_to_peak
Convert micro to milliSiemans and then g/L NaCl
inj_3 <- inj_3 %>%
mutate(NaCl = bg_sc/1000/2) %>%
mutate(IntC_s1 = NaCl+lag(NaCl, default = 0)) %>%
mutate(IntC = cumsum(IntC_s1*.5*5)) %>%
mutate(recovery = IntC/max(IntC))
q3 <- mass3/(max(inj_3$IntC))
Pull out the 5, 50 and 95% velocites
fiveRecovery.idx3 <- which.min(abs(inj_3$recovery - 0.05))
five_time_3 <- inj_3[18, 4]
five_velo_3 <- dist3/five_time_3