gipp: Manage GIPP parameters for Sen2Cor

read_gippR Documentation

Manage GIPP parameters for Sen2Cor

Description

read_gipp() reads Ground Image Processing Parameters (GIPP) from the default sen2r GIPP path or from an XML file.

set_gipp() modifies values of a list of GIPP in an XML file (or creates a new XML file with the desired GIPP).

Usage

read_gipp(gipp_names, gipp_path = NA)

set_gipp(gipp = list(), gipp_path = NA, use_dem = NA)

Arguments

gipp_names

Character vector with the names of the parameters to be read.

gipp_path

Character path of the GIPP XML file to be read (read_gipp()) or written (set_gipp()). In read_gipp(), if NA (default), the default sen2r GIPP path is read; in set_gipp(), setting this argument is mandatory (see details).

gipp

(optional) Ground Image Processing Parameters (GIPP) (see sen2cor() for further details). Elements whose name is missing in the XML file are skipped.

use_dem

Logical, determining if a DEM should be set for being used for topographic correction in the XML specified with argument gipp_path (see sen2cor() for further details).

Details

In set_gipp(), editing /resetting the default sen2r GIPP XML file was disabled to grant code reproducibility among different machines (an error is returned if gipp_path is not set). Users who want to do that (being aware of the risk doing that) must explicitly define the argument gipp_path as the path of the default GIPP file, which is file.path(dirname(attr(load_binpaths(), "path")), "sen2r_L2A_GIPP.xml").

Value

read_gipp() returns a named list of GIPP with the required parameters (values not found in the XML are skipped).

set_gipp() returns NULL (the function is called for its side effects).

Note

License: GPL 3.0

Author(s)

Luigi Ranghetti, phD (2020)

References

L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). "sen2r": An R toolbox for automatically downloading and preprocessing Sentinel-2 satellite data. Computers & Geosciences, 139, 104473. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.cageo.2020.104473")}, URL: https://sen2r.ranghetti.info/.

Examples

## Not run: 
if (!is.null(load_binpaths()$sen2cor)) {
# Read default values
read_gipp(c("dem_directory", "dem_reference"))
# Set the use of a topographic correction
set_gipp(use_dem = TRUE, gipp_path = gipp_temp <- tempfile())
# Read the parameters in the created temporary files
read_gipp(c("DEM_Directory", "DEM_Reference"), gipp_path = gipp_temp)
# Set not to use a topographic correction
set_gipp(use_dem = FALSE, gipp_path = gipp_temp <- tempfile())
# This is equivalent to:
# set_gipp(
#   list(DEM_Directory = NA, DEM_Reference = NA), 
#   gipp_path = gipp_temp <- tempfile()
# )
# Read again the parameters in the created temporary files
read_gipp(c("DEM_Directory", "DEM_Reference"), gipp_path = gipp_temp)
}

## End(Not run)

ranghetti/fidolasen documentation built on March 27, 2024, 9:37 p.m.