ootb_sky_above: Out-of-the-box above-canopy sky

View source: R/ootb_sky_above.R

ootb_sky_aboveR Documentation

Out-of-the-box above-canopy sky

Description

Generate an above‑canopy sky brightness map without manual tuning.

Usage

ootb_sky_above(sky_points, z, a, sky_cie, size = 100)

Arguments

sky_points

data.frame returned by extract_rr(). If generated by other means, it must contain columns row, col, z, a, and rr, where the first four define geometry (degrees) and rr is the value to interpolate.

z

terra::SpatRaster generated with zenith_image().

a

terra::SpatRaster generated with azimuth_image().

sky_cie

list. Output of ootb_sky_cie().

size

numeric vector of length one. Number of rows and columns of the low-resolution grid used before resampling to full resolution.

Details

Interpolates sky brightness with IDW and k‑nearest neighbors in spherical space via interpolate_spherical(), blending observations with a fitted sky model. Blending and IDW parameters are derived from sky_cie validation metrics, and the result is scaled by the modeled zenith value to yield digital numbers.

Value

Named list with:

dn_raster

numeric terra::SpatRaster with interpolated above‑canopy sky brightness in digital numbers.

w

numeric. Weight assigned to the model‑based filling source.

k

integer. Number of nearest neighbors used by IDW.

p

numeric. IDW power parameter.

Note

This function is part of a paper under preparation.

Examples

## Not run: 
caim <- read_caim()
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)

path <- system.file("external/example.txt", package = "rcaiman")
sky_cie <- read_sky_cie(gsub(".txt", "", path), caim$Blue, z, a)

sky_points <- sky_cie$model$rr$sky_points
sky_above <- ootb_sky_above(sky_points, z, a, sky_cie)
plot(sky_above$dn_raster)
plot(caim$Blue/sky_above$dn_raster)

## End(Not run)

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