sl.uv2uvw: Coordinate transformation of velocity vectors (2D -> 3D)

View source: R/sl.uv2uvw.R

sl.uv2uvwR Documentation

Coordinate transformation of velocity vectors (2D -> 3D)

Description

Convert velocities from local coordinate system (2D) to u-v-w coordinates (3D) on the unit sphere.

Usage

sl.uv2uvw(u, v, lon, lat, do.d2r = TRUE)

Arguments

u, v

numerical vectors (or scalars) for the velocity components in zonal (u) and meridional (v) direction.

lon, lat

numerical vectors (or scalars) of longitudes (lon) and latitudes (lat) of the velocity vectors.

do.d2r

a logical scalar (default: TRUE), specifying whether longitude and latitude are interpreted as radian (FALSE) or degrees (TRUE).

Details

Can be used to transform the u-v vectors in the local "eastward-northward" coordinate system on a sphere into three-dimensional vectors. This facilitates the corresponding vector rotation for a given coordinate rotation.

Value

Returns a list containing

u

first converted velocity component

v

second converted velocity component

w

third converted velocity component

Note

The inverse transformation is implemented in sl.uvw2uv.

Author(s)

Simon Reifenberg

See Also

sl.uvw2uv

Examples

# define local velocity vectors at three positions
lon = c(0, 45, 90)
lat = c(0, 45,  0)
u   = c(0, sqrt(2)/2, 1)
v   = c(1, sqrt(2)/2, 0)

# convert to 'global' coordinates
U <- sl.uv2uvw(u, v, lon, lat)
print(U)


# convert back to local coordinates
U.loc <- sl.uvw2uv(U$u, U$v, U$w, lon, lat, do.d2r = T)
print(U.loc)


FESOM/spheRlab documentation built on April 6, 2024, 6:52 p.m.