Load function for reading in bathymetry data

Get CTD and bathymetry data

Section plotting functions

Data manipulation and reformatting

Plot

sections <- list('a' = 
                   c('z1' ,'z2', 'Z4', 'CAP') , 
                 'b' = 
                   c('Z15', 'Z14', '7.6', 'CGR4-4'), 
                 'd' = 
                   c('Z12', 'CGR4-3', 'CGR1-6', 'Z11', 'Z10', 'Z9'),
                 #'e' = 
                  # c('W15', 'W13', 'W6', 'W57', 'P1-2'),
                 'f' = 
                   c('6.55', 'CGR2-3', '6.3', 'CGR2-4'), 
                 'g' = 
                   c('W100', 'Z6', '6.5', 'Z5', '5.45'), 
                 'h' = 
                   c('SHED', '7.3', 'CGR2-3', '6.3', 'CGR2-4'), 
                 'j' = 
                   c('7.3', 'CGR2-2', 'W100', 'W98', 'Z13', 'Z16'),
                 'k' = 
                   c('K1', 'Z13','Z6', 'Z5', '5.45' ))


# loop by section

for (i in 1:length(sections)){
  cat('Section ', names(sections)[[i]], '....\n')
# create data frame
df_sec <- create_section(dat = df_full, stations = sections[[i]], output = 'df')


# plot
p <- suppressWarnings(
  plot_section(data = df_sec, var = 'temperature', bw = 1, dup = 'mean', method = 'akima', bathy = topoWorld)+
  ggtitle(paste('Section ', names(sections)[[i]]))
)
print(p)
# plot map
  
  df_sing <- df_sec %>%
    dplyr::distinct(., station, latitude, longitude)
  pp <-  ggplot() +
    geom_polygon(data = clwf, aes(x = longitude, y = latitude))+
    scale_x_continuous(limits = c(-70, -60))+
    scale_y_continuous(limits = c(40, 50))+
    coord_map(xlim = c(-67, -60), ylim = c(45, 50)) +
    theme_classic()+
    geom_point(data = df_sec, aes(x = longitude, y = latitude), shape = 21, size = 5, col = 'darkred')+
    geom_path(data = df_sec, aes(x = longitude, y = latitude), colour = 'red') +
    ggrepel::geom_label_repel(data = df_sing, 
                             aes(x = longitude, y = latitude, label = station), nudge_y = 0.5, size = 6, fill = 'gray70') +
    theme(axis.text = element_text(size = 15))+
  ggtitle(paste('Section ', names(sections)[[i]]))
    
  print(pp)
}
## Section  a ....
## Warning: Use of `lab_df[["dist"]]` is discouraged. Use `.data[["dist"]]`
## instead.
## Warning: Use of `lab_df$station` is discouraged. Use `station` instead.
## Warning: Removed 135 rows containing non-finite values (stat_contour).

## Section  b ....
## Warning: Use of `lab_df[["dist"]]` is discouraged. Use `.data[["dist"]]`
## instead.
## Warning: Use of `lab_df$station` is discouraged. Use `station` instead.
## Warning: Removed 880 rows containing non-finite values (stat_contour).
## Warning: Removed 840 rows containing missing values (geom_tile).

## Section  d ....
## Warning: Use of `lab_df[["dist"]]` is discouraged. Use `.data[["dist"]]`
## instead.
## Warning: Use of `lab_df$station` is discouraged. Use `station` instead.
## Warning: Removed 228 rows containing non-finite values (stat_contour).
## Warning: Removed 120 rows containing missing values (geom_tile).

## Section  f ....
## Warning: Use of `lab_df[["dist"]]` is discouraged. Use `.data[["dist"]]`
## instead.
## Warning: Use of `lab_df$station` is discouraged. Use `station` instead.
## Warning: Removed 482 rows containing non-finite values (stat_contour).
## Warning: Removed 160 rows containing missing values (geom_tile).

## Section  g ....
## Warning: Use of `lab_df[["dist"]]` is discouraged. Use `.data[["dist"]]`
## instead.
## Warning: Use of `lab_df$station` is discouraged. Use `station` instead.
## Warning: Removed 81 rows containing non-finite values (stat_contour).
## Warning: Removed 40 rows containing missing values (geom_tile).

## Section  h ....
## Warning: Use of `lab_df[["dist"]]` is discouraged. Use `.data[["dist"]]`
## instead.
## Warning: Use of `lab_df$station` is discouraged. Use `station` instead.
## Warning: Removed 324 rows containing non-finite values (stat_contour).
## Warning: Removed 280 rows containing missing values (geom_tile).

## Section  j ....
## Warning: Use of `lab_df[["dist"]]` is discouraged. Use `.data[["dist"]]`
## instead.
## Warning: Use of `lab_df$station` is discouraged. Use `station` instead.
## Warning: Removed 524 rows containing non-finite values (stat_contour).
## Warning: Removed 280 rows containing missing values (geom_tile).

## Section  k ....
## Warning: Use of `lab_df[["dist"]]` is discouraged. Use `.data[["dist"]]`
## instead.
## Warning: Use of `lab_df$station` is discouraged. Use `station` instead.
## Warning: Removed 565 rows containing non-finite values (stat_contour).
## Warning: Removed 320 rows containing missing values (geom_tile).