Learn R Programming

rcaiman (version 2.0.1)

select_sky_region: Select sky region

Description

Select pixels from a single-layer image based on value limits.

Usage

select_sky_region(r, from, to)

Value

Logical terra::SpatRaster (TRUE for the selected region) of the same dimensions as r.

Arguments

r

single-layer terra::SpatRaster, typically from zenith_image() or azimuth_image().

from, to

numeric vectors of length one. Angles in deg, inclusive limits.

Details

Works with any numeric terra::SpatRaster of one layer, but is especially well-suited for images from zenith_image() or azimuth_image(). For azimuth ranges that wrap around 0 deg, combine two masks with logical OR.

See Also

paint_with_mask()

Examples

Run this code
if (FALSE) {
z <- zenith_image(1000, lens())
a <- azimuth_image(z)
m1 <- select_sky_region(z, 20, 70)
plot(m1)
m2 <- select_sky_region(a, 330, 360)
plot(m2)
plot(m1 & m2)
plot(m1 | m2)

# 15 deg on each side of 0
m1 <- select_sky_region(a, 0, 15)
m2 <- select_sky_region(a, 345, 360)
plot(m1 | m2)

# You can use this
plot(!is.na(z))
# instead of this
plot(select_sky_region(z, 0, 90))
}

Run the code above in your browser using DataLab