select_sky_region: Select sky region

View source: R/select_sky_region.R

select_sky_regionR Documentation

Select sky region

Description

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

Usage

select_sky_region(r, from, to)

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.

Value

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

See Also

paint_with_mask()

Examples

## Not run: 
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))

## End(Not run)

rcaiman documentation built on Sept. 9, 2025, 5:42 p.m.