| sl.rot.vec | R Documentation | 
Use this function to rotate velocity vectors (given as local u-v-components) on a sphere with Euler angles in z-x-z convention.
  sl.rot.vec <- function(al, be, ga, lon, lat, urot, vrot, flag)
| al,be,ga | three numeric scalars defining the Euler angles (in degrees). | 
| lon,lat | a numeric vector specifying the longitudes and latitudes of the points, either the rotated or geographical coordinates (see parameter 'flag' and section 'Details' for clarification). | 
| urot,vrot | numeric vectors, the u- and v-component of the velocity vectors that shall be rotated. | 
| flag | an integer scalar, either 0 or 1, defining how the input coordinates are interpreted. For  | 
If for example the velocities are given on longitude and latitude in geographical coordinates, but the vector orientation is still corresponding to the rotated coordinate system, you need to use flag=1 and set the Euler angles to the values that transform the geographic to the rotated coordinates (Example 1 below). If lon and lat are the coordinates of the rotated system, you need to set flag=0.
A list with the following elements:
| u | rotated velocity component (in new eastward direction) | 
| v | rotated velocity components (in new northward direction) | 
The provided example #1 is also the necessary post-processing for FESOM velocity output.
Simon Reifenberg, translated from Python and adapted from FESOM/pyfesom (under MIT license)
sl.assemble.eulermatrix, sl.uvw2uv, sl.uv2uvw
  ### Example 1: rotated vectors  ->  geographical coordinate system
  #   velocity vectors u, v, are oriented with respect to a North Pole over Greenland (40°W 75°N)
  #   this coordinate rotation was obtained by the Euler angles (50,15,-90)
  #   lon, lat are here the geographical ("real") coordinates
  
  lon = c(0, 30, 60, 90, 180, -10)    # geogr. coord.
  lat = c(0, 30, 45, 60, 80, 85)      # geogr. coord.
  u.rot   = 1.5 * cos(lat*pi/180)     # rotated velocity 
  v.rot   = rep(0, 6)                 # rotated velocity
  
  U.geo <- sl.rot.vec(50, 15, -90, lon, lat, u.rot, v.rot, 1)  # velocity for geogr. coordinate system
  
  ### Example 2: <provided in near future>
  
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.