#Packages needed for this project
library(tidyverse)
library(here)
df <- read_csv(here('hydrology/src_classes_spring_2022/data/channel_df.csv'))
df %>%
ggplot(aes(x = Width_m, y = Channel_height_m, color = Location)) +
geom_point() +
geom_line()
df %>%
mutate(invert_height = 1 - Channel_height_m) %>%
ggplot(aes(x = Width_m, y = invert_height, color = Location)) +
geom_point() +
geom_line()
df <- df %>%
mutate(invert_height = 1 - Channel_height_m, new_water = Water_level_m + invert_height)
df %>%
ggplot() +
geom_point(aes(x = Width_m, y = invert_height, color = Location), alpha = 0.5, size = 3) +
geom_line(aes(x = Width_m, y = invert_height, color = Location)) +
geom_line(aes(x = Width_m, y = new_water), color = "blue", size = 1.5) +
geom_point(aes(x = Width_m, y = new_water), color = "blue", alpha = 0.5, size = 3)+
ylab("Height (m)") +
xlab("Width (m)") +
theme_linedraw() +
theme(legend.title = element_blank())
Figure 1. Cross-sectional data for the Poudre River at the Environmental Learning Center April 2022.
seq <- seq(from = 0.02, to = 0.17, length.out = 61)
df <- cbind(df, seq) %>%
mutate(cor_d = Channel_height_m - seq)
df <- df %>%
mutate(area_m2 = (lead(Width_m) - lag(Width_m)) / 2 *cor_d)
total_area <- sum(df$area_m2, na.rm = TRUE)
df <- df %>%
mutate(wetted_area_m2 = (lead(Width_m) - lag(Width_m)) / 2 *
Water_level_m)
total_wetted_area <- sum(df$wetted_area_m2, na.rm = TRUE)
bf_df <- df %>%
filter(Width_m %in% c(1.5:28.5)) %>%
select(-Water_level_m, -new_water, -invert_height)
seq_bf <- seq(from = 0.14, to = 0.25, length.out = 28)
bf_df <- cbind(bf_df, seq_bf) %>%
mutate(cor_d_bf = Channel_height_m - seq_bf)
bf_df$cor_d_bf[bf_df$cor_d_bf < 0] <- 0
mean_bf_d <- mean(bf_df$cor_d_bf)
bf_df <- bf_df %>%
mutate(bf_area_m2 = (lead(Width_m) - lag(Width_m)) / 2 *cor_d_bf)
tot_bf_area <- sum(bf_df$bf_area_m2, na.rm = TRUE)
bf_df$bf_area_m2[bf_df$bf_area_m2 < 0] <- 0