smooth_cube | R Documentation |
This function is used to conduct a linear interpolation of missing values in the time series of vegetation indices on a pixel basis. By default a Savitzkiy-Golay filter is used to smooth the time series. A custom function for the interpolation and smoothing can be specified. It can be used on equally spaced data cubes in the time dimension where missing values, e.g. through clouds, are an issue. The result of the function is a dense time series where missing values are imputed and a smoothing function is applied to reduce the noise in the signal.
smooth_cube( files = NULL, bands = NULL, times = NULL, dx = NULL, dy = NULL, dt = NULL, srs = NULL, after = NULL, before = NULL, timeframe = "full", bbox = NULL, aggregation = "mean", resampling = "bilinear", smoothing_function = NULL, chunking = c(1, 256, 256), threads = 1, outdir = ".", overwrite = F, label = "", n = 100, verbose = T, ... )
files |
A character vector with the filepaths to the raster files for which gap-filling and a smoothing function shall be applied. |
bands |
A character vector indicating the names of the bands in each
of the raster files specified in the |
times |
A character vector indicating the date of each raster file specified
in the |
dx |
The spatial resolution of the outcome raster files in the |
dy |
The spatial resolution of the outcome raster files in the |
dt |
The temporal resolution of the outcome raster files.
(see |
srs |
Target spatial reference system as a string; can be a proj4 definition,
WKT, or in the form "EPSG:XXXX" (see |
after |
A length one character vector in the form " the earliest date (inclusive) included in the temporal extent. |
before |
A length one character vector in the form " the latest date (inclusive) included in the temporal extent. |
timeframe |
A character of either |
bbox |
A numeric vector of lenght four indicating the spatial bounding
box of the query (xmin, ymin, xmax, ymax) in geographic coordinates. Defaults
to 'NULL' which will set the spatial extent to global, i.e. |
aggregation |
aggregation method as string, defining how to deal with pixels
containing data from multiple images, can be "min", "max", "mean", "median", or "first"
(see |
resampling |
resampling method used in gdalwarp when images are read, can be
"near", "bilinear", "bicubic" or others as supported by gdalwarp
(see https://gdal.org/programs/gdalwarp.html and |
smoothing_function |
Defaults to NULL which means that a linear
interpolation coupled with |
chunking |
Vector of length 3 defining the size of data cube chunks in the
order time, y, x. (see |
threads |
Number of threads used to process data cubes
(see |
outdir |
A character vector pointing to an existing directory where the output rasters are written to. |
overwrite |
A logical indicating if existing files in outdir should be overwritten. |
label |
A character vector which is used as a prefix to the output filenames. |
n |
The ratio of pixels for which a custom |
verbose |
A logical indicating the verbosity. |
... |
additional arguments to |
Darius Görgen (MapTailor Geospatial Consulting GbR) info@maptailor.net
Maintainer: MAPME-Initiative contact@mapme-initiative.org
Contact Person: Dr. Johannes Schielein
Copyright: MAPME-Initiative
License: GPL-3
## Not run: smoothing_function = function(x){ results = lapply(1:nrow(x), function(i) { y = x[i,] lin = zoo::na.approx(y, na.rm = F, rule = 2) svg = signal::sgolayfilt(lin) svg }) do.call(rbind, results) } ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.