Last updated: 2024-05-14

Checks: 7 0

Knit directory: bgc_argo_r_argodata/analysis/

This reproducible R Markdown analysis was created with workflowr (version 1.7.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20211008) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 91e6028. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rproj.user/

Untracked files:
    Untracked:  analysis/draft.Rmd
    Untracked:  load_argo_core_output.txt

Unstaged changes:
    Deleted:    analysis/MHWs_categorisation.Rmd
    Modified:   analysis/_site.yml
    Modified:   analysis/child/cluster_analysis_base.Rmd
    Modified:   analysis/coverage_maps_North_Atlantic.Rmd
    Modified:   analysis/load_broullon_DIC_TA_clim.Rmd
    Modified:   code/Workflowr_project_managment.R
    Modified:   code/start_background_job.R
    Modified:   code/start_background_job_load.R
    Modified:   code/start_background_job_partial.R

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/MHWs_vertical_anomaly.Rmd) and HTML (docs/MHWs_vertical_anomaly.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 91e6028 mlarriere 2024-05-13 adding subsection CESM comparison
html af6594f mlarriere 2024-05-13 Build site.
Rmd 30f9250 mlarriere 2024-05-13 Adding CESM subsection

Task

Focusing on 2023 Only core Argo - focus on temperature anomalies

Dependencies

temp_core_va.rds - temperature of core argo floats after vertical alignment.

core_metadata.rds - File with metadata concerning the floats such as platform number, cycle number, date, lat, lon and quality control results.

temp_anomaly_va.rds - file containing the temperature anomalies (temp core - climatology).

2023_mhw_raw.csv - CSV file containing the categorization of surface marine heatwaves, in 2023 and in a 0.25°x0.25° grid.

Outputs

2023_surface_mhws_1x1.rds - file containing the categorization of surface marine heatwaves in a 1°x1° grid, in 2023.

path_emlr_utilities <- "/nfs/kryo/work/jenmueller/emlr_cant/utilities/files/"
path_basin_mask <- "/nfs/kryo/work/datasets/gridded/ocean/interior/reccap2/supplementary/"
path_argo <- '/nfs/kryo/work/datasets/ungridded/3d/ocean/floats/bgc_argo'
path_argo_core <- '/nfs/kryo/work/datasets/ungridded/3d/ocean/floats/core_argo_r_argodata_2024-03-13'

path_argo_core_preprocessed <- paste0(path_argo_core, "/preprocessed_core_data")

path_mhw<- '/net/kryo/work/datasets/gridded/ocean/2d/obs/mhw'
opt_xbreaks <- c(-4, -2, 0, 2, 4)

# Define colors palette to match ~ color of ClimateReanalyser (for comparison)
colors <- c("lavender", "#9867C5", "darkblue", "lightblue", "white", "orange", "darkred", "red", "#FFCBCB")
palette <- colorRampPalette(colors)
n <- 20 #number of colors 
continuous_palette <- palette(n) #continuous color palette
scale_limits <- c(-10, 10)
scale_breaks <- seq(scale_limits[1], scale_limits[2], length.out = n + 1)

Load data

Load biomes

Load Argo floats data

Load SST anomaly

#Read SST anomaly, computed using climatology:2009-2019 (from anomaly_SST_2023.Rmd)
sst_anomaly_northAtlantic<- read_rds(paste(path_argo_core_preprocessed, "/SST_anomaly2023_NorthAtlantic_clim2004-2019.rds", sep = ""))

Argo floats

Distribution over North Atlantic basin

#Histogram -- number of floats per month and biome
unique_platforms_per_month <- core_anomaly_with_platform_2023 %>%
   group_by(month, biome_value) %>%
  filter(!is.na(biome_value)) %>% 
   summarize(unique_platforms = n_distinct(platform_number))

 hist <- ggplot(unique_platforms_per_month, aes(x = factor(month), y = unique_platforms, fill=factor(biome_value))) +
      geom_bar(stat = "identity")+#, position = "dodge") +
      labs(title= paste0("Amount of platform per month and per biome, in 2023"), 
           x = "Months", y = "Number of argo floats", fill = "Biomes") +
      scale_fill_manual(values = c("1" = "#1034A6", "2" = "#f59c04", "3" = "darkred"),
                    labels = c("1" = "SPSS", "2" = "STSS", "3" = "STPS")) +
      theme_minimal()

print(hist)

Version Author Date
af6594f mlarriere 2024-05-13
#Number of cycle per platform
cycle_counts <- core_anomaly_with_platform_2023 %>%
  group_by(platform_number) %>%
  summarise(cycle_count = n_distinct(cycle_number))
print(cycle_counts)
# A tibble: 752 × 2
   platform_number cycle_count
   <chr>                 <int>
 1 1901730                  37
 2 1901731                  37
 3 1902073                  35
 4 1902180                  22
 5 1902181                  27
 6 1902208                  37
 7 1902299                  37
 8 1902300                  36
 9 1902301                  37
10 1902302                  37
# ℹ 742 more rows
#Join the SST anomaly with the anomaly profiles
core_anomaly_with_platform_2023<-core_anomaly_with_platform_2023 %>% 
  filter(!is.na(depth)) %>% 
  select(-profile_range, -day_of_year, -clim_temp, -biome_value  )

complete_anomaly_profile<- core_anomaly_with_platform_2023 %>%
  inner_join(sst_anomaly_northAtlantic, by = c("lat", "lon", "month"))

#Floats present during heatwaves
# East
heatwaves_data_east<-complete_anomaly_profile %>% 
  group_by(month) %>% 
  filter(lat>0, lat<40, lon>-30, 0>lon)

cycles_per_platform <-heatwaves_data_east %>%
  group_by(platform_number) %>%
  summarize(unique_cycles = toString(unique(cycle_number)))

months_per_float <- heatwaves_data_east %>%
  group_by(platform_number) %>%
  summarize(unique_months = toString(unique(month)))

Distribution over East-North Atlantic

Using the SST map computed in “anomaly_SST_2023.Rmd” and ClimateReanalyser, we identify 2 areas of particular interest for SST anomalies in 2023 in the North Atlantic Ocean:

  • Northeast, near the Canada/USA coast. SST anomaly particularly strong in summer and autumn (JJA and SON).

  • East coast of the North Atlantic Ocean. Here, SST anomalies are high on an annual basis, with a sharp increase from June onwards.

#PLatfrom in the east north atlantic over 2023
platform_counts <- aggregate(platform_number ~ month, data = heatwaves_data_east, FUN = function(x) length(unique(x)))
cycle_count_per_platform_month <- heatwaves_data_east %>%
  group_by(month, platform_number) %>%
  summarise(cycle_count = n_distinct(cycle_number))

#Annual hotspot (+MAM + JJA + a bit SON) in agreement with climate reanaliser 
east_base_map<- base_map + lims(x=c(-30,0), y=c(0,40))
east_sst_anomaly<-sst_anomaly_northAtlantic %>% 
  filter(lat>0, lat<40, lon>-30, 0>lon)

# Tiles for SST anomaly
map_anomaly_east <- 
  east_base_map + 
  geom_tile(data=east_sst_anomaly, aes(x = lon, y = lat, fill = SST_anomaly)) +
  scale_fill_gradientn(colors = continuous_palette, limits = scale_limits, breaks = scale_breaks) +
  labs(fill = "SST Anomaly") +
  theme_minimal()

custom_labeller <- function(variable, value) {
  month_count <- platform_counts[platform_counts$month == value, "platform_number"]
  return(paste("Month:", value, "\nnumber of floats:", month_count))
}

platform_positions <- map_anomaly_east +
  geom_point(data = heatwaves_data_east, aes(x = lon, y = lat), color = "dodgerblue3") +
  labs(title = "Platform Locations") +  
  facet_wrap(~month, ncol = 3, labeller = custom_labeller)

platform_positions

Version Author Date
af6594f mlarriere 2024-05-13

Anomaly profiles

Individual float

platform_6903067<-heatwaves_data_east %>% 
  filter(platform_number==6903067)
custom_palette <- c("#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b",
                    "#e377c2", "#7f7f7f", "#bcbd22", "#17becf", "#aec7e8", "#ffbb78")
ggplot(platform_6903067, aes(x = anomaly, y = depth, color = factor(month))) +
  geom_path() +
  geom_vline(xintercept = 0) +
  scale_y_reverse() +
  coord_cartesian(xlim = c(-4, 4), ylim = c(200, 0)) +
  labs(title = 'Anomaly profiles by month',
       subtitle= '1 subplot per cycle',
       x = 'Temperature (°C)', y = 'Depth (m)', color = 'Month') +
  scale_color_manual(values = custom_palette) + 
  facet_wrap(~cycle_number, scales = "free_x", ncol = 5)

Version Author Date
af6594f mlarriere 2024-05-13
platform_6903067_base_map<- base_map + lims(x=c(-20,-10), y=c(10,20))

unique_coords_with_cycles <- platform_6903067 %>%
  distinct(lat, lon, .keep_all = TRUE) %>%
  group_by(lat, lon) %>%
  summarise(cycle_numbers = toString(unique(cycle_number)))

#base map and SST anomaly
map_anomaly_east <- platform_6903067_base_map + 
  geom_tile(data = east_sst_anomaly, aes(x = lon, y = lat, fill = SST_anomaly)) +
  scale_fill_gradientn(colors = continuous_palette, limits = scale_limits, breaks = scale_breaks) +
  labs(fill = "SST Anomaly") +
  theme_minimal()

#trajetory
map_anomaly_east + 
  geom_point(data = unique_coords_with_cycles, aes(x = lon, y = lat, color = cycle_numbers), size = 2) +
  scale_color_discrete(name = "Cycle Number", guide = guide_legend(title.position = "top")) +
  labs(title = 'Float position') +
  theme(legend.position = "bottom")+
    guides(fill = guide_colorbar(barwidth = 20, barheight = 1, title.position = "top"))

Version Author Date
af6594f mlarriere 2024-05-13

Coloring by lat/lon

#Calculating monthly mean anomaly + std for each lat/lon pair of the area
anomaly_lat_lon <- heatwaves_data_east %>%
  group_by(lat, lon, depth, month, platform_number) %>%
  summarise(
    temp_count = n(),
    temp_anomaly_mean = mean(anomaly, na.rm = TRUE),
    temp_anomaly_sd = sd(anomaly, na.rm = TRUE)
  )


ggplot(anomaly_lat_lon, aes(x = temp_anomaly_mean, y = depth)) +
  geom_path(aes(color = factor(month))) +
  geom_ribbon(aes(xmax = temp_anomaly_mean + temp_anomaly_sd,
                  xmin = temp_anomaly_mean - temp_anomaly_sd,
                  y = depth), alpha = 0.2) +
  geom_vline(xintercept = 0) +
  scale_y_reverse(limits = c(200, 0)) +
  coord_cartesian(xlim = c(-4, 4)) +
  facet_grid(lat ~ lon, scales = "free", space = "free") +
  labs(title = "Mean Anomaly Profile for Latitude and Longitude",
       x = "Temperature (°C)", y = "Depth (m)") +
  theme_minimal() +
  scale_color_discrete(name = "Month") +
  guides(color = guide_legend(override.aes = list(alpha = 1)))

Version Author Date
af6594f mlarriere 2024-05-13
# filter specific lat for better visualisation
specific_anomaly_lat <- anomaly_lat_lon %>%
  filter(lat == 7.5)

ggplot(specific_anomaly_lat, aes(x = temp_anomaly_mean, y = depth)) +
  geom_path(aes(color = factor(month))) +
  geom_vline(xintercept = 0) +
  scale_y_reverse(limits = c(200, 0)) +
  coord_cartesian(xlim = c(-4, 4)) +
  facet_wrap(~ lon, scales = "free", ncol = 2) +
  labs(title = paste0("Mean Anomaly Profile for Latitude ", unique(specific_anomaly_lat$lat), " and Different Longitudes"),
       x = "Temperature (°C)", y = "Depth (m)") +
  scale_color_discrete(name = "Month") +
  guides(color = guide_legend(override.aes = list(alpha = 1)))

Version Author Date
af6594f mlarriere 2024-05-13

Coloring by SST anomaly

# Define category breaks and labels for SST anomaly
anomaly_categories <- list(
  list(label = "(-0.5, 0)", filter = quote(SST_anomaly < 0 & SST_anomaly > -0.5)),
  list(label = "(0, 0.5)", filter = quote(SST_anomaly > 0 & SST_anomaly < 0.5)),
  list(label = "(0.5, 1)", filter = quote(SST_anomaly > 0.5 & SST_anomaly < 1)),
  list(label = "(1, 1.5)", filter = quote(SST_anomaly > 1 & SST_anomaly < 1.5)),
  list(label = "(1.5, 2)", filter = quote(SST_anomaly > 1.5 & SST_anomaly < 2)),
  list(label = "> 2", filter = quote(SST_anomaly > 2))
)

generate_plot <- function(category) {
  # filter data
  anomaly_data <- heatwaves_data_east %>% filter(eval(category$filter))
  
  # calculate mean anomaly data
  anomaly_summary <- anomaly_data %>%
    group_by(platform_number, depth, month) %>%
    summarise(
      temp_count = n(),
      temp_anomaly_mean = mean(anomaly, na.rm = TRUE)
    )
  
  num_floats <- n_distinct(anomaly_summary$platform_number)
  num_cycles <- n_distinct(anomaly_summary$month)
  
  #plot for the current category
  ggplot(anomaly_summary, aes(x = temp_anomaly_mean, y = depth)) +
    geom_path(aes(color = factor(month))) +
    geom_vline(xintercept = 0) +
    scale_y_reverse(limits = c(200, 0)) +
    coord_cartesian(xlim = c(-4, 4)) +
    labs(title = "Mean Anomaly Profile",
         subtitle = paste("Floats having SST anomaly falls within the range", category$label,                                                    "\nNumber of floats:", num_floats),
         x = "Temperature (°C)", y = "Depth (m)") +
    scale_color_discrete(name = "Month") +
    guides(color = guide_legend(override.aes = list(alpha = 1))) +
    theme_bw() +
    facet_wrap(~ month, scales = "free", ncol = 2)
}

plots <- lapply(anomaly_categories, generate_plot)
plots
[[1]]

Version Author Date
af6594f mlarriere 2024-05-13

[[2]]

Version Author Date
af6594f mlarriere 2024-05-13

[[3]]

Version Author Date
af6594f mlarriere 2024-05-13

[[4]]

Version Author Date
af6594f mlarriere 2024-05-13

[[5]]

Version Author Date
af6594f mlarriere 2024-05-13

[[6]]

Version Author Date
af6594f mlarriere 2024-05-13
# anomaly_SST_cat2 <- heatwaves_data_east %>% filter(SST_anomaly<0, SST_anomaly>-0.5) # SST anomaly falls within the range (-0.5, 0)
# anomaly_SST_cat3 <- heatwaves_data_east %>% filter(SST_anomaly>0, SST_anomaly<0.5) # SST anomaly falls within the range (0, 0.5)
# anomaly_SST_cat4 <- heatwaves_data_east %>% filter(SST_anomaly>0.5, SST_anomaly<1)# SST anomaly falls within the range (0.5, 1)
# anomaly_SST_cat5 <- heatwaves_data_east %>% filter(SST_anomaly>1, SST_anomaly<1.5)# SST anomaly falls within the range (1, 1.5)
# anomaly_SST_cat6 <- heatwaves_data_east %>% filter(SST_anomaly>1.5, SST_anomaly<2)# SST anomaly falls within the range (1.5, 2)
# anomaly_SST_cat7 <- heatwaves_data_east %>% filter(SST_anomaly>2) #SST anomaly is greater than 2

Monthly anomaly profiles

#Comparison 1st and 2nd half of the month

heatwaves_data_east <- heatwaves_data_east %>%
  mutate(day = as.numeric(as.character(day)))
# create datasets for the 1st and second half of each month
first_half <- heatwaves_data_east %>% filter(day < 15)
second_half <- heatwaves_data_east %>% filter(day >= 15)

create_anomaly_profile <- function(data, subtitle) {
  data %>%
    group_by(depth, month) %>%
    summarise(temp_count = n(),
              temp_anomaly_mean = mean(anomaly, na.rm = TRUE),
              temp_anomaly_sd = sd(anomaly, na.rm = TRUE)) %>%
    ggplot(aes(x = temp_anomaly_mean, y = depth, color = factor(month))) +
    geom_path() +
    geom_ribbon(aes(xmax = temp_anomaly_mean + temp_anomaly_sd,
                    xmin = temp_anomaly_mean - temp_anomaly_sd,
                    y = depth), alpha = 0.2) +
    geom_vline(xintercept = 0) +
    scale_y_reverse() +
    coord_cartesian(xlim = c(-4, 4), ylim = c(200, 0)) +
    scale_x_continuous(breaks = opt_xbreaks) +
    labs(title = 'Monthly anomaly profile',
         subtitle = subtitle,
         x = 'Temperature (°C)', y = 'Depth (m)') +
    theme_minimal() +
    guides(color = FALSE) +
    facet_wrap(~month)
}

plot_first_half <- create_anomaly_profile(first_half, 
                                          subtitle = "Extent: East\nfrom surface to 200m\nfirst half of the month (day<15)")
plot_second_half <- create_anomaly_profile(second_half, 
                                           subtitle = "Extent: East\nfrom surface to 200m\nsecond half of the month (day>=15)")

plot_first_half

Version Author Date
af6594f mlarriere 2024-05-13
plot_second_half

Version Author Date
af6594f mlarriere 2024-05-13
# datsets with the cycle number per float across months
cycles_per_platform_month<- heatwaves_data_east %>%
  group_by(platform_number, month) %>%
  summarize(unique_cycles = toString(unique(cycle_number)))

# Calculating monthly mean anomaly over the east area by averaging the anomaly of each float present
anomaly_mean <- heatwaves_data_east %>% 
  group_by(depth, month) %>% 
  summarise(temp_count = n(),
            temp_anomaly_mean = mean(anomaly, na.rm = TRUE),
            temp_anomaly_sd = sd(anomaly, na.rm = TRUE))

#For each mont put the SST anomaly next to the anomaly path
for (m in unique(east_sst_anomaly$month)) {
  # Filter data 
  map_data <- filter(east_sst_anomaly, month == m)
  anomaly_data <- filter(anomaly_mean, month == m)

  # Plot for temperature anomaly map
  map_plot <- east_base_map +
      geom_tile(data=map_data, aes(x = lon, y = lat, fill = SST_anomaly)) +
    scale_fill_gradientn(colors = continuous_palette,  limits = scale_limits, breaks = scale_breaks) +
    labs(title = paste("SST Anomaly (°C) in North Atlantic - 2023", month.name[as.numeric(m)]), 
         subtitle = "Extent: East",
         x = "Longitude", y = "Latitude") +
    theme(legend.position = 'right', legend.key.height = unit(2, "cm"))
  
  # Plot for anomaly profiles
  anomaly_plot <- ggplot(anomaly_data, aes(x = temp_anomaly_mean, y = depth, color = factor(month))) +
    geom_path() +
    geom_ribbon(aes(xmax = temp_anomaly_mean + temp_anomaly_sd,
                    xmin = temp_anomaly_mean - temp_anomaly_sd,
                    y = depth), alpha = 0.2) +
    geom_vline(xintercept = 0) +
    scale_y_reverse() +
    coord_cartesian(xlim = c(-4, 4), ylim = c(200, 0)) +
    scale_x_continuous(breaks = opt_xbreaks) +
    labs(title = paste('Associated anomaly profile in', month.name[as.numeric(m)]), 
         subtitle = paste0("from surface to 200m", "\nNumber of platform:",  nrow(filter(cycles_per_platform_month, month==m))),
         x = 'Temperature (°C)', y = 'Depth (m)') +
    theme_minimal()+
        guides(color = FALSE)

  
  #plots side by side
  combined_plot <- grid.arrange(map_plot, anomaly_plot, ncol = 2)
  print(combined_plot)
}

Version Author Date
af6594f mlarriere 2024-05-13
TableGrob (1 x 2) "arrange": 2 grobs
  z     cells    name           grob
1 1 (1-1,1-1) arrange gtable[layout]
2 2 (1-1,2-2) arrange gtable[layout]

Version Author Date
af6594f mlarriere 2024-05-13
TableGrob (1 x 2) "arrange": 2 grobs
  z     cells    name           grob
1 1 (1-1,1-1) arrange gtable[layout]
2 2 (1-1,2-2) arrange gtable[layout]

Version Author Date
af6594f mlarriere 2024-05-13
TableGrob (1 x 2) "arrange": 2 grobs
  z     cells    name           grob
1 1 (1-1,1-1) arrange gtable[layout]
2 2 (1-1,2-2) arrange gtable[layout]

Version Author Date
af6594f mlarriere 2024-05-13
TableGrob (1 x 2) "arrange": 2 grobs
  z     cells    name           grob
1 1 (1-1,1-1) arrange gtable[layout]
2 2 (1-1,2-2) arrange gtable[layout]

Version Author Date
af6594f mlarriere 2024-05-13
TableGrob (1 x 2) "arrange": 2 grobs
  z     cells    name           grob
1 1 (1-1,1-1) arrange gtable[layout]
2 2 (1-1,2-2) arrange gtable[layout]

Version Author Date
af6594f mlarriere 2024-05-13
TableGrob (1 x 2) "arrange": 2 grobs
  z     cells    name           grob
1 1 (1-1,1-1) arrange gtable[layout]
2 2 (1-1,2-2) arrange gtable[layout]

Version Author Date
af6594f mlarriere 2024-05-13
TableGrob (1 x 2) "arrange": 2 grobs
  z     cells    name           grob
1 1 (1-1,1-1) arrange gtable[layout]
2 2 (1-1,2-2) arrange gtable[layout]

Version Author Date
af6594f mlarriere 2024-05-13
TableGrob (1 x 2) "arrange": 2 grobs
  z     cells    name           grob
1 1 (1-1,1-1) arrange gtable[layout]
2 2 (1-1,2-2) arrange gtable[layout]

Version Author Date
af6594f mlarriere 2024-05-13
TableGrob (1 x 2) "arrange": 2 grobs
  z     cells    name           grob
1 1 (1-1,1-1) arrange gtable[layout]
2 2 (1-1,2-2) arrange gtable[layout]

Version Author Date
af6594f mlarriere 2024-05-13
TableGrob (1 x 2) "arrange": 2 grobs
  z     cells    name           grob
1 1 (1-1,1-1) arrange gtable[layout]
2 2 (1-1,2-2) arrange gtable[layout]

Version Author Date
af6594f mlarriere 2024-05-13
TableGrob (1 x 2) "arrange": 2 grobs
  z     cells    name           grob
1 1 (1-1,1-1) arrange gtable[layout]
2 2 (1-1,2-2) arrange gtable[layout]

Version Author Date
af6594f mlarriere 2024-05-13
TableGrob (1 x 2) "arrange": 2 grobs
  z     cells    name           grob
1 1 (1-1,1-1) arrange gtable[layout]
2 2 (1-1,2-2) arrange gtable[layout]
# Vertical anomaly profile for the North atlatinc east region - monthly 
anomaly_plot_monthly <- ggplot(anomaly_mean, aes(x = temp_anomaly_mean, y = depth, color = factor(month))) +
  geom_path() +
  geom_ribbon(aes(xmax = temp_anomaly_mean + temp_anomaly_sd,
                  xmin = temp_anomaly_mean - temp_anomaly_sd,
                  y = depth), alpha = 0.2) +
  geom_vline(xintercept = 0) +
  scale_y_reverse() +
  coord_cartesian(xlim = c(-4, 4), ylim = c(200, 0)) +
  scale_x_continuous(breaks = opt_xbreaks) +
  labs(title = paste('Monthly anomaly profile'), 
       subtitle = paste0("Extent: East", "\nfrom surface to 200m"),
       x = 'Temperature (°C)', y = 'Depth (m)') +
  theme_minimal()+
  guides(color = FALSE)+
  facet_wrap(~month)

print(anomaly_plot_monthly)

Version Author Date
af6594f mlarriere 2024-05-13

sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: openSUSE Leap 15.5

Matrix products: default
BLAS:   /usr/local/R-4.2.2/lib64/R/lib/libRblas.so
LAPACK: /usr/local/R-4.2.2/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] broom_1.0.5          paletteer_1.6.0      cluster_2.1.6       
 [4] gridExtra_2.3        scatterplot3d_0.3-44 viridis_0.6.2       
 [7] viridisLite_0.4.1    ggOceanMaps_1.3.4    ggspatial_1.1.7     
