Apply BRDF correction on S2 bands
Usage
apply_brdf_correction(
x,
model,
mtd_tl,
mtd_msi,
detector_files = NULL,
angle_res = 60,
shift_s2tbx = FALSE,
sun_zenith_0 = 0.542,
output_dir = NULL,
overwrite = FALSE,
write_prods = c()
)Arguments
- x
SpatRaster or list of SpatRasters named with S2 band names (e.g. B02, B03, ...).
- model
Model to use for BRDF correction, see get_model().
- mtd_tl
S2 MTD_TL.xml file or xml2::xml_document.
- mtd_msi
S2 MTD_MSIxxx.xml file or xml2::xml_document.
- detector_files
S2 detector files.
- angle_res
Raster resolution of sun and viewing angles, see details.
- shift_s2tbx
Logical. If TRUE, simulate the behavior of the SNAP S2 toolbox for angle interpolation.
- sun_zenith_0
numeric. Mean sun zenith angle in radian at acquisition time, see details.
- output_dir
character. Output directory. If NULL, nothing is written.
- overwrite
logical. If TRUE, overwrite existing files.
- write_prods
character. Intermediate products to write. Can be "angles", "kernels" and/or "cf". Only used if output_dir is not NULL.
Details
The algorithm is as follows:
Compute sun and viewing angles
Compute kernels
Compute BRDF correction factor
Apply BRDF correction
Parameter angle_res is used to define the raster resolution
for sun and viewing angles, and kernels. Giving a low resolution
will speed up the computation and save memory although there might
be some border effects as the kernels are resampled at the band resolution with
bilinear interpolation just before computing the BRDF correction factor.
Parameter sun_zenith_0 is the solar zenith angle in radian used to compute
the BRDF correction factor.
The default value is fixed to 0.542 that is the value used to compute the model included.