Want to share your content on R bloggers? click here if you have a blog, or here if you don’t.
Day 5 of 30 Day Card Challenge: “Earth” (earlier).
What if the bathymetry of the Mediterranean is reversed? We would have a western island and an eastern island, a Sardinia-Corsica bay, the Balearic lagoon… Let’s see!
library(terra) library(sf) terraOptions(progress=0)
A global bathymetry dataset (7.5 Go to compressed NetCDF) is available at GEBCO. We grow it around the Mediterranean.
med <- c(xmin = -7, ymin = 30, xmax = 39, ymax = 45) |>
st_bbox() |>
st_as_sfc()
gebco <- rast("~/data/gebco/GEBCO_2025_sub_ice.nc") |>
crop(med) We set all positive values to 0 and all negative values are inverted. The relief is more pronounced at a slightly lower resolution, then we calculate the shadow on the hills.
mountain_med <- aggregate((gebco <= 0) * -1 * gebco, 10, mean) slope <- terrain(mountain_med, "slope", unit = "radians") aspect <- terrain(mountain_med, "aspect", unit = "radians") hill <- shade(slope, aspect, angle = 45, direction = 315, normalize = TRUE)
Card
plot(hill, col = grey(0:255/255),
main = "Mediterranean Sea upside down",
legend = FALSE, mar = c(2,2,2,4))
plot(mountain_med, col = topo.colors(30, alpha = 0.3),
plg = list(title = "Elevation (m)"), add = TRUE)
mtext(paste("data: GEBCO\nhttps://r.iresmi.net", Sys.Date()),
side = 1, line = 3, cex = 0.5, adj = 1) 
Figure 1: Mediterranean Sea upside down
Related
#Reverse #bloggers


