velocity | R Documentation |
Calculate ocean current speed and direction from eastward and northward components (Copernicus data).
velocity(u, v, depth = 1)
u |
a satin object with eastward ocean current velocities (in m/s). |
v |
a satin object with northward ocean current velocities (in m/s). |
depth |
an integer referring to a depth level. |
This function calculates the resulting velocity vectors in the same way as the "quiver"
function. In addition, these values are returned togheter with their direction in degrees.
A list with 2 elements, “speed” and “rhumb”, both of class "satin"
. The former contains the resulting velocity vectors as drawn by "quiver"
, while the second their direction in degrees.
Héctor Villalobos
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")
vel <- velocity(u = oc$uo, v = oc$vo)
# Plots overlaying velocity vectors
plot(vel$speed)
quiver(u = oc$uo, v = oc$vo, main = "", length=0.02, scale = 0.7, add2map = TRUE)
plot(vel$rhumb, col.sep = 90, scheme = c('#d7301f', '#fc8d59','#fdcc8a', '#fef0d9'))
quiver(u = oc$uo, v = oc$vo, main = "", add2map = TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.