df <- read_csv('data/corrected_conductivity_working.csv')
df_tt <- as_tbl_time(df, index = Time)
We see that we have 3 BTCs. We want to break those into separate data frames. Let’s do that for injection 3 now. We know it started at 15:41:45 and we can cut it off at 15:49:30. We can use the tibble time package to filter by time.
# Here we filter from the injection time that we defined above to the end of the time series.
inj_3 <- df_tt %>%
filter_time(injTime3 ~ "15:49:30")
# Then we do a background correction.
inj_3 <- inj_3 %>%
mutate(bg_sc = Cond_cor - 0.756) %>%
filter(bg_sc >0)
This is the section where we do the intgration.
inj_3 <- inj_3 %>%
mutate(NaCl = bg_sc/2) %>%
mutate(IntC_s1 = NaCl + lag(NaCl, default = 0)) %>%
mutate(IntC = cumsum(IntC_s1 * 0.5 * 5)) %>%
mutate(recovery = IntC/max(IntC))
From that integration Q is calculated as:
Q3 <- mass3/max(inj_3$IntC)