WS22072

setup
if (!nzchar(system.file(package = "librarian"))) {
  install.packages("librarian")
}

librarian::shelf(
  quiet = TRUE,
  readr, here, fs, ggplot2, glue, "jiho/castr", dplyr, oce, patchwork, purrr, tidyr
)
Code
source(here("R/cruise_load.R"))
cruise_df <- cruise_load(params$cruise_id)
plot depth & pressure vs time elapsed
tryCatch({
  plots <- list()
  
  for (station_name in unique(cruise_df$station)) {
    subset_df <- filter(cruise_df, station == station_name)
    plots[[station_name]] <- ggplot(subset_df, aes(x = time_elapsed)) +
      geom_point(aes(y = depth), color = "blue") +  # Plot depth in blue
      geom_line(aes(y = sea_water_pressure), color = "red") +  # Plot sea water pressure in red
      ggtitle(glue("{station_name}")) +
      theme(
        axis.title.x = element_blank(),
        axis.title.y = element_blank(),
        axis.text.x = element_blank(),
        axis.text.y = element_blank(),
        axis.ticks.x = element_blank(),
        axis.ticks.y = element_blank()
      )  # Remove individual axis titles and text
  }
  
  # drop nulls
  plots <- purrr::compact(plots)
  
  # Combine all plots into a grid
  combined_plot <- wrap_plots(plots) + 
    plot_layout(ncol = 4) +  # Adjust ncol to set number of columns in the grid
    plot_annotation(
      title = "Depth (blue) and Pressure (red)",
      subtitle = "Each panel represents a different station",
      caption = "Time Elapsed (x-axis) vs Depth & Pressure (y-axis)"
    ) +
    theme(
      plot.tag = element_text(size = 12, face = "bold"),
      plot.tag.position = "topleft",
      axis.title.x = element_text(margin = margin(t = 10)),
      axis.title.y = element_text(margin = margin(r = 10))
    )
  
  print(combined_plot)
}, error = function(er){
  print(er)
});

plot across all stations
p <- ggplot(cruise_df, aes(x = time, y = depth, fill = station)) +
  geom_col() +  # This creates the bars
  # geom_text(aes(label = station), vjust = -0.3) +  # This adds labels to each bar, adjust vjust for position
  labs(x = "Time", y = "Depth", title = "Depth over Time by Station") +  # Set labels and title
  theme_minimal()  # Use a minimal theme
print(p)

create oce.ctd objects from dataframes
ctd_load <- function(data, other_params = NULL) {
  
  # create csv into ctd object
  test_ctd <-
    as.ctd(
      salinity    = data$sea_water_salinity,
      temperature = data$sea_water_temperature,
      pressure    = data$sea_water_pressure,
      station     = data$station
    )
  
  # add additional columns to ctd object
  if (!is.null(other_params)) {
    for (param_name in other_params) {
      test_ctd <-
        oceSetData(
          object = test_ctd,
          name   = param_name,
          value  = data[[param_name]]
        )
    }
  }
  print(glue("{data$station[1]}:\t{length(test_ctd@data$scan)} scans"))


  return(test_ctd)
}

# Define other parameters to add
other_params <- c(
  "cruise_id", "station", "time", "time_elapsed", 
  "latitude", "longitude", "sea_water_electrical_conductivity", 
  "CDOM", "dissolved_oxygen","oxygen_saturation", "chlorophyll_concentration", 
  "chlorophyll_fluorescence", "photosynthetically_available_radiation", 
  "beam_attenuation","beam_transmission", "depth", "sea_water_sigma_t",
  "descent_rate", "sound_velocity","altimeter"
)

# Split data by station and create data list
ctd_FK <- cruise_df %>%
  split(.$station) %>%
  map(~ ctd_load(.x, other_params = other_params)) # ~ is a lambda(x)
