The function safe_getMetadata()
scans a Sentinel2 product
(main path, granule path, main / granule xml file or GDAL object)
to retrieve information about the product.
The accessory function rm_invalid_safe()
remove a SAFE archive in the case
it is not recognised by safe_getMetadata()
.
The accessory function safe_isvalid()
scan the SAFE name to understand
if it is a valid SAFE.
safe_getMetadata(s2, info = "all", abort = TRUE) rm_invalid_safe(s2) safe_isvalid(s2, info = "fileinfo")
s2 | A Sentinel-2 product, being both a |
---|---|
info | (optional) A character vector with the list of the metadata which should be provided. Accepted values are:
|
abort | Logical parameter: if TRUE (default), the function aborts
in case |
safe_getMetadata()
returns a list of the output metadata;
rm_invalid_safe()
returns TRUE if the s2
product was removed,
FALSE elsewhere.
safe_isvalid()
returns TRUE if the product is a valid SAFE, FALSE if not.
License: GPL 3.0
# Define product name s2_examplename <- "/path/of/the/product/S2A_MSIL1C_20170603T101031_N0205_R022_T32TQQ_20170603T101026.SAFE" # Return only the information retrevable from the file names (files are not scanned) safe_getMetadata(s2_examplename, info="nameinfo")#> $prod_type #> [1] "product" #> #> $version #> [1] "compact" #> #> $mission #> [1] "2A" #> #> $level #> [1] "1C" #> #> $sensing_datetime #> [1] "2017-06-03 10:10:31 UTC" #> #> $id_baseline #> [1] "0205" #> #> $id_orbit #> [1] "022" #> #> $id_tile #> [1] "32TQQ" #> #> $creation_datetime #> [1] "2017-06-03 10:10:26 UTC" #># Return some specific information without scanning files safe_getMetadata(s2_examplename, info="nameinfo")[c("level", "id_tile")]#> $level #> [1] "1C" #> #> $id_tile #> [1] "32TQQ" #># Return a single information without scanning files # (in this case, the output is a vector instead than a list) safe_getMetadata(s2_examplename, info="nameinfo")[["level"]]#> [1] "1C"# NOT RUN { # Return all the available information safe_getMetadata(s2_examplename) # Return some specific information safe_getMetadata(s2_examplename, info=c("tiles", "level", "id_tile")) # Return a single information safe_getMetadata(s2_examplename, info="clouds") # Delete it if it is not recognised rm_invalid_safe(s2_examplename) # }