rotate {clim.pact} | R Documentation

## Rotate spherical coordinates

### Description

The function uses the 3-dimensional space to find vectors describing the locations on a sphere that correspond to a given longitude and latitude. Two reference points are given, one for the new 'north pole':

vec{r}_0 = [cos(phi_0)cos(theta_0),sin(phi_0),cos(phi_0)sin(theta_0)].

{r0 = [cos(lat.0)*cos(lon.0),sin(lat.0),cos(lat.0)*sin(lon.0).} and and one for a point on the same meridian

rx

, but closer to the equator. The vector corresponing to each of the longitude-latitude point is given by:

vec{r}_i = [cos(phi_i)cos(theta_i),sin(phi_i),cos(phi_i)sin(theta_i)].

{r[i] =[cos(lats[i])*cos(lons[i]),sin(lats[i]),cos(lats[i])*sin(lons[i]).}

The new spherical coordinates are computed as follows: new latitude (`phi`) is the angle between the the vectors

r0

and

r[i]

. The new longitude (`theta`) is the angle between the the vectors

r[i]-r0

and

rx-r0

. The angles are estimated by taking the inner-product and the arc-cosine.

### Usage

    rotate(lons,lats,lon.0=NULL,lat.0=NULL)

### Arguments

`lons` | Longitude coordinates to be rotated.
`lats` | Latitude coordinates to be rotated.
`lon.0` | Longitude coordinate of point corresponding to new 'north'pole.
`lat.0` | Latitude coordinate of point corresponding to new 'north'pole.

### Value

list containing `phi` and `theta`, the new spherical coordinates.

### Author(s)

R.E. Benestad

### Examples

[Package Contents]