.006_5: 7772 scans
.007:   2435 scans
.010:   89 scans
.012:   4880 scans
.016:   2678 scans
.018:   4330 scans
.02:    2592 scans
.03:    4489 scans
.030:   5316 scans
.031:   3472 scans
.033:   2922 scans
.041:   2540 scans
.045:   2945 scans
.047:   2890 scans
.049:   21 scans
.051:   2626 scans
.053:   1462 scans
.054:   263 scans
.055:   2816 scans
.056:   3008 scans
.057:   3061 scans
.057_1: 2557 scans
.057_2: 3079 scans
.057_3: 3090 scans
.058:   3267 scans
.060:   3379 scans
.064:   75 scans
.065:   170 scans
.068:   3054 scans
.09:    4631 scans
.09_5:  9529 scans
.21LK:  5318 scans
.AMI1:  2649 scans
.AMI2:  3702 scans
.AMI3:  3783 scans
.AMI4:  4402 scans
.AMI5:  5974 scans
.AMI6:  4733 scans
.AMI7:  4527 scans
.AMI8:  4414 scans
.AMI9:  5509 scans
.BG1:   2905 scans
.BG2:   3330 scans
.BG3:   3503 scans
.BG4:   3822 scans
.CAL1:  2522 scans
.CAL2:  3038 scans
.CAL3:  3021 scans
.CAL4:  3058 scans
.CAL5:  3663 scans
.CAL6:  4525 scans
.EK_IN: 2736 scans
.EK_MID:    2583 scans
.EK_OFF:    4189 scans
.GP5:   4239 scans
.KW1:   3043 scans
.KW2:   3222 scans
.KW4:   3975 scans
.MR:    5130 scans
.RP1:   2674 scans
.RP2:   2992 scans
.RP3:   3006 scans
.RP4:   3284 scans
.TB1:   2765 scans
.TB10:  5235 scans
.TB2:   3147 scans
.TB3:   3714 scans
.TB4:   3818 scans
.TB5:   4079 scans
.V1:    2773 scans
.V2:    3260 scans
.V3:    3631 scans
.V4:    3965 scans
.V5:    4663 scans
.V6:    4003 scans
.V7:    4883 scans
.V8:    6137 scans
.V9:    4846 scans
.WS:    4022 scans
plotting scans for each cast in the first list
for (i in seq(ctd_FK)){
  cast <- ctd_FK[[i]]  # 1 is selecting only the first sublist
  # print(i)
  print(glue("=== station: {cast@metadata$station[1]}"))
  print(glue("# scans: {length(cast@data$scan)}"))
  plotScan(cast)
}
=== station: .006_5
# scans: 7772

=== station: .007
# scans: 2435

=== station: .010
# scans: 89

=== station: .012
# scans: 4880

=== station: .016
# scans: 2678

=== station: .018
# scans: 4330

=== station: .02
# scans: 2592

=== station: .03
# scans: 4489

=== station: .030
# scans: 5316

=== station: .031
# scans: 3472

=== station: .033
# scans: 2922

=== station: .041
# scans: 2540

=== station: .045
# scans: 2945

=== station: .047
# scans: 2890

=== station: .049
# scans: 21

=== station: .051
# scans: 2626

=== station: .053
# scans: 1462

=== station: .054
# scans: 263

=== station: .055
# scans: 2816

=== station: .056
# scans: 3008

=== station: .057
# scans: 3061

=== station: .057_1
# scans: 2557

=== station: .057_2
# scans: 3079

=== station: .057_3
# scans: 3090

=== station: .058
# scans: 3267

=== station: .060
# scans: 3379

=== station: .064
# scans: 75

=== station: .065
# scans: 170

=== station: .068
# scans: 3054

=== station: .09
# scans: 4631

=== station: .09_5
# scans: 9529

=== station: .21LK
# scans: 5318

=== station: .AMI1
# scans: 2649

=== station: .AMI2
# scans: 3702

=== station: .AMI3
# scans: 3783

=== station: .AMI4
# scans: 4402

=== station: .AMI5
# scans: 5974

=== station: .AMI6
# scans: 4733

=== station: .AMI7
# scans: 4527

=== station: .AMI8
# scans: 4414

=== station: .AMI9
# scans: 5509

=== station: .BG1
# scans: 2905

=== station: .BG2
# scans: 3330

=== station: .BG3
# scans: 3503

=== station: .BG4
# scans: 3822

