neighbours: Return neighbouring pixels

Description Usage Arguments Examples

View source: R/NestSearch.R

Description

Return the neighbouring pixels to a given pixel p that is specified at resolution j, in the nested order.

Usage

1
neighbours(p, j)

Arguments

p

Pixel index p at resolution j.

j

The resolution parameter with nside = 2^j.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Return the neighbouring pixels for base pixel 1
neighbours(1, 0)

## Plot the neighbouring pixels for base pixel 1
demoNeighbours <- function(p,j) {
  neighbours(p, j)
  displayPixels(boundary.j = j, j = j, plot.j = j+3,
                spix = neighbours(p, j),
                boundary.col = "gray",
                boundary.lwd = 1,
                incl.labels = neighbours(p, j),
                col = "blue",
                size = 3)
  rcosmo::displayPixelBoundaries(nside = 1, col = "blue", lwd = 3)
}

demoNeighbours(1,2)
demoNeighbours(1,0)

rcosmo documentation built on Feb. 14, 2020, 5:06 p.m.