Last updated: 2024-05-16
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 fbf0c64. 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:
Modified: analysis/CESM_comparison.Rmd
Deleted: analysis/MHWs_categorisation.Rmd
Modified: analysis/_site.yml
Modified: analysis/anomaly_SST_2023.Rmd
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 | fbf0c64 | mlarriere | 2024-05-16 | latitude, longitude and day of the month graphs |
html | 22e0206 | mlarriere | 2024-05-16 | Build site. |
Rmd | d0f58b6 | mlarriere | 2024-05-16 | latitude, longitude and day of the month graphs |
html | 96d4b76 | mlarriere | 2024-05-14 | Build site. |
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 |
Focusing on 2023 Only core Argo - focus on temperature anomalies
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.
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)
#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 = ""))
#Histogram -- number of floats per month and biome
unique_platforms_per_month <- core_anomaly_with_platform_2023 %>%
group_by(month) %>%
summarize(unique_platforms = n_distinct(platform_number))
hist <- ggplot(unique_platforms_per_month, aes(x = factor(month), y = unique_platforms)) +
geom_bar(stat = "identity", fill = "darkred") +
labs(title = "Amount of platform per month, in North Atlantic, 2023",
x = "Months", y = "Number of argo floats", fill = "Biomes") +
theme_minimal() +
guides(fill = FALSE)
# scale_fill_manual(values = c("1" = "#1034A6", "2" = "#f59c04", "3" = "darkred"),
# labels = c("1" = "SPSS", "2" = "STSS", "3" = "STPS")) +
# theme_minimal()
print(hist)
#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)
#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)
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)))
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(title= "Area of interest: east", 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
unique_platform<-heatwaves_data_east %>%
filter(platform_number==6903067 )
ggplot(unique_platform, aes(x = anomaly, y = depth, color = factor(cycle_number))) +
geom_path() +
geom_vline(xintercept = 0) +
scale_y_reverse() +
coord_cartesian(xlim = c(-6, 6), ylim = c(200, 0)) +
labs(title = 'Anomaly profiles by month',
subtitle= paste0('Platform ', unique(unique_platform$platform_number)),
x = 'Temperature (°C)', y = 'Depth (m)', color = 'Cycle Number') +
scale_color_viridis(discrete = TRUE) +
facet_wrap(~month, scales = "free", ncol = 3)
unique_platform_base_map<- base_map + lims(x=c(-30,-10), y=c(0,20))
unique_coords_with_cycles <- unique_platform %>%
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 <- unique_platform_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"))
#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, cycle_number) %>%
summarise(
temp_count = n(),
temp_anomaly_mean = mean(anomaly, na.rm = TRUE)
)
# Longitude - gradient north-south
ggplot(anomaly_lat_lon, aes(x = temp_anomaly_mean, y = depth, group = interaction(platform_number, cycle_number), color = as.numeric(lon))) +
geom_path() +
geom_vline(xintercept = 0) +
scale_y_reverse(limits = c(200, 0)) +
coord_cartesian(xlim = c(-6, 6)) +
facet_wrap(~ month, ncol = 3) +
labs(title = "Anomaly Profiles for all longitudes",
subtitle = "All floats and cycles included",
x = "Temperature (°C)", y = "Depth (m)", color = "Longitude") +
scale_color_viridis_c()
# Latitude - gradient west-east
ggplot(anomaly_lat_lon, aes(x = temp_anomaly_mean, y = depth, group = interaction(platform_number, cycle_number), color = as.numeric(lat))) +
geom_path() +
geom_vline(xintercept = 0) +
scale_y_reverse(limits = c(200, 0)) +
coord_cartesian(xlim = c(-6, 6)) +
facet_wrap(~ month, ncol = 3) +
labs(title = "Anomaly Profile for all latitudes",
subtitle = "All floats and cycles included",
x = "Temperature (°C)", y = "Depth (m)", color = "Latitude") +
scale_color_viridis_c()
Version | Author | Date |
---|---|---|
22e0206 | mlarriere | 2024-05-16 |
# calculate mean anomaly data
anomaly_summary <- heatwaves_data_east %>%
group_by(platform_number, depth, month, cycle_number, SST_anomaly) %>%
summarise(
temp_count = n(),
temp_anomaly_mean = mean(anomaly, na.rm = TRUE)
)
#plot for the SST anomalies
ggplot(anomaly_summary, aes(x = temp_anomaly_mean, y = depth, group = interaction(platform_number, cycle_number), color = as.numeric(SST_anomaly))) +
geom_path() +
geom_vline(xintercept = 0) +
scale_y_reverse(limits = c(200, 0)) +
coord_cartesian(xlim = c(-6, 6)) +
facet_wrap(~ month, ncol = 3) +
labs(title = "Mean Anomaly Profile",
x = "Temperature (°C)", y = "Depth (m)", color = "SST Anomaly") +
scale_color_viridis_c()
# calculate mean anomaly data
anomaly_summary_day <- heatwaves_data_east %>%
group_by(platform_number, depth, month, cycle_number, day) %>%
summarise(
temp_count = n(),
temp_anomaly_mean = mean(anomaly, na.rm = TRUE)
)
#plot for time during month
ggplot(anomaly_summary_day, aes(x = temp_anomaly_mean, y = depth, group = interaction(platform_number, cycle_number), color = as.numeric(day))) +
geom_path() +
geom_vline(xintercept = 0) +
scale_y_reverse(limits = c(200, 0)) +
coord_cartesian(xlim = c(-6, 6)) +
facet_wrap(~ month, ncol = 3) +
labs(title = "Mean Anomaly Profile",
x = "Temperature (°C)", y = "Depth (m)", color = "day within the month") +
scale_color_viridis_c()
# 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)
}
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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)') +
guides(color = FALSE)+
facet_wrap(~month)
print(anomaly_plot_monthly)
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