| lattice {ssBase} | R Documentation |
A lattice of (2*J+1) by (2*K+1) grid points based on squares or equilateral triangles (at a fixed distance, d apart) is calculated centred on a specified point and with a given orientation.
The major axis of the lattice is taken along the great circle through the lattice centre in the direction specified by the orientation alpha.
lattice(K, J, d, alpha, centrelat, centrelong, triangle=TRUE)
K |
the number of points stepped off to the left and to the right of the origin along the major axis. |
J |
the number of points stepped off in both directions orthogonal to the major axis. |
d |
the distance between the lattice points (in kilometres). |
alpha |
pi/2 minus alpha gives the angle (in radians) between the local meridian through the lattice centre and the major axis of the lattice, where alpha is between 0 and pi.
|
centrelat |
the latitude component of the centre (origin) of the grid. |
centrelong |
the longitude component of the centre (origin) of the grid. |
triangle |
logical. If TRUE, a triangular grid is calculated. If FALSE, a square grid is calculated.
|
A lattice of (2*J+1) by (2*K+1) grid points based on equilateral triangles (at a fixed distance, d apart) or squares is calculated. The grid is rotated by the angle alpha. The algorithm from epi.circle is subsequently used to convert to spherical coordinates, centred over the specified origin. The spherical coordinates (longitude, latitude) of the grid points are returned in a list.
A list object is returned. It contains the following components:
centrelong |
as specified above. |
centrelat |
as specified above. |
d |
the distance between the lattice points (in kilometres). |
longitude |
a vector giving the longitude of the grid points. |
latitude |
a vector giving the latitude component of the grid points. |
i |
a vector of sequence numbers of the lattice points, starting from 1 in the south western corner. |
j |
a vector of grid coordinates along the major axis of the lattice, with 0 as the centre. |
k |
a vector of grid coordinates orthogonal to the major axis of the lattice, with 0 as the centre. |
Alistair Merrifield, 1998
# Creates a triangular lattice of 207 points centred over (175, -41)
x <- lattice(J=4, K=11, d=120, alpha=pi/4, centrelat=-41,
centrelong=175, triangle=TRUE)
plot(x$longitude, x$latitude, xlab="Longitude", ylab="Latitude",
main="Triangluar Arrangement")
x <- lattice(J=4, K=11, d=120, alpha=pi/4, centrelat=-41,
centrelong=175, triangle=FALSE)
plot(x$longitude, x$latitude, xlab="Longitude", ylab="Latitude",
main="Rectangular Arrangement")