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
|
z |
SpatRaster built with |
r |
SpatRaster. The source of the sky DNs used to build
|
bin |
SpatRaster. The binarization of |
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:
flattening the values below the minimum value from the data source defined by
r
andbin
andforcing the values toward the horizon to become gradually the median value from the data source.
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)