if(interactive()){
# import copernicus data with potential temperatures and ocean current velocities
oc <- read.cmems("global-reanalysis-phy-001-030-daily_1560792767602_GC_2013-14.nc")
# Default plot
quiver(u = oc$uo, v = oc$vo)
# Using default colors for the arrows, color bar and reference arrow
quiver(u = oc$uo, v = oc$vo, colarrow = TRUE, colbar = TRUE,
ra.pos = c(-108, 30))
# Adding custom map and colors, and plotting another period and depth level
quiver(u = oc$uo, v = oc$vo, image = 4, depth = 10, colbar = TRUE,
colarrow = TRUE, scheme = c("mediumblue", "lightcyan", "red"),
map = dmap, ra.pos = c(-108, 30), ra.speed = 0.2)
# Overlay arrows to an existing plot of the potential temperature
plot(oc$thetao, map = dmap, xlim = c(-112, -108), ylim = c(24, 28),
colbar = FALSE)
quiver(u = oc$uo, v = oc$vo, colarrow = TRUE, ra.pos = c(-108.5, 27),
ra.speed = 0.15, main = "", length=0.02, scale = 0.7, add2map = TRUE)
}
Run the code above in your browser using DataLab