Learn R Programming

RGISTools (version 1.0.2)

genSmoothingIMA: Fill data gaps and smooth outliers in a time series of satellite images

Description

genSmoothingIMA is the implementation of a spatio temporal method called image mean anomaly (IMA) for gap filling and smoothing satellite data militino2019interpolationRGISTools.

Usage

genSmoothingIMA(
  rStack,
  Img2Fill = NULL,
  nDays = 3,
  nYears = 1,
  fact = 5,
  fun = mean,
  r.dates,
  aFilter = c(0.05, 0.95),
  only.na = FALSE,
  factSE = 8,
  predictSE = FALSE,
  snow.mode = FALSE,
  out.name = "outname",
  ...
)

Arguments

rStack

a RasterStack class argument containing a time series of satellite images. Layer names should contain the date of the image in "YYYYJJJ" format.

Img2Fill

a vector argument defining the images to be filled/smoothed.

nDays

a numeric argument with the number of previous and subsequent days that define the temporal neighborhood.

nYears

a numeric argument with the number of previous and subsequent years that define the temporal neighborhood.

fact

a numeric argument with an aggregation factor of the anomalies before the interpolation.

fun

a function used to aggregate the image of anomalies. Both mean (default) or median are acceptted.

r.dates

a vector argument containing the dates of the layers in rstack

aFilter

a vector with the lower and upper quantiles that define the outliers of the anomalies. Ex. c(0.05,0.95).

only.na

logical argument. If TRUE only fills the NA values. FALSE by default.

factSE

the fact used in the standard error prediction.

predictSE

calculate the standard error instead the prediction.

snow.mode

logical argument. If TRUE, the filling process will be parallelized using the `raster' package.

out.name

the name of the folder containing the smoothed/filled images when saved in the Hard Disk Device (HDD).

...

arguments for nested functions:

  • AppRoot the path where the filled/smoothed time series of images will be saved in GTiff format.

Value

a RasterStack with the filled/smoothed images.

Details

This filling/smoothing method was developed by militino2019interpolation;textualRGISTools. This technique decomposes a time series of images into a new series of mean and anomaly images. The procedure applies the smoothing algorithm over the anomaly images. The procedure requires a proper definition of a temporal neighbourhood for the target image and aggregation factor.

References

militino2019interpolationRGISTools

Examples

Run this code
# NOT RUN {
# load an example of NDVI time series in Navarre
data(ex.ndvi.navarre)
# the 2 images to be filled and the neighbourhood
genPlotGIS(ex.ndvi.navarre)

# filled images
tiles.mod.ndvi.filled  <- genSmoothingIMA(ex.ndvi.navarre,
                               Img2Fill = c(1),
                               only.na=TRUE)
# show the filled images
genPlotGIS(tiles.mod.ndvi.filled)
# plot comparison of the cloud and the filled images
tiles.mod.ndvi.comp <- stack(ex.ndvi.navarre[[1]], tiles.mod.ndvi.filled[[1]],
                             ex.ndvi.navarre[[2]], tiles.mod.ndvi.filled[[2]])
genPlotGIS(tiles.mod.ndvi.comp, layout=c(2, 2))
# }

Run the code above in your browser using DataLab