=== station: .CAL1
# scans: 2522

=== station: .CAL2
# scans: 3038

=== station: .CAL3
# scans: 3021

=== station: .CAL4
# scans: 3058

=== station: .CAL5
# scans: 3663

=== station: .CAL6
# scans: 4525

=== station: .EK_IN
# scans: 2736

=== station: .EK_MID
# scans: 2583

=== station: .EK_OFF
# scans: 4189

=== station: .GP5
# scans: 4239

=== station: .KW1
# scans: 3043

=== station: .KW2
# scans: 3222

=== station: .KW4
# scans: 3975

=== station: .MR
# scans: 5130

=== station: .RP1
# scans: 2674

=== station: .RP2
# scans: 2992

=== station: .RP3
# scans: 3006

=== station: .RP4
# scans: 3284

=== station: .TB1
# scans: 2765

=== station: .TB10
# scans: 5235

=== station: .TB2
# scans: 3147

=== station: .TB3
# scans: 3714

=== station: .TB4
# scans: 3818

=== station: .TB5
# scans: 4079

=== station: .V1
# scans: 2773

=== station: .V2
# scans: 3260

=== station: .V3
# scans: 3631

=== station: .V4
# scans: 3965

=== station: .V5
# scans: 4663

=== station: .V6
# scans: 4003

=== station: .V7
# scans: 4883

=== station: .V8
# scans: 6137

=== station: .V9
# scans: 4846

=== station: .WS
# scans: 4022

plotting each cast in the first list
for (i in seq(ctd_FK)){
  cast <- ctd_FK[[i]]  # 1 is selecting only the first sublist
  tryCatch({
    plot(ctdDecimate(ctdTrim(cast)))
  }, error = function(e){
    print(e)
  })
}

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 7772' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 2435' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 89' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 4880' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 2678' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 4330' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 2592' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 4489' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 5316' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3472' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 2922' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 2540' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 2945' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 2890' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 2626' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 1462' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 2816' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3008' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3061' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 2557' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3079' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3090' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3267' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3379' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3054' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 4631' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 9529' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 5318' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 2649' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3702' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3783' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 4402' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 5974' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 4733' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 4527' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 4414' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 5509' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 2905' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3330' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3503' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3822' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 2522' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3038' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3021' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3058' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3663' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 4525' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 2736' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 2583' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 4189' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 4239' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3043' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3222' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3975' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 5130' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 2674' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 2992' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3006' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3284' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 2765' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 5235' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3147' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3714' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3818' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 4079' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 2773' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3260' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3631' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 3965' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 4663' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 4003' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 4883' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 6137' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 4846' in coercion to 'logical(1)'>

<simpleError in !is.null(x@metadata$station) && !is.na(x@metadata$station): 'length = 4022' in coercion to 'logical(1)'>
plotting other physical parameters for each cast
# Loop through each CTD cast
for (i in seq(ctd_FK)){
  cast <- ctd_FK[[i]]  # Assuming each sublist contains only one relevant CTD object
  tryCatch({
    # Extract metadata for station name and cruise ID
    station_name <- cast@metadata$station[1]
    cruise_id <- cast@data$cruise_id[1]

    # Generate a title with station name and cruise ID
    overall_title <- glue::glue("Station: {station_name}, Cruise ID: {cruise_id}")

    # Set margins: increase the outer margin for the title
    par(oma = c(0, 0, 3, 0))  # Top outer margin increased for title

    # Plotting function with specific parameters
    oce::plot(
      x = ctdDecimate(ctdTrim(cast)),
      which = c(
        "sea_water_electrical_conductivity",
        "descent_rate", "sound_velocity",
        "sea_water_sigma_t","altimeter"
      ),
      main = ""  # No main title for individual subplots
    )

    # Place a single overall title at the top of the plot frame
    mtext(overall_title, side = 3, line = 1, outer = TRUE, cex = 1.5)

    # Reset outer margins to default
    par(oma = c(0, 0, 0, 0))

  }, error = function(e) {
    print(e$message)  # Print any errors that occur during plotting
  })
}

