Site icon R-bloggers

Acidification

[This article was first published on r.iresmi.net, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Coral bleaching at Heron Island – CC BY by The Ocean Agency / XL Catlin Seaview Survey / Richard Vevers

Day 20 of 30DayMapChallenge: « Water » (previously).

Global ocean acidification mean sea water pH trend map from Multi-Observations Reprocessing from Copernicus.

< section id="data" class="level2">

Data

library(sf)
library(ggplot2)
library(rnaturalearth)
library(glue)
library(terra)
library(ggspatial)

eqearth <- "EPSG:8857"

world <- ne_countries() |> 
  st_transform(eqearth)

mask <- c(xmin = -179, ymin = -89, xmax = 179,  ymax = 89) |> 
  st_bbox() |> 
  st_as_sfc() |> 
  st_set_crs("EPSG:4326") |> 
  st_sf() |> 
  st_segmentize(100) |> 
  st_transform(eqearth) 

acid_trend <- "global_omi_health_carbon_ph_trend_1985_P20230930.nc" |> 
  rast() |> 
  rotate() |> 
  project(eqearth) |> 
  mask(mask)
< section id="map" class="level2">

Map

world |>
  ggplot() +
  layer_spatial(data = acid_trend,
                aes(fill = after_stat(band1))) +
  geom_sf(data = mask) +
  geom_sf(color = "grey", fill = "white") +
  scale_fill_viridis_c(name = bquote(Delta*pH~yr^-1), 
                       direction = -1, 
                       na.value = "white") +
  labs(title = "Global ocean acidification",
       subtitle = "mean sea water pH trend",
       caption = glue("data: Copernicus / LSCE doi:10.48670/moi-00277
                      Natural Earth - {st_crs(eqearth)$Name}
                      https://r.iresmi.net - {Sys.Date()}")) +
  theme_void() +
  theme(plot.caption = element_text(size = 7, color = "grey40"),
        plot.margin = unit(c(.2, .2, .2, .2), units = "cm"),
        legend.position = "bottom",
        legend.text = element_text(angle = 45, vjust = 1, hjust = 1))
Figure 1: Global ocean acidification – mean sea water pH trend
< !-- -->
To leave a comment for the author, please follow the link and comment on their blog: r.iresmi.net.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Exit mobile version