.calc_index | R Documentation |
This function is used internally to calculate a spectral index using the
gdalcubes package. It is called by calcIndex()
on a given set of SAFE
directories. A user defined cube view defined by the x and y resolution,
the time resolution, a CRS, as well as aggregation methods is applied.
Additionally, the time dimension can be aggregated which is useful for seasonal
calculations of a given index. The output of the function is a GTiff
file
for each time step labeled as <label>_<index>_<timestep>.tif
. Zonal statistics
are written to a Geopackage for each timestep labeled as <label>_<index>_<timestep>.gpkg
to outdir.
.calc_index( files, format = "mapme.vegetation/inst/sentinel2_l2a_cog.json", DB_path = NULL, dx = NULL, dy = NULL, dt = NULL, srs = NULL, bbox = NULL, aggregation = "median", resampling = "bilinear", after = NULL, before = NULL, tmpagg = FALSE, index = NULL, bands = NULL, label = NULL, outdir = ".", mask_layer = "SCL", mask_values = c(3, 8, 9), mask_invert = FALSE, overwrite = F, chunking = c(1, 256, 256), threads = 1, verbose = TRUE, ... )
files |
A character vector with the filepaths to the raster files for which gap-filling and a smoothing function shall be applied. |
format |
A charachter vector pointing to a json file with a gdalcubes format description of the input files. |
DB_path |
A charachter vector where the gdalcubes data base file indexing the spatiotemporal extents of files. Defaults to NULL which means a temporary file is used. Can be pointed to a file ending in ".db" to speed up later iterations. |
dx |
A numeric specifying the resolution of the output raster in x dimension
expressed in the map unit specified in |
dy |
A numeric specifying the resolution of the output raster in y dimension
expressed in the map unit specified in |
dt |
Resolution of the time dimension expressed as ISO8601 string
(e.g. |
srs |
Target spatial reference system as a string; can be a proj4 definition,
WKT, or in the form "EPSG:XXXX" (see |
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 |
A character vector specifying the aggregation method for
images of the same time stamp. Must be one of |
resampling |
A character specifying the resampling method used to transform
images from their native CRS to the output CRS. Can be any of the methods
supported by gdalwarp (see www.gdal.org/programs/gdalwarp.html).
Defaults to |
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. |
tmpagg |
A logical indicating if temporal aggregation of all timestemps should
be performed calling |
index |
A character specifying the short name of the index to be calculated.
Available indices can be checked with |
bands |
A character vector specifying the bands to extract. Defaults to NULL. If specified argument index must be set to NULL. |
label |
A character label which is appended to the output files in the
form of |
outdir |
A character specifying an existing directory where output files
will be written to. Defaults to |
mask_layer |
Name of a layer in the data cube used for masking. |
mask_values |
An integer vector with mask values. Masking behaviour
is controlled with the |
mask_invert |
If TRUE the values specified in |
overwrite |
A logical indicating if existing files in outdir should be overwritten. |
chunking |
Vector of length 3 defining the size of data cube chunks in the
order time, y, x. (see |
threads |
Number of cores used for parallel processing |
verbose |
A logical indicating the verbosity. |
... |
additional arguments to |
Nothing. However a GTiff
and a GPKG
with the zonal statistics are written to
outdir
for every resulting timestep.
See cube_view
for more information.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.