[1] "need finite 'xlim' values"
[1] "need finite 'xlim' values"
[1] "need finite 'xlim' values"
[1] "need finite 'xlim' values"
[1] "need finite 'xlim' values"
[1] "need finite 'xlim' values"
plotting other nutrient parameters for each cast
# Loop through each CTD cast
for (i in seq(ctd_FK)){
  cast <- ctd_FK[[i]]  # Assuming each sublist contains only one relevant CTD object
  tryCatch({
    # Extract metadata for station name and cruise ID
    station_name <- cast@metadata$station[1]
    cruise_id <- cast@data$cruise_id[1]

    # Generate a title with station name and cruise ID
    overall_title <- glue::glue("Station: {station_name}, Cruise ID: {cruise_id}")

    # Set margins: increase the outer margin for the title
    par(oma = c(0, 0, 3, 0))  # Top outer margin increased for title

    # Plotting function with specific parameters
    oce::plot(
      x = ctdDecimate(ctdTrim(cast)),
      which = c(
        "CDOM", "dissolved_oxygen",
        "oxygen_saturation",
        "chlorophyll_concentration", "chlorophyll_fluorescence"
      ),
      main = ""  # No main title for individual subplots
    )

    # Place a single overall title at the top of the plot frame
    mtext(overall_title, side = 3, line = 1, outer = TRUE, cex = 1.5)

    # Reset outer margins to default
    par(oma = c(0, 0, 0, 0))

  }, error = function(e) {
    print(e$message)  # Print any errors that occur during plotting
  })
}

[1] "need finite 'xlim' values"
[1] "need finite 'xlim' values"
plotting other optical parameters for each cast
# Loop through each CTD cast
for (i in seq(ctd_FK)){
  cast <- ctd_FK[[i]]  # Assuming each sublist contains only one relevant CTD object
  tryCatch({
    # Extract metadata for station name and cruise ID
    station_name <- cast@metadata$station[1]
    cruise_id <- cast@data$cruise_id[1]

    # Generate a title with station name and cruise ID
    overall_title <- glue::glue("Station: {station_name}, Cruise ID: {cruise_id}")

    # Set margins: increase the outer margin for the title
    par(oma = c(0, 0, 3, 0))  # Top outer margin increased for title

    # Plotting function with specific parameters
    oce::plot(
      x = ctdDecimate(ctdTrim(cast)),
      which = c(
        "photosynthetically_available_radiation",
        "beam_attenuation","beam_transmission"
      ),
      main = ""  # No main title for individual subplots
    )

    # Place a single overall title at the top of the plot frame
    mtext(overall_title, side = 3, line = 1, outer = TRUE, cex = 1.5)

    # Reset outer margins to default
    par(oma = c(0, 0, 0, 0))

  }, error = function(e) {
    print(e$message)  # Print any errors that occur during plotting
  })
}

[1] "need finite 'xlim' values"
[1] "need finite 'xlim' values"
loop through every cast, clean, & save
combined_df <- data.frame()
for (i in seq(ctd_FK)){
  tryCatch({
    cast <- ctd_FK[[i]]  # 1 is selecting only the first sublist
    
    # print(class(cast))
    # clean cast 
    trimmed_cast <- ctdTrim(cast)
    decimated_cast <- ctdDecimate(trimmed_cast, p = 0.5)  # binned to 0.5 m
    
    # convert to df
    cast_df <- as.data.frame(decimated_cast@data)
    
    # Add metadata
    # assumes station ID and cruise ID the same for all & just uses 1st one
    cast_df <- mutate(
      cast_df,
      station = cast@data$station[1],
      cruise_id = cast@data$cruise_id[1]
    )
  
    # drop NA rows left by cleaning
    cast_df <- subset(cast_df, !is.na(scan))
    
    # Append the data to the combined dataframe
    combined_df <- rbind(combined_df, cast_df)
  }, error = function(e){
    print(glue("error in cast {cast@metadata$station[1]}"))
    print(e)
  })
}
# Save to CSV
file_path <- here(glue("data/cleaned/{cruise_id}.csv"))
write.csv(combined_df, file_path, row.names = FALSE)