sl.lonlat1Dto2D: Inflate Lat-Lon Vectors to Matrices

Description Usage Arguments Value Author(s) Examples

View source: R/sl.lonlat1Dto2D.R

Description

Inflate latitude and/or longitude vectors to corresponding matrices. By default, rows correspond to latitudes and columns correspond to longitudes; this can be changed by setting swap=TRUE. If only one vector (longitudes or latitudes) is provided, the number of latitudes or longitudes to which the vector shall be inflated must be provided.

Usage

1
sl.lonlat1Dto2D(lon = NULL, lat = NULL, Nlon = NULL, Nlat = NULL, swap = FALSE)

Arguments

lon

a vector with longitudes.

lat

a vector with latitudes.

Nlon

a scalar giving the number of longitudes to which the latitudes vector shall be inflated. Used only if lon=NULL.

Nlat

a scalar giving the number of latitudes to which the longitudes vector shall be inflated. Used only if lat=NULL.

swap

a logical value indicating whether the rows and columns of the output shall be swapped. By default (swap=FALSE), rows correspond to latitudes and columns correspond to longitudes.

Value

lon

a matrix giving longitudes, inflated from the argument lon to be repeated at different latitudes.

lat

a matrix giving latitudes, inflated from the argument lat to be repeated at different longitudes.

Author(s)

Helge Goessling

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
sl.lonlat1Dto2D(lon=seq(-150,150,60),lat=c(-60,60,60))
## Should return:
## $lon
##      [,1] [,2] [,3] [,4] [,5] [,6]
## [1,] -150  -90  -30   30   90  150
## [2,] -150  -90  -30   30   90  150
## [3,] -150  -90  -30   30   90  150
## 
## $lat
##      [,1] [,2] [,3] [,4] [,5] [,6]
## [1,]  -60  -60  -60  -60  -60  -60
## [2,]   60   60   60   60   60   60
## [3,]   60   60   60   60   60   60

helgegoessling/spheRlab documentation built on Sept. 29, 2017, 6:36 a.m.