| Title: | Tools for Retrieving Snow and Ice Albedo from Optical Satellite Imagery |
|---|---|
| Description: | The package consists of a set of tools for retrieving snow and ice albedo from optical satellite imagery (e.g., Landsat and Sentinel-2). The tools require the following gridded datasets: (1) atmospherically-corrected surface reflectance, (2) a digital elevation model (DEM), and (3) satellite and solar azimuth and zenith angles. The package includes tools for: image pre-processing (crop grids to a specified extent, project grids with different coordinate systems, and convert data from integer to floating point); convert nadir satellite observations to off-nadir values using view-angle corrections; detect and mask topographic shadows; automatic discrimination of snow and ice surfaces; anisotropic correction of reflected radiation of glacier snow and ice using empirical parameterizations of the bidirectional reflectance distribution function (BRDF); topographic correction; and narrow-to-broadband albedo conversion. |
| Authors: | Pablo Fuchs [aut, cre] (ORCID: <https://orcid.org/0000-0002-6042-5620>), Ruzica Dadic [ctb, ths] (ORCID: <https://orcid.org/0000-0003-1303-1896>), Shelley MacDonell [ctb, ths] (ORCID: <https://orcid.org/0000-0001-9641-4547>), Heather Purdie [ctb, ths] (ORCID: <https://orcid.org/0000-0002-2723-6908>), Brian Anderson [ctb, ths], Marwan Katurji [ctb, ths] (ORCID: <https://orcid.org/0000-0002-3368-1469>), Javier Corripio [cph] (Author of the vectorial algebra algorithms used to detect topographic shadows) |
| Maintainer: | Pablo Fuchs <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 1.0.0 |
| Built: | 2026-06-10 10:50:04 UTC |
| Source: | https://github.com/pabl1t0x/SatRbedo |
This function converts narrowband to broadband albedo of snow and ice surfaces using the empirical relationships developed by Knap et al. (1999), Liang (2001), and Feng et al. (2023).
albedo_Knap(albedo_green, albedo_NIR, saturated = FALSE) albedo_Liang(albedo_blue, albedo_red, albedo_NIR, albedo_SWIR1, albedo_SWIR2) albedo_Feng(albedo_blue, albedo_green, albedo_red, albedo_NIR)albedo_Knap(albedo_green, albedo_NIR, saturated = FALSE) albedo_Liang(albedo_blue, albedo_red, albedo_NIR, albedo_SWIR1, albedo_SWIR2) albedo_Feng(albedo_blue, albedo_green, albedo_red, albedo_NIR)
albedo_green |
SpatRaster. Green band albedo (0.53-0.59 um). |
albedo_NIR |
SpatRaster. Near-infrared band albedo (0.85-0.88 um). |
saturated |
logical. If |
albedo_blue |
SpatRaster. Blue band albedo (0.43-0.45 um). |
albedo_red |
SpatRaster. Red band albedo (0.64-0.67 um). |
albedo_SWIR1 |
SpatRaster. Shortwave-infrared band albedo (1.57-1.65 um). |
albedo_SWIR2 |
SpatRaster. Shortwave-infrared band albedo (2.11-2.29 um). |
broadband albedo (i.e., the albedo integrated over the entire solar spectrum).
Feng S, Cook JM, Onuma Y, Naegeli K, Tan W, Anesio AM, Benning LG, Tranter M (2023).
“Remote sensing of ice albedo using harmonized Landsat and Sentinel 2 datasets: validation.”
International Journal of Remote Sensing, 1–29.
doi:10.1080/01431161.2023.2291000.
Knap WH, Reijmer CH, Oerlemans J (1999).
“Narrowband to broadband conversion of Landsat TM glacier albedos.”
International Journal of Remote Sensing, 20(10), 2091–2110.
doi:10.1080/014311699212362.
Liang S (2001).
“Narrowband to broadband conversions of land surface albedo I: Algorithms.”
Remote Sensing of Environment, 76(2), 213–238.
doi:10.1016/S0034-4257(00)00205-4.
library(terra) outline <- system.file("extdata/athabasca_outline.shp", package = "SatRbedo") blue <- system.file("extdata/athabasca_2020253_B02_S30.tif", package = "SatRbedo") green <- system.file("extdata/athabasca_2020253_B03_S30.tif", package = "SatRbedo") red <- system.file("extdata/athabasca_2020253_B04_S30.tif", package = "SatRbedo") nir <- system.file("extdata/athabasca_2020253_B8A_S30.tif", package = "SatRbedo") swir1 <- system.file("extdata/athabasca_2020253_B11_S30.tif", package = "SatRbedo") swir2 <- system.file("extdata/athabasca_2020253_B12_S30.tif", package = "SatRbedo") blue <- preproc(blue, outline) green <- preproc(green, outline) red <- preproc(red, outline) nir <- preproc(nir, outline) swir1 <- preproc(swir1, outline) swir2 <- preproc(swir2, outline) # Broadband albedo using Knap et al. (1999) albedo_Knap(green, nir) # Broadband albedo using Liang (2001) albedo_Liang(blue, red, nir, swir1, swir2) # Broadband albedo using Feng et al. (2023) albedo_Feng(blue, green, red, nir)library(terra) outline <- system.file("extdata/athabasca_outline.shp", package = "SatRbedo") blue <- system.file("extdata/athabasca_2020253_B02_S30.tif", package = "SatRbedo") green <- system.file("extdata/athabasca_2020253_B03_S30.tif", package = "SatRbedo") red <- system.file("extdata/athabasca_2020253_B04_S30.tif", package = "SatRbedo") nir <- system.file("extdata/athabasca_2020253_B8A_S30.tif", package = "SatRbedo") swir1 <- system.file("extdata/athabasca_2020253_B11_S30.tif", package = "SatRbedo") swir2 <- system.file("extdata/athabasca_2020253_B12_S30.tif", package = "SatRbedo") blue <- preproc(blue, outline) green <- preproc(green, outline) red <- preproc(red, outline) nir <- preproc(nir, outline) swir1 <- preproc(swir1, outline) swir2 <- preproc(swir2, outline) # Broadband albedo using Knap et al. (1999) albedo_Knap(green, nir) # Broadband albedo using Liang (2001) albedo_Liang(blue, red, nir, swir1, swir2) # Broadband albedo using Feng et al. (2023) albedo_Feng(blue, green, red, nir)
This function calculates narrowband and broadband albedo from surface reflectance data. The albedo retrieval method includes corrections for the anisotropic behavior of the reflected radiation field over snow and ice, and narrow-to-broadband albedo conversion algorithms.
albedo_sat( SAA, SZA, VAA, VZA, slope, aspect, method, blue = NULL, green = NULL, red = NULL, NIR = NULL, SWIR1 = NULL, SWIR2 = NULL, th )albedo_sat( SAA, SZA, VAA, VZA, slope, aspect, method, blue = NULL, green = NULL, red = NULL, NIR = NULL, SWIR1 = NULL, SWIR2 = NULL, th )
SAA |
SpatRaster or numeric. Solar azimuth angle in degrees. |
SZA |
SpatRaster or numeric. Solar zenith angle in degrees. |
VAA |
SpatRaster or numeric. Satellite sensor azimuth angle in degrees. |
VZA |
SpatRaster or numeric. Satellite sensor zenith angle in degrees. |
slope |
SpatRaster or numeric. Surface slope in degrees. |
aspect |
SpatRaster or numeric. Surface aspect in degrees. |
method |
character. Number of spectral bands to calculate broadband albedo.
There are three options available: "twobands" (green and near-infrared), "fourbands"
(blue, green, red, near-infrared), and "fivebands" (blue, red, near-infrared,
shortwave-infrared 1, and shortwave-infrared 2). If |
blue |
SpatRaster. Blue band surface reflectance (0.43-0.45 um). Required for
|
green |
SpatRaster. Green band surface reflectance (0.53-0.59 um). Required for all methods. |
red |
SpatRaster. Red band surface reflectance (0.64-0.67 um). Required for
|
NIR |
SpatRaster. Near-infrared surface reflectance (0.85-0.88 um). Required for all methods. |
SWIR1 |
SpatRaster. Shortwave-infrared surface reflectance (1.57-1.65 um). Required for
|
SWIR2 |
SpatRaster. Shortwave-infrared surface reflectance (2.11-2.29 um). Required for
|
th |
numeric. NDSII threshold to discriminate between snow and ice. |
Returns a SpatRaster with four layers for method="twobands", five layers for
method="fourbands" and six layers for method="fivebands". These layers are:
If method="twobands": green and NIR narrowband albedo, broadband albedo, and
quality flags indicating whether broadband albedo was calculated using the corrected
green and NIR narrowband albedos (flag=1) or the NIR albedo only (flag=2).
Broadband albedo values higher than one are not excluded for this method.
If method="fourbands": blue, green, red, and NIR surface reflectance and
broadband albedo. Broadband albedo values higher than one and lower than zero are
masked out.
If method="fivebands": blue, red, NIR, SWIR1, SWIR2 narrowband albedo, and
broadband albedo. Broadband albedo values higher than one and lower than zero are
masked out.
If method="fourbands" is used, it is not necessary to call the following arguments:
SAA, SZA, VAA, VZA, slope, aspect, and th.
Feng S, Cook JM, Anesio AM, Benning LG, Tranter M (2023).
“Long time series (1984–2020) of albedo variations on the Greenland ice sheet from harmonized Landsat and Sentinel 2 imagery.”
Journal of Glaciology, 1–16.
doi:10.1017/jog.2023.11.
Klok EJ(, Greuell W, Oerlemans J (2003).
“Temporal and spatial variation of the surface albedo of Morteratschgletscher, Switzerland, as derived from 12 Landsat images.”
Journal of Glaciology, 49(167), 491–502.
doi:10.3189/172756503781830395.
Ren S, Miles ES, Jia L, Menenti M, Kneib M, Buri P, McCarthy MJ, Shaw TE, Yang W, Pellicciotti F (2021).
“Anisotropy parameterization development and evaluation for glacier surface albedo retrieval from satellite observations.”
Remote Sensing, 13(9), 1714.
doi:10.3390/rs13091714.
preproc(), snow_or_ice(), f_BRDF(), albedo_Knap(),
albedo_Liang(), albedo_Feng(), terra::terrain(), terra::plot()
library(terra) outline <- system.file("extdata/athabasca_outline.shp", package = "SatRbedo") blue <- system.file("extdata/athabasca_2020253_B02_S30.tif", package = "SatRbedo") green <- system.file("extdata/athabasca_2020253_B03_S30.tif", package = "SatRbedo") red <- system.file("extdata/athabasca_2020253_B04_S30.tif", package = "SatRbedo") nir <- system.file("extdata/athabasca_2020253_B8A_S30.tif", package = "SatRbedo") swir1 <- system.file("extdata/athabasca_2020253_B11_S30.tif", package = "SatRbedo") swir2 <- system.file("extdata/athabasca_2020253_B12_S30.tif", package = "SatRbedo") dem <- system.file("extdata/athabasca_dem.tif", package = "SatRbedo") blue <- preproc(grd = blue, outline = outline) green <- preproc(grd = green, outline = outline) red <- preproc(grd = red, outline = outline) nir <- preproc(grd = nir, outline = outline) swir1 <- preproc(grd = swir1, outline = outline) swir2 <- preproc(grd = swir2, outline = outline) dem <- preproc(grd = dem, outline = outline) SAA <- 164.8 SZA <- 48.9 VAA <- 287.1 VZA <- 7.2 slope <- terra::terrain(dem, v = "slope", neighbors = 4, unit = "degrees") aspect <- terra::terrain(dem, v = "aspect", neighbors = 4, unit = "degrees") # Broadband albedo using green and near-infrared surface reflectance data th <- snow_or_ice(green, nir)$th alb <- albedo_sat( SAA = SAA, SZA = SZA, VAA = VAA, VZA = VZA, slope = slope, aspect = aspect, method = "twobands", green = green, NIR = nir, th = th ) plot(alb[[3]]) # Broadband albedo plot(alb[[4]]) # Flags # Broadband albedo using blue, green, red and near-infrared surface reflectance data alb <- albedo_sat( method = "fourbands", blue = blue, green = green, red = red, NIR = nir ) plot(alb[[5]]) # Broadband albedo # Broadband albedo using blue, red, near-infrared, and shortwave-infrared surface reflectance data th <- snow_or_ice(green, nir)$th alb <- albedo_sat( SAA = SAA, SZA = SZA, VAA = VAA, VZA = VZA, slope = slope, aspect = aspect, method = "fivebands", blue = blue, green = green, red = red, NIR = nir, SWIR1 = swir1, SWIR2 = swir2, th = th ) plot(alb[[6]]) # Broadband albedolibrary(terra) outline <- system.file("extdata/athabasca_outline.shp", package = "SatRbedo") blue <- system.file("extdata/athabasca_2020253_B02_S30.tif", package = "SatRbedo") green <- system.file("extdata/athabasca_2020253_B03_S30.tif", package = "SatRbedo") red <- system.file("extdata/athabasca_2020253_B04_S30.tif", package = "SatRbedo") nir <- system.file("extdata/athabasca_2020253_B8A_S30.tif", package = "SatRbedo") swir1 <- system.file("extdata/athabasca_2020253_B11_S30.tif", package = "SatRbedo") swir2 <- system.file("extdata/athabasca_2020253_B12_S30.tif", package = "SatRbedo") dem <- system.file("extdata/athabasca_dem.tif", package = "SatRbedo") blue <- preproc(grd = blue, outline = outline) green <- preproc(grd = green, outline = outline) red <- preproc(grd = red, outline = outline) nir <- preproc(grd = nir, outline = outline) swir1 <- preproc(grd = swir1, outline = outline) swir2 <- preproc(grd = swir2, outline = outline) dem <- preproc(grd = dem, outline = outline) SAA <- 164.8 SZA <- 48.9 VAA <- 287.1 VZA <- 7.2 slope <- terra::terrain(dem, v = "slope", neighbors = 4, unit = "degrees") aspect <- terra::terrain(dem, v = "aspect", neighbors = 4, unit = "degrees") # Broadband albedo using green and near-infrared surface reflectance data th <- snow_or_ice(green, nir)$th alb <- albedo_sat( SAA = SAA, SZA = SZA, VAA = VAA, VZA = VZA, slope = slope, aspect = aspect, method = "twobands", green = green, NIR = nir, th = th ) plot(alb[[3]]) # Broadband albedo plot(alb[[4]]) # Flags # Broadband albedo using blue, green, red and near-infrared surface reflectance data alb <- albedo_sat( method = "fourbands", blue = blue, green = green, red = red, NIR = nir ) plot(alb[[5]]) # Broadband albedo # Broadband albedo using blue, red, near-infrared, and shortwave-infrared surface reflectance data th <- snow_or_ice(green, nir)$th alb <- albedo_sat( SAA = SAA, SZA = SZA, VAA = VAA, VZA = VZA, slope = slope, aspect = aspect, method = "fivebands", blue = blue, green = green, red = red, NIR = nir, SWIR1 = swir1, SWIR2 = swir2, th = th ) plot(alb[[6]]) # Broadband albedo
Calculates cast shadows over a matrix or SpatRaster digital elevation model (DEM) for a given illumination direction.
cast_shadows(dem, SZA, SAA, dl = 0, sombra = dem)cast_shadows(dem, SZA, SAA, dl = 0, sombra = dem)
dem |
matrix or SpatRaster. Digital elevation model representing terrain elevation on a regular grid. |
SZA |
SpatRaster or numeric. Solar zenith angle in degrees. |
SAA |
SpatRaster or numeric. Solar azimuth angle in degrees. |
dl |
numeric. Grid spacing. Not needed if |
sombra |
Returned matrix or SpatRaster. |
cast_shadows() calls a fortran routine called doshade that scans the DEM in
lines parallel to the sun direction. It compares the projection of the grid cells on a
plane perpendicular to the sun to determine whether they are exposed to direct solar
illumination or shadowed by neighbor objects, such as mountains. See
Corripio (2003) for details. The doshade subroutine
was originally written by Javier Corripio and it was shipped with the insol
package. This function has been optimized and updated to take advantage of the
infrastructure provided by the terra package.
Returns an object of the same class as the input DEM (matrix or SpatRaster), with values of 0 for cast-shadowed pixels and 1 for not-shaded pixels.
Corripio JG (2003). “Vectorial algebra algorithms for calculating terrain parameters from DEMs and solar radiation modelling in mountainous terrain.” International Journal of Geographical Information Science, 17(1), 1–23. doi:10.1080/713811744.
library(terra) dem <- system.file("extdata/athabasca_dem.tif", package = "SatRbedo") dem <- terra::rast(dem) SZA <- 49 SAA <- 165 cs <- cast_shadows(dem, SZA, SAA) plot(cs, col = grey(0:1))library(terra) dem <- system.file("extdata/athabasca_dem.tif", package = "SatRbedo") dem <- terra::rast(dem) SZA <- 49 SAA <- 165 cs <- cast_shadows(dem, SZA, SAA) plot(cs, col = grey(0:1))
Calculates the c-factor proposed by Roy et al. (2016) which can be used to normalize surface reflectance data to nadir BRDF adjusted reflectance (NBAR), or to convert NBAR observations to off-nadir surface reflectance. The c-factor is calculated based on a spectral kernel-based BRDF model. The mathematical formulation of the kernels is presented in Wanner et al. (1995), Lucht et al. (2000) and Carlsen et al. (2020).
cfactor_BRDF(SAA, SZA, VAA, VZA, NSZ, br = 1, hb = 2, band)cfactor_BRDF(SAA, SZA, VAA, VZA, NSZ, br = 1, hb = 2, band)
SAA |
SpatRaster or numeric. Solar azimuth angle in degrees. |
SZA |
SpatRaster or numeric. Solar zenith angle in degrees. |
VAA |
SpatRaster or numeric. Satellite sensor azimuth angle in degrees. |
VZA |
SpatRaster or numeric. Satellite sensor zenith angle in degrees. |
NSZ |
numeric. NBAR solar zenith angle. This prescribed |
br |
numeric. Crown relative height parameter. Defaults to 1.0. |
hb |
numeric. Shape parameter. Defaults to 2.0. |
band |
character. Spectral band to be processed. There are six bands that can be considered: "blue (0.43-0.45 um)", "green (0.53-0.59 u)", "red (0.64-0.67 um)", "NIR" (near-infrared, 0.85-0.88 um), "SWIR" (shortwave-infrared, 1.57-1.65 um), and "SWIR2 (shortwave-infrared, 2.11-2.29 um)". |
Returns a single numeric value or a SpatRaster with the c-factor values for a spectral band.
Carlsen T, Birnbaum G, Ehrlich A, Helm V, Jäkel E, Schäfer M, Wendisch M (2020).
“Parameterizing anisotropic reflectance of snow surfaces from airborne digital camera observations in Antarctica.”
The Cryosphere, 14(11), 3959–3978.
doi:10.5194/tc-14-3959-2020.
Li Z, Zhang HK, Roy DP (2019).
“Investigation of Sentinel-2 Bidirectional Reflectance Hot-Spot Sensing Conditions.”
IEEE Transactions on Geoscience and Remote Sensing, 57(6), 3591–3598.
doi:10.1109/TGRS.2018.2885967.
Lucht W, Schaaf CB, Strahler AH (2000).
“An algorithm for the retrieval of albedo from space using semiempirical BRDF models.”
IEEE Transactions on Geoscience and Remote Sensing, 38(2), 977–998.
doi:10.1109/36.841980.
Roy DP, Zhang HK, Ju J, Gomez-Dans JL, Lewis PE, Schaaf CB, Sun Q, Li J, Huang H, Kovalskyy V (2016).
“A general method to normalize Landsat reflectance data to nadir BRDF adjusted reflectance.”
Remote Sensing of Environment, 176, 255–271.
doi:10.1016/j.rse.2016.01.023.
Wanner W, Li X, Strahler AH (1995).
“On the derivation of kernels for kernel-driven models of bidirectional reflectance.”
Journal of Geophysical Research, 100(D10), 21077.
doi:10.1029/95JD02371.
# Using data with numeric format cfactor_BRDF(SAA = 56.58, SZA = 35.6, VAA = 236.4, VZA = 1.00, NSZ = 34.97, band = "NIR") # Using SpatRaster data library(terra) m1 <- matrix(seq(from = 56.54, to = 56.67, length.out = 9), nrow = 3, ncol = 3) m2 <- matrix(seq(from = 35.54, to = 35.65, length.out = 9), nrow = 3, ncol = 3) m3 <- matrix(seq(from = 221.05, to = 259.06, length.out = 9), nrow = 3, ncol = 3) m4 <- matrix(seq(from = 0.53, to = 1.12, length.out = 9), nrow = 3, ncol = 3) SAA <- terra::rast(m1) SZA <- terra::rast(m2) VAA <- terra::rast(m3) VZA <- terra::rast(m4) cfactor_BRDF(SAA, SZA, VAA, VZA, NSZ = 34.97, band = "NIR")# Using data with numeric format cfactor_BRDF(SAA = 56.58, SZA = 35.6, VAA = 236.4, VZA = 1.00, NSZ = 34.97, band = "NIR") # Using SpatRaster data library(terra) m1 <- matrix(seq(from = 56.54, to = 56.67, length.out = 9), nrow = 3, ncol = 3) m2 <- matrix(seq(from = 35.54, to = 35.65, length.out = 9), nrow = 3, ncol = 3) m3 <- matrix(seq(from = 221.05, to = 259.06, length.out = 9), nrow = 3, ncol = 3) m4 <- matrix(seq(from = 0.53, to = 1.12, length.out = 9), nrow = 3, ncol = 3) SAA <- terra::rast(m1) SZA <- terra::rast(m2) VAA <- terra::rast(m3) VZA <- terra::rast(m4) cfactor_BRDF(SAA, SZA, VAA, VZA, NSZ = 34.97, band = "NIR")
This tool corrects for the anisotropy of reflected radiation by melting snow and ice. For a given surface type, the correction is carried out using an empirical model of the Bidirectional Reflectance Distribution Function (BRDF) that depends on the wavelength bands and the view-solar geometry. The procedure is applicable to visible, near-infrared (NIR), and shortwave-infrared (SWIR) wavelenghts. More details about the parameterizations can be found in the references list.
f_BRDF(SAA, SZA, VAA, VZA, slope, aspect, method, green, NIR, th)f_BRDF(SAA, SZA, VAA, VZA, slope, aspect, method, green, NIR, th)
SAA |
SpatRaster or numeric. Solar azimuth angle in degrees. |
SZA |
SpatRaster or numeric. Solar zenith angle in degrees. |
VAA |
SpatRaster or numeric. Satellite sensor azimuth angle in degrees. |
VZA |
SpatRaster or numeric. Satellite sensor zenith angle in degrees. |
slope |
SpatRaster or numeric. Surface slope in degrees. |
aspect |
SpatRaster or numeric. Surface aspect in degrees. |
method |
character. Number of spectral bands considered for the anisotropy correction. There are two options available: "twobands" (green and NIR) using the parameterizations of Greuell and De Ruyter De Wildt (1999) for ice and Koks (2001) for snow, and "fivebands" (blue, red, NIR, SWIR1, and SWIR2) using the methods described in Ren et al. (2021). |
green |
SpatRaster. Green band surface reflectance (0.53-0.59 um). |
NIR |
SpatRaster. Near-infrared band surface reflectance (0.85-0.88 um). |
th |
numeric. NDSII threshold to discriminate between snow and ice. |
Returns a SpatRaster with two layers for method="twobands" and five layers
for method="fivebands". Each layer contains the anisotropic reflection factors (f)
for each spectral band and surface type (snow or ice). All f values represent the
difference between the satellite albedo retrievals and the surface reflectance observations.
f is not calculated for method="twobands" if the green or the NIR surface
reflectance values are greater than one or for pixels for which the SZA relative to the inclined
surface is >65.51° over snow or >74.2° over ice. For method="fivebands", f is not
calculated if the SZA relative to the inclined surface is >70.9° over snow or >57.6°
over ice.
De Ruyter De Wildt MS, Oerlemans J, Björnsson H (2002).
“A method for monitoring glacier mass balance using satellite albedo measurements: application to Vatnajökull, Iceland.”
Journal of Glaciology, 48(161), 267–278.
doi:10.3189/172756502781831458.
Greuell W, De Ruyter De Wildt M (1999).
“Anisotropic reflection by melting glacier ice: measurements and parametrizations in Landsat TM Bands 2 and 4.”
Remote Sensing of Environment, 70(3), 265–277.
doi:10.1016/S0034-4257(99)00043-7.
Koks M (2001).
Anisotropic reflection of radiation by melting snow. Landsat TM bands 2 and 4.
Master's thesis, Universiteit Utrecht. Instituut voor Marien en Atmosferisch Onderzoek Utrecht (IMAU).
Ren S, Miles ES, Jia L, Menenti M, Kneib M, Buri P, McCarthy MJ, Shaw TE, Yang W, Pellicciotti F (2021).
“Anisotropy parameterization development and evaluation for glacier surface albedo retrieval from satellite observations.”
Remote Sensing, 13(9), 1714.
doi:10.3390/rs13091714.
preproc(), terra::terrain(), snow_or_ice(), terra::plot()
library(terra) outline <- system.file("extdata/athabasca_outline.shp", package = "SatRbedo") green <- system.file("extdata/athabasca_2020253_B03_S30.tif", package = "SatRbedo") nir <- system.file("extdata/athabasca_2020253_B8A_S30.tif", package = "SatRbedo") dem <- system.file("extdata/athabasca_dem.tif", package = "SatRbedo") green <- preproc(grd = green, outline = outline) nir <- preproc(grd = nir, outline = outline) dem <- preproc(grd = dem, outline = outline) SAA <- 164.8 SZA <- 48.9 VAA <- 287.1 VZA <- 7.2 slope <- terra::terrain(dem, v = "slope", neighbors = 4, unit = "degrees") aspect <- terra::terrain(dem, v = "aspect", neighbors = 4, unit = "degrees") # f coefficients for two bands th <- snow_or_ice(green, nir)$th f <- f_BRDF( SAA = SAA, SZA = SZA, VAA = VAA, VZA = VZA, slope = slope, aspect = aspect, method = "twobands", green = green, NIR = nir, th = th ) plot(f[[1]]) plot(f[[2]]) # f coefficients for five bands th <- snow_or_ice(green, nir)$th f <- f_BRDF( SAA = SAA, SZA = SZA, VAA = VAA, VZA = VZA, slope = slope, aspect = aspect, method = "fivebands", green = green, NIR = nir, th = th ) plot(f[[1]]) plot(f[[2]]) plot(f[[3]]) plot(f[[4]]) plot(f[[5]])library(terra) outline <- system.file("extdata/athabasca_outline.shp", package = "SatRbedo") green <- system.file("extdata/athabasca_2020253_B03_S30.tif", package = "SatRbedo") nir <- system.file("extdata/athabasca_2020253_B8A_S30.tif", package = "SatRbedo") dem <- system.file("extdata/athabasca_dem.tif", package = "SatRbedo") green <- preproc(grd = green, outline = outline) nir <- preproc(grd = nir, outline = outline) dem <- preproc(grd = dem, outline = outline) SAA <- 164.8 SZA <- 48.9 VAA <- 287.1 VZA <- 7.2 slope <- terra::terrain(dem, v = "slope", neighbors = 4, unit = "degrees") aspect <- terra::terrain(dem, v = "aspect", neighbors = 4, unit = "degrees") # f coefficients for two bands th <- snow_or_ice(green, nir)$th f <- f_BRDF( SAA = SAA, SZA = SZA, VAA = VAA, VZA = VZA, slope = slope, aspect = aspect, method = "twobands", green = green, NIR = nir, th = th ) plot(f[[1]]) plot(f[[2]]) # f coefficients for five bands th <- snow_or_ice(green, nir)$th f <- f_BRDF( SAA = SAA, SZA = SZA, VAA = VAA, VZA = VZA, slope = slope, aspect = aspect, method = "fivebands", green = green, NIR = nir, th = th ) plot(f[[1]]) plot(f[[2]]) plot(f[[3]]) plot(f[[4]]) plot(f[[5]])
Computes the hypothetical illumination of a surface by setting the position of
the sun and calculating the illumination values for each grid cell of a DEM. The
hill_shade function is based upon the vectorial algebra algorithms developed
by Corripio (2003). This function has been
optimized and updated to take advantage of the infrastructure provided by the terra package.
hill_shade(dem, SZA, SAA)hill_shade(dem, SZA, SAA)
dem |
SpatRaster. Digital elevation model representing terrain elevation on a regular grid. |
SZA |
SpatRaster or numeric. Solar zenith angle in degrees. |
SAA |
SpatRaster or numeric. Solar azimuth angle in degrees. |
Returns a hillshade map in SpatRaster format.
Corripio JG (2003). “Vectorial algebra algorithms for calculating terrain parameters from DEMs and solar radiation modelling in mountainous terrain.” International Journal of Geographical Information Science, 17(1), 1–23. doi:10.1080/713811744.
library(terra) dem <- system.file("extdata/athabasca_dem.tif", package = "SatRbedo") dem <- terra::rast(dem) SZA <- 49 SAA <- 165 hs <- hill_shade(dem, SZA, SAA) plot(hs, col = grey(1:100 / 100))library(terra) dem <- system.file("extdata/athabasca_dem.tif", package = "SatRbedo") dem <- terra::rast(dem) SZA <- 49 SAA <- 165 hs <- hill_shade(dem, SZA, SAA) plot(hs, col = grey(1:100 / 100))
This function creates an NDSII histogram with a vertical line showing the selected threshold discriminating snow and ice.
NDSII_hist(NDSII, th, breaks = 64, stdev = 2)NDSII_hist(NDSII, th, breaks = 64, stdev = 2)
NDSII |
SpatRaster. Normalized Difference Snow Ice Index (NDSII). |
th |
numeric. NDSII threshold to discriminate between snow and ice. |
breaks |
one of:
In the last three cases the number is a suggestion only; as the
breakpoints will be set to |
stdev |
numeric. Standard deviation cutoff value for histogram stretching. |
preproc(), snow_or_ice(), graphics::hist()
green <- system.file("extdata/athabasca_2020253_B03_S30.tif", package = "SatRbedo") nir <- system.file("extdata/athabasca_2020253_B8A_S30.tif", package = "SatRbedo") outline <- system.file("extdata/athabasca_outline.shp", package = "SatRbedo") green <- preproc(grd = green, outline = outline) nir <- preproc(grd = nir, outline = outline) res <- snow_or_ice(green, nir) NDSII_hist(res$NDSII, res$th, breaks = 16, stdev = 3)green <- system.file("extdata/athabasca_2020253_B03_S30.tif", package = "SatRbedo") nir <- system.file("extdata/athabasca_2020253_B8A_S30.tif", package = "SatRbedo") outline <- system.file("extdata/athabasca_outline.shp", package = "SatRbedo") green <- preproc(grd = green, outline = outline) nir <- preproc(grd = nir, outline = outline) res <- snow_or_ice(green, nir) NDSII_hist(res$NDSII, res$th, breaks = 16, stdev = 3)
preproc() crops an input grid to a specified extent with a polygon or SpatExtent,
reprojects the grid to a specified coordinate system, and converts the data from integer
to floating point using an offset and a scale factor.
preproc( grd, drivers = NULL, outline = NULL, coords = NULL, add_offset = 0, scale_factor = 1 )preproc( grd, drivers = NULL, outline = NULL, coords = NULL, add_offset = 0, scale_factor = 1 )
grd |
filename (character) or SpatRaster of the raster to be processed, in one of GDAL's raster drivers. |
drivers |
character. GDAL drivers to consider |
outline |
filename (character) of the shapefile containing the outline of the area
of interest, in |
coords |
filename (character) or SpatRaster of the raster with the coordinate system definition. Alternatively, a coordinate reference system (CRS) description can be provided. In this case, the CRS can be described using the PROJ-string (e.g., "+proj=longlat +datum=WGS84") or the WKT format (e.g., "EPSG:4326"). |
add_offset |
band-specific offset added to each grid value. Defaults to zero. |
scale_factor |
band-specific scale factor applied to each grid value. Defaults to one. |
Returns a pre-processed SpatRaster grid.
terra::rast(), terra::ext(), and terra::project() which this function wraps.
# uncorrected grid f <- system.file("extdata/athabasca_2020253_B03_S30.tif", package = "SatRbedo") preproc(grd = f) # crop grid g <- system.file("extdata/athabasca_2020253_B03_S30.tif", package = "SatRbedo") v <- system.file("extdata/athabasca_outline.shp", package = "SatRbedo") preproc(grd = g, outline = v) # crop and reproject grid g <- system.file("extdata/athabasca_2020253_B03_S30.tif", package = "SatRbedo") v <- system.file("extdata/athabasca_outline.shp", package = "SatRbedo") preproc(grd = g, outline = v, coords = "+proj=longlat +datum=WGS84") preproc(grd = g, outline = v, coords = "EPSG:4326") # Transform grid values library(terra) g <- system.file("extdata/athabasca_2020253_B03_S30.tif", package = "SatRbedo") orig <- preproc(grd = g) minmax(orig) new <- preproc(grd = g, add_offset = 5, scale_factor = 10) minmax(new)# uncorrected grid f <- system.file("extdata/athabasca_2020253_B03_S30.tif", package = "SatRbedo") preproc(grd = f) # crop grid g <- system.file("extdata/athabasca_2020253_B03_S30.tif", package = "SatRbedo") v <- system.file("extdata/athabasca_outline.shp", package = "SatRbedo") preproc(grd = g, outline = v) # crop and reproject grid g <- system.file("extdata/athabasca_2020253_B03_S30.tif", package = "SatRbedo") v <- system.file("extdata/athabasca_outline.shp", package = "SatRbedo") preproc(grd = g, outline = v, coords = "+proj=longlat +datum=WGS84") preproc(grd = g, outline = v, coords = "EPSG:4326") # Transform grid values library(terra) g <- system.file("extdata/athabasca_2020253_B03_S30.tif", package = "SatRbedo") orig <- preproc(grd = g) minmax(orig) new <- preproc(grd = g, add_offset = 5, scale_factor = 10) minmax(new)
Detects and removes self-shadowed pixels (i.e., pixels having
aspect angles oriented away from the sun) and cast shadows (i.e,
pixels facing towards the direction of the sun but where sunlight
is blocked by neighbor topographic features such as mountains).
Self-shadowed pixels are detected when the angle between the sun
and the vector normal to the grid cell's surface is higher than
. Cast shadows are calculated using the
cast_shadows() function.
shadow_removal(dem, SZA, SAA, mask = TRUE)shadow_removal(dem, SZA, SAA, mask = TRUE)
dem |
SpatRaster. Digital elevation model representing terrain elevation on a regular grid. |
SZA |
SpatRaster or numeric. Solar zenith angle in degrees. |
SAA |
SpatRaster or numeric. Solar azimuth angle in degrees. |
mask |
logical. If |
Returns a SpatRaster with topographic shadows removed.
library(terra) dem <- system.file("extdata/athabasca_dem.tif", package = "SatRbedo") dem <- terra::rast(dem) SZA <- 49 SAA <- 165 msk <- shadow_removal(dem, SZA, SAA, mask = TRUE) plot(msk, col = "blue") # Overlay an RGB composite with the shadow masks blue <- preproc(system.file("extdata/athabasca_2020253_B02_S30.tif", package = "SatRbedo")) green <- preproc(system.file("extdata/athabasca_2020253_B03_S30.tif", package = "SatRbedo")) red <- preproc(system.file("extdata/athabasca_2020253_B04_S30.tif", package = "SatRbedo")) r <- c(stretch(blue), stretch(green), stretch(red)) RGB(r) <- c(3, 2, 1) plot(r) msk <- shadow_removal(dem, SZA, SAA, mask = FALSE) plot(msk, col = grey(0:1), alpha = 0.2, add = TRUE)library(terra) dem <- system.file("extdata/athabasca_dem.tif", package = "SatRbedo") dem <- terra::rast(dem) SZA <- 49 SAA <- 165 msk <- shadow_removal(dem, SZA, SAA, mask = TRUE) plot(msk, col = "blue") # Overlay an RGB composite with the shadow masks blue <- preproc(system.file("extdata/athabasca_2020253_B02_S30.tif", package = "SatRbedo")) green <- preproc(system.file("extdata/athabasca_2020253_B03_S30.tif", package = "SatRbedo")) red <- preproc(system.file("extdata/athabasca_2020253_B04_S30.tif", package = "SatRbedo")) r <- c(stretch(blue), stretch(green), stretch(red)) RGB(r) <- c(3, 2, 1) plot(r) msk <- shadow_removal(dem, SZA, SAA, mask = FALSE) plot(msk, col = grey(0:1), alpha = 0.2, add = TRUE)
Calculates the Normalized Difference Snow Ice Index (NDSII) (Keshri et al. 2009) to discriminate between snow and ice surfaces. The discrimination is performed using an automatic threshold selection method based on the Otsu algorithm (Otsu 1979).
snow_or_ice(green, NIR)snow_or_ice(green, NIR)
green |
SpatRaster. Green band surface reflectance (0.53-0.59 um). |
NIR |
SpatRaster. Near-infrared band surface reflectance (0.85-0.88 um). |
Returns a list with two objects. The first component is an NDSII SpatRaster and the second component provides the optimal threshold to discriminate between snow and ice surfaces.
Keshri AK, Shukla A, Gupta RP (2009).
“ASTER ratio indices for supraglacial terrain mapping.”
International Journal of Remote Sensing, 30(2), 519–524.
doi:10.1080/01431160802385459.
Otsu N (1979).
“A Threshold Selection Method from Gray-Level Histograms.”
IEEE Transactions on Systems, Man, and Cybernetics, 9(1), 62–66.
doi:10.1109/TSMC.1979.4310076.
preproc(), EBImage::otsu(), terra::plot()
green <- system.file("extdata/athabasca_2020253_B03_S30.tif", package = "SatRbedo") nir <- system.file("extdata/athabasca_2020253_B8A_S30.tif", package = "SatRbedo") outline <- system.file("extdata/athabasca_outline.shp", package = "SatRbedo") green <- preproc(grd = green, outline = outline) nir <- preproc(grd = nir, outline = outline) res <- snow_or_ice(green, nir) # Plot NDSII library(terra) plot(res$NDSII, range = c(-0.5, 0.5)) # Plot a cover type binary map (snow/ice) library(terra) plot(res$NDSII > res$th, type = "classes", col = c("#FFFFC8", "#00407F"), levels = c("snow", "ice"))green <- system.file("extdata/athabasca_2020253_B03_S30.tif", package = "SatRbedo") nir <- system.file("extdata/athabasca_2020253_B8A_S30.tif", package = "SatRbedo") outline <- system.file("extdata/athabasca_outline.shp", package = "SatRbedo") green <- preproc(grd = green, outline = outline) nir <- preproc(grd = nir, outline = outline) res <- snow_or_ice(green, nir) # Plot NDSII library(terra) plot(res$NDSII, range = c(-0.5, 0.5)) # Plot a cover type binary map (snow/ice) library(terra) plot(res$NDSII > res$th, type = "classes", col = c("#FFFFC8", "#00407F"), levels = c("snow", "ice"))
This tool corrects surface reflectance for the effects of topography. The objective of the topographic correction is to compensate for the differences in solar illumination to minimize the variability of observed reflectance for similar targets and obtain the equivalent reflectance values over flat terrain. The empirical methods provided here are suitable for mountain environments with rugged topography and non-Lambertian surface properties. More details about these methods can be found in the references below.
topo_corr(band, dem, SAA, SZA, method = "tanrotation", IC_min = NULL)topo_corr(band, dem, SAA, SZA, method = "tanrotation", IC_min = NULL)
band |
SpatRaster. Spectral band to be corrected. |
dem |
SpatRaster. Digital elevation model representing terrain elevation on a regular grid. |
SAA |
SpatRaster or numeric. Solar azimuth angle in degrees. |
SZA |
SpatRaster or numeric. Solar zenith angle in degrees. |
method |
character. Topographic correction model to be used. Two options are available: "tanrotation" (implements the rotation model proposed by Tan et al. 2010), and "ccorrection" (C model, Teillet et al. 1982). |
IC_min |
numeric. Minimum incidence angle to mask out regions of low illumination. |
Returns a list with two objets. The first component is a SpatRaster with two layers providing the illumination condition (IC) and the corrected surface reflectance, and the second component contains the values of the empirical parameters obtained by each topographic correction model.
Chen R, Yin G, Zhao W, Yan K, Wu S, Hao D, Liu G (2023).
“Topographic Correction of Optical Remote Sensing Images in Mountainous Areas: A systematic review.”
IEEE Geoscience and Remote Sensing Magazine, 11(4), 125–145.
doi:10.1109/MGRS.2023.3311100.
Riaño D, Chuvieco E, Salas J, Aguado I (2003).
“Assessment of different topographic corrections in Landsat-TM data for mapping vegetation types.”
IEEE Transactions on Geoscience and Remote Sensing, 41(5), 1056–1061.
doi:10.1109/TGRS.2003.811693.
Tan B, Masek JG, Wolfe R, Gao F, Huang C, Vermote EF, Sexton JO, Ederer G (2013).
“Improved forest change detection with terrain illumination corrected Landsat images.”
Remote Sensing of Environment, 136, 469–483.
doi:10.1016/j.rse.2013.05.013.
Tan B, Wolfe R, Masek J, Gao F, Vermote EF (2010).
“An illumination correction algorithm on Landsat-TM data.”
In 2010 IEEE International Geoscience and Remote Sensing Symposium, 1964-1967.
doi:10.1109/IGARSS.2010.5653492.
Teillet PM, Guindon B, Goodenough DG (1982).
“On the Slope-Aspect Correction of Multispectral Scanner Data.”
Canadian Journal of Remote Sensing, 8(2), 84–106.
doi:10.1080/07038992.1982.10855028.
preproc(), landsat::topocorr()
library(terra) outline <- system.file("extdata/athabasca_outline.shp", package = "SatRbedo") nir <- system.file("extdata/athabasca_2020253_B8A_S30.tif", package = "SatRbedo") dem <- system.file("extdata/athabasca_dem.tif", package = "SatRbedo") nir <- preproc(grd = nir) dem <- preproc(grd = dem) SAA <- 164.8 SZA <- 48.9 # Topographic correction using method="tanrotation" corr <- topo_corr(band = nir, dem = dem, SAA = SAA, SZA = SZA, method = "tanrotation") plot(corr$bands[[1]]) # plot IC plot(corr$bands[[2]]) # plot corrected surface reflectance # Topographic correction using method="ccorrection" corr <- topo_corr(band = nir, dem = dem, SAA = SAA, SZA = SZA, method = "ccorrection", IC_min = 0.3) plot(corr$bands[[2]]) # plot corrected surface reflectancelibrary(terra) outline <- system.file("extdata/athabasca_outline.shp", package = "SatRbedo") nir <- system.file("extdata/athabasca_2020253_B8A_S30.tif", package = "SatRbedo") dem <- system.file("extdata/athabasca_dem.tif", package = "SatRbedo") nir <- preproc(grd = nir) dem <- preproc(grd = dem) SAA <- 164.8 SZA <- 48.9 # Topographic correction using method="tanrotation" corr <- topo_corr(band = nir, dem = dem, SAA = SAA, SZA = SZA, method = "tanrotation") plot(corr$bands[[1]]) # plot IC plot(corr$bands[[2]]) # plot corrected surface reflectance # Topographic correction using method="ccorrection" corr <- topo_corr(band = nir, dem = dem, SAA = SAA, SZA = SZA, method = "ccorrection", IC_min = 0.3) plot(corr$bands[[2]]) # plot corrected surface reflectance
This function creates a scatterplot of surface reflectance vs. illumination condition (IC). The plot can be used to explore the dependency of the original and the topographically-corrected surface reflectance data on IC.
topo_splot(IC, band, maxcell = 1e+05)topo_splot(IC, band, maxcell = 1e+05)
IC |
SpatRaster. Illumination condition. |
band |
SpatRaster. Spectral band to be processed. |
maxcell |
positive integer. Maximum number of cells to use for the plot |
topo_corr(), graphics::abline(), stats::lm()
outline <- system.file("extdata/athabasca_outline.shp", package = "SatRbedo") nir <- system.file("extdata/athabasca_2020253_B8A_S30.tif", package = "SatRbedo") dem <- system.file("extdata/athabasca_dem.tif", package = "SatRbedo") nir <- preproc(grd = nir) dem <- preproc(grd = dem) SAA <- 164.8 SZA <- 48.9 corr <- topo_corr(band = nir, dem = dem, SAA = SAA, SZA = SZA, method = "tanrotation") # Scatterplot of IC vs. uncorrected surface reflectance topo_splot(corr$bands[[1]], nir) # Scatterplot of IC vs. topographically-corrected surface reflectance topo_splot(corr$bands[[1]], corr$bands[[2]])outline <- system.file("extdata/athabasca_outline.shp", package = "SatRbedo") nir <- system.file("extdata/athabasca_2020253_B8A_S30.tif", package = "SatRbedo") dem <- system.file("extdata/athabasca_dem.tif", package = "SatRbedo") nir <- preproc(grd = nir) dem <- preproc(grd = dem) SAA <- 164.8 SZA <- 48.9 corr <- topo_corr(band = nir, dem = dem, SAA = SAA, SZA = SZA, method = "tanrotation") # Scatterplot of IC vs. uncorrected surface reflectance topo_splot(corr$bands[[1]], nir) # Scatterplot of IC vs. topographically-corrected surface reflectance topo_splot(corr$bands[[1]], corr$bands[[2]])