Reversed

Day 5 of 30DayMapChallenge
R
30DayMapChallenge
spatial
raster
datavisualization
Author

Michaël

Published

2025-11-05

Modified

2025-11-05

A photo of beach seen through a glass ball

Calvi - Noël 2017 – CC-BY-NC-NA by Valerie Hukalo

Day 5 of 30DayMapChallenge: « Earth » (previously).

What if the bathymetry of the Mediterranean Sea is reversed? We would get 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 zipped NetCDF) is available at GEBCO. We crop it around the Mediterranean Sea.

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 inversed. The relief is more pronounced with a light lower resolution, then we compute the hillshading.

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)

Map

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) 
Map of inverted Mediterranean elevation
Figure 1: Mediterranean Sea upside down