View source: R/select_sky_region.R
select_sky_region | R Documentation |
Select pixels from a single-layer image based on value limits.
select_sky_region(r, from, to)
r |
single-layer terra::SpatRaster, typically from
|
from , to |
numeric vectors of length one. Angles in deg, inclusive limits. |
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.
Logical terra::SpatRaster (TRUE
for the selected region) of
the same dimensions as r
.
paint_with_mask()
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.