[10] oce_1.7-10           gsw_1.1-1            lubridate_1.9.0     
[13] timechange_0.1.1     forcats_0.5.2        stringr_1.5.0       
[16] dplyr_1.1.3          purrr_1.0.2          readr_2.1.3         
[19] tidyr_1.3.0          tibble_3.2.1         ggplot2_3.4.4       
[22] tidyverse_1.3.2      workflowr_1.7.0     

loaded via a namespace (and not attached):
 [1] googledrive_2.0.0   colorspace_2.0-3    ellipsis_0.3.2     
 [4] class_7.3-20        rprojroot_2.0.3     fs_1.5.2           
 [7] rstudioapi_0.15.0   proxy_0.4-27        farver_2.1.1       
[10] fansi_1.0.3         xml2_1.3.3          codetools_0.2-18   
[13] cachem_1.0.6        knitr_1.41          jsonlite_1.8.3     
[16] dbplyr_2.2.1        rgeos_0.5-9         compiler_4.2.2     
[19] httr_1.4.4          backports_1.4.1     assertthat_0.2.1   
[22] fastmap_1.1.0       gargle_1.2.1        cli_3.6.1          
[25] later_1.3.0         htmltools_0.5.8.1   tools_4.2.2        
[28] gtable_0.3.1        glue_1.6.2          maps_3.4.1         
[31] Rcpp_1.0.10         cellranger_1.1.0    jquerylib_0.1.4    
[34] RNetCDF_2.6-1       raster_3.6-11       vctrs_0.6.4        
[37] lwgeom_0.2-10       xfun_0.35           ps_1.7.2           
[40] rvest_1.0.3         lifecycle_1.0.3     ncmeta_0.3.5       
[43] googlesheets4_1.0.1 terra_1.7-65        getPass_0.2-2      
[46] scales_1.2.1        hms_1.1.2           promises_1.2.0.1   
[49] parallel_4.2.2      rematch2_2.1.2      yaml_2.3.6         
[52] sass_0.4.4          stringi_1.7.8       highr_0.9          
[55] e1071_1.7-12        rlang_1.1.1         pkgconfig_2.0.3    
[58] evaluate_0.18       lattice_0.20-45     sf_1.0-9           
[61] labeling_0.4.2      processx_3.8.0      tidyselect_1.2.0   
[64] magrittr_2.0.3      R6_2.5.1            generics_0.1.3     
[67] DBI_1.2.2           pillar_1.9.0        haven_2.5.1        
[70] whisker_0.4         withr_2.5.0         units_0.8-0        
[73] stars_0.6-0         abind_1.4-5         sp_1.5-1           
[76] modelr_0.1.10       crayon_1.5.2        KernSmooth_2.23-20 
[79] utf8_1.2.2          tzdb_0.3.0          rmarkdown_2.18     
[82] grid_4.2.2          readxl_1.4.1        callr_3.7.3        
[85] git2r_0.30.1        reprex_2.0.2        digest_0.6.30      
[88] classInt_0.4-8      httpuv_1.6.6        munsell_0.5.0      
[91] bslib_0.4.1