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).

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).

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).

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").

Note

License: GPL 3.0

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. DOI: 10.1016/j.cageo.2020.104473, URL: http://sen2r.ranghetti.info/.

Author

Luigi Ranghetti, phD (2020) luigi@ranghetti.info

Examples

# \donttest{ # Read default values read_gipp(c("dem_directory", "dem_reference"))
#> $dem_directory #> [1] "NONE" #> #> $dem_reference #> [1] "http://data_public:GDdci@data.cgiar-csi.org/srtm/tiles/GeoTIFF/" #>
# 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)
#> $DEM_Directory #> [1] "/home/lranghetti/.sen2r/srtm90" #> #> $DEM_Reference #> [1] "http://data_public:GDdci@data.cgiar-csi.org/srtm/tiles/GeoTIFF/" #>
# 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)
#> $DEM_Directory #> [1] "NONE" #> #> $DEM_Reference #> [1] "http://data_public:GDdci@data.cgiar-csi.org/srtm/tiles/GeoTIFF/" #>
# }