Pacific center bathymetric map [R]

 




Pacific center bathymetric/global map using R



I learned how to create the bathymetric map using R (HERE).

This time, I try to make a Pacific-centered map.


Library

library(sp)
library(raster)
library(rgdal)
library(ncdf4)
library(RColorBrewer)
library(tidyverse)



1 Download the ETOPO map and save it on a PC.
2 Import ETOPO1 data (map)

etopo <- raster("/Path HERE/ETOPO1_Bed_g_geotiff.tif")


3 Import sample data (abyssal peridotites)

data <- read.csv("/Path HERE/residual_abyssal_peridotites.csv")


Now, the points and map are ready.
I will convert the longitude from -180–180 units to 0–360 units.

4. Converting the longitude of the map (-180–180 →  0–360)

r <- etopo.b
x1 <- crop(r, extent(-180, 0, -90, 90))
x2 <- crop(r, extent(0, 180, -90, 90))  
extent(x1) <- c(180, 360, -90, 90)
m <- merge(x1, x2,tolerance=0.5)


5. Converting the longitude of the points (-180–180 →  0–360)

data_west <- filter(data, Long<0)
data_east <- filter(data, Long>=0)
data_west$Long <- (data_west$Long + 360)
data <- rbind(data_west, data_east)


6. Vizualization (map)

#Colorscheme
black.col <- colorRampPalette(c("black"))
blue.col <- colorRampPalette(c("black","darkblue","aquamarine4","grey"))
br <- seq(from=-12000, to=8000, by=100) 

#Vizualization
plot(m, col=c(blue.col(120), black.col(80)), breaks=br)
Pacific center bathymetric map



7. Vizualization (map + points)

plot(m, col=c(blue.col(120), black.col(80)), breaks=br)
points(data$Long, data$Lat, pch = 21, col= "black", bg = "green4")





7. Extra Vizualization (limited area)


Using xlim = c(), ylim=c()

#Colorscheme
black.col <- colorRampPalette(c("black"))
blue.col <- colorRampPalette(c("black","darkblue","aquamarine4","grey"))
#Vizualization br <- seq(from=-12000, to=4000, by=100) par(mar = c(2, 2, 2, 2)) plot(etopo.b, col=c(blue.col(120), black.col(40)), breaks=br, xlim = c(110,180),ylim = c(-50,60))




Data source: Compositional Data Analysis (CoDA) of Clinopyroxene from Abyssal Peridotites

Map: ETOPO1 Bedrock

Reference: Benjamin Bell blog


keywords: abyssal peridotites, clinopyroxene, spinel, clinopyroxene, rstats, r, plot, Geochemistry, Geology, Petrology, using R, r bloggers, bathymetric map, QGIS










Post a Comment

0 Comments