Acidification | R bloggers

Acidification | R bloggers

[This article was first published on r.iresmi.net, and kindly contributed to R-bloggers]. (You can report a problem with 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 on Heron Island – CC BY by The Ocean Agency / XL Catlin Seaview Survey / Richard Vevers

Day 20 of 30 Day Card Challenge: “Water” (earlier).

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

Facts

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)

Card

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))
Map of global ocean acidification - average seawater pH trend

Figure 1: Global ocean acidification – average seawater pH trend


#Acidification #bloggers

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *