nightmares
provide common functions used in remote sensing analysis (e.g., conversion from digital numbers to radiance, reflectance, and temperature). It includes several algorithms to calculate the albedo: Liang (2000), Silva et al. (2016), Tasumi et al. (2008), among others. The tasseled cap transformation is made according to Baig et al., (2014). Although the current version implements basic functions, it will be expandable to a more robust tool for water cycle modeling (e.g., to include surface runoff and evapotranspiration calculations) in the near future. This package is under development at the Hydro-Geomatic Lab, Institute about Natural Resources Research (INIRENA) from the Universidad Michoacana de San Nicolás de Hidalgo.
Nightmares
package depends on other libraries to run (raster, sp, rgdal). Thus, to make available Nightmares
in the R environment you must install the raster
, sp
and rgdal
packages.
# Load the following libraries.
library(raster)
#> Loading required package: sp
library(rgdal)
#> rgdal: version: 1.3-2, (SVN revision 755)
#> Geospatial Data Abstraction Library extensions to R successfully loaded
#> Loaded GDAL runtime: GDAL 2.2.3, released 2017/11/20
#> Path to GDAL shared files: C:/Users/Veirus/Documents/R/win-library/3.4/rgdal/gdal
#> GDAL binary built with GEOS: TRUE
#> Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
#> Path to PROJ.4 shared files: C:/Users/Veirus/Documents/R/win-library/3.4/rgdal/proj
#> Linking to sp version: 1.3-1
library(sp)
library(nightmares)
Each funtion have their own data requirements. If you go to the installed folder (Nightmare), you will find LANDSAT OLI BANDS, overall:
library(raster)
# Define a working directory
setwd(“C:/Users/Veirus/Desktop/nightmares”)
bands <- stack(list.files(“./Data”,“.tif”,full.names=TRUE))
This function Convert Digital Numbers (Landsat Level-1 data) to TOA Radiance using the radiance rescaling factors in the MTL file. It requires the stack of Landsat bands from the previous step.
rad <- rad_oli(bands)
plot(rad)
# If you want to save the outputs
writeRaster(rad,“./Radiance.grd”, format=“raster”)
Reflective band DN’s are converted to TOA reflectance using the rescaling coefficients in the MTL file. This function requires the stack of Landsat bands and the sun elevation in degrees. You can find the SUN ELEVATION in the MLT file.
ref <- ref_oli(bands, sun.elev = 67.97)
plot(ref)
# If you want to save the outputs
writeRaster(ref,“./Reflectance.grd”, format=“raster”)
This function calculates the albedo values using different algorithms (e.g., Chemin, Liang, Olmedo, Silva, Tasumi). It requires the stack of Landsat bands from the previous step (reflectances). You must specify a method “Chemin, Liang, Olmedo, Silva, Tasumi”.
C <- alb_oli(bands, method= “Chemin”)
plot(C)
# If you want to save the outputs
writeRaster(ref,“./Albedo_Chemin.grd”, format=“raster”)
Thermal band data can be converted from spectral radiance to top of atmosphere brightness temperature using the thermal constants in the MTL file. This function requires a raster containing the Landsat OLI band 10 or 11. You must specify if your raster is the Landsat OLI band 10 or 11 as well as the desired units (Celsius, Kelvin, or Fahrenheit degrees).
B10 <- raster(“./Data/3047_20190517_B10.tif”)
B11 <- raster(“./Data/3047_20190517_B11.tif”)
Celsius10 <- thermal_oli(B10, 10, “Celsius”)
kelvin <- thermal_oli(B11, 11, “Kelvin”)
far <- thermal_oli(B11, 11, “Fahrenheit”)
plot(Celsius10)
Tasselled Cap Transformation. This function requires a raster stack containing the reflectance values of first seven Landsat OLI bands. Outputs of this function include: Layer.1 - Brightness; Layer.2 - Greenness; Layer.3 - Wetness.
tass <- tasscap_oli(ref)
names(tass) <- c(‘Brightness’, ‘Greenness’, ‘Wetness’)
plot(tass)
This function requires Landsat Surface Reflectance from Landsat 8 Operational Land Imager to derive spectral indices. The spectral indices with Landsat 8 derived with this function are:
layer.1: Normalized Difference Vegetation Index (NDVI);
layer.2: Enhanced Vegetation Index (EVI);
layer.3: Soil Adjusted Vegetation Index (SAVI);
layer.4: Modified Soil Adjusted Vegetation Index (MSAVI);
layer.5: Normalized Difference Moisture Index (NDMI);
layer.6: Normalized Burn Ratio (NBR);
layer.7: Normalized Burn Ratio 2 (NBR2);
Layer.8: Advanced Vegetation Index (AVI);
Layer.9: Bare Soil Index (BSI);
indices <- dsi_oli(ref)
names(indices) <- c(‘NDVI’, ‘EVI’, ‘SAVI’, ‘MSAVI’, ‘NDMI’, ‘NBR’, ‘NBR2’, ‘AVI’, ‘BSI’)
plot(indices)
This function also offers the possibility to estimate individually many index (NDVI, EVVI, SAVI, MSAVI, NDMI, NBR, NBR2, NDWI, MNDWI, AVI, SI, BSI, LAI, among others).
This function is used to the estimation of monthly ETo with the FAO Penman-Montheith equation. The meteorological data, required to estimate ETo by means of the FAO Penman-Monteith equation, consist of air temperature, air humidity, wind speed and radiation. Where some of these data are missing or cannot be calculated, it is strongly recommended that the user estimate the missing climatic data. The ETo calculation procedure here is for a data set containing only maximum and minimum air temperature. It is based on the FAO Irrigation and drainage paper 56.
# Calculate the atmospheric pressure
# Specify the elevation above sea level in meters
P <- atm_pressure(z= 1120)
print(paste(“The atmospheric pressure =”, P, “kPa”))
# Calculate the solar radiation
Rs <- solrad(kRs= 0.19, tmax= 25, tmin= 15, lat= 43.5, doy= 150)
print(paste(“The solar radiation is”, Rs, “MJ/sq.m/d”))
# Calculate the reference evapotranspiration
et0 <- ETo56_miss(lat= 45.72, z= 200, doy= 196, tmax= 26.6, tmin= 14.8, tdew= 14.8, u2= 2, Rs= 22.29, P= 98.96)
print(paste(“Reference evapotranspiration =”, et0, “mm/day”))
[Allen et al., 1998. Crop Evapotranspiration. Guidelines for computing crop water requirements. FAO Irrigation and drainage paper 56.]
[Baig et al., 2014. Derivation of a tasselled cap transformation based on Landsat 8 at-satellite reflectance. Remote Sensing Letters 5(5), 423-431.]
[Chemin Method, please see i.albedo function (GRASS). Only for OLI images.]
[Liang, S. 2000. Narrowband to broadband conversions of land surface albedo I: Algorithms. Remote Sensing of Environment, 76(2): 213-238.]
[Olmedo et al., 2016. water: Tools and functions to estimate actual evapotranspiration Using land surface energy balance models in R. The R journal, 8(2), 352-369.]
[Silva et al., 2016. Procedures for calculation of the albedo with OLI-Landsat 8 images: Application to the Brazilian semi-arid. Revista Brasileira de Engenharia Agrícola e Ambiental, 20(1), 3-8.]
[Tasumi et al., 2008. At-Surface Reflectance and Albedo from Satellite for Operational Calculation of Land Surface Energy Balance. Journal of Hydrologic Engineering, 13, 51-63.]