fix_reconstructed_sky {rcaiman}R Documentation

Fix reconstructed sky

Description

Automatically edit a raster image of sky digital numbers (DNs) reconstructed with functions such as fit_coneshaped_model() and fit_trend_surface().

Usage

fix_reconstructed_sky(sky, z, r, bin)

Arguments

sky

SpatRaster. Sky DNs predicted with functions such as fit_coneshaped_model() and fit_trend_surface().

z

SpatRaster built with zenith_image().

r

SpatRaster. The source of the sky DNs used to build sky (the data source).

bin

SpatRaster. The binarization of r used to select the sky DNs for building the sky argument.

Details

The predicted sky DNs are usually erroneous near the horizon because either they are a misleading extrapolation or are based on corrupted data (non-pure sky DNs).

The proposed automatic edition consists of:

The latter is achieved by calculating the weighted average of the median value and the predicted sky DNs, using the ratio of z to 90 to determine the weights.

Value

An object of class SpatRaster. The argument sky with dimensions unchanged but values edited.

See Also

Other Sky Reconstruction Functions: cie_sky_model_raster(), fit_cie_sky_model(), fit_coneshaped_model(), fit_trend_surface(), interpolate_sky_points(), ootb_sky_reconstruction()

Examples

## Not run: 
caim <- read_caim()
r <- caim$Blue
caim <- normalize(caim, 0, 20847, TRUE)
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
bin <- find_sky_pixels(r, z, a)
sky <- fit_trend_surface(r, z, a, bin)$image
sky <- fix_reconstructed_sky(sky, z, r, bin)
plot(sky)

## End(Not run)

[Package rcaiman version 1.2.2 Index]