diff --git a/DESCRIPTION b/DESCRIPTION index 1a28134..b90f361 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: theiaR Title: Download and Manage Data from Theia -Version: 0.2.0 +Version: 0.3.0 Authors@R: person("Xavier", "Laviron", email = "xavier.laviron@gmx.fr", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-9882-3253")) @@ -8,21 +8,21 @@ Description: Provides a simple interface to search available data provided by Theia (), download it, and manage it. Data can be downloaded based on a search result or from a cart file downloaded from Theia website. Depends: R (>= 3.5) -Imports: httr (>= 1.3), R6 (>= 2.3), raster (>= 2.6), tiff (>= 0.1), - tools (>= 3.5), XML (>= 3.86), askpass (>= 1.1) +Imports: httr (>= 1.3), R6 (>= 2.3), raster (>= 2.6), tools (>= 3.5), + XML (>= 3.86), askpass (>= 1.1) License: GPL (>= 3.0) URL: https://github.com/norival/theiaR BugReports: https://github.com/norival/theiaR/issues Encoding: UTF-8 LazyData: true -RoxygenNote: 6.1.1 -Suggests: knitr, rmarkdown, covr +RoxygenNote: 7.0.2 +Suggests: knitr, rmarkdown, covr, gdalcubes Collate: 'TheiaAuth.R' 'TheiaTile.R' 'TheiaCollection.R' 'TheiaQuery.R' 'theiaR.R' 'utils.R' VignetteBuilder: knitr NeedsCompilation: no -Packaged: 2019-03-26 12:21:58 UTC; lavironx +Packaged: 2020-01-20 15:32:30 UTC; xavier Author: Xavier Laviron [aut, cre] () Maintainer: Xavier Laviron Repository: CRAN -Date/Publication: 2019-03-26 12:30:03 UTC +Date/Publication: 2020-01-20 16:00:02 UTC diff --git a/MD5 b/MD5 index 2a3c113..17fcbce 100644 --- a/MD5 +++ b/MD5 @@ -1,23 +1,23 @@ -f58e7c76a96db32873f59418cc106ce7 *DESCRIPTION +32cd00ed1a391ef5127de3d0477e1a25 *DESCRIPTION ef23d45adbf8c14d401b111bc2893b63 *NAMESPACE -dd9e59e8e560094d6977fa7dbeda6f9b *NEWS.md +c9013bfe7c302967f41403a6d86cbce2 *NEWS.md 27473226eb1ecd86ec6f0a8a019aa46e *R/TheiaAuth.R -2cb15ee5c6a3645b9c36807e9d304556 *R/TheiaCollection.R -0e44c42a08c788eac0fd798b7fb9f5b0 *R/TheiaQuery.R -202587baa754139d02c4724174025151 *R/TheiaTile.R +1cb7c8c02008cc47242114d95deae30f *R/TheiaCollection.R +83cd0e0e4d511dc77c4852cd98a39ef9 *R/TheiaQuery.R +00f6d83b34c6b3a8a31f62a8f7e5b212 *R/TheiaTile.R cfb66bdb35f83ff44b9005b69fe14f44 *R/theiaR.R 47070be27ab473402afac7fc3c34fc84 *R/utils.R e88d39c685096c136bb319fa9bcc21b6 *README.md -f971297cba03e29eb8c3829b6816fa6d *build/vignette.rds -f3a24f434452b425530cdd6f44d0752b *inst/WORDLIST -1d16ec6de26a1ee331948214e8a8ebd3 *inst/doc/quick-start.R +43a92c24ca54a5e5b031f4d8a21366c3 *build/vignette.rds +8b5cd7638064badfecf54f7761da6b93 *inst/WORDLIST +6b1a65b62ab33b56d3d992d8244b4c9f *inst/doc/quick-start.R ff542859e7d16cd3c52de8f14881841a *inst/doc/quick-start.Rmd -a94188ffaa28509efc131f9fc32bc633 *inst/doc/quick-start.html +f4e170ed77266f4987fac3710c8ecfba *inst/doc/quick-start.html 31f38b1780aff70c46e3de53c853e72d *inst/extdata/cart.meta4 -7a6688ec0b711859a022cdbfd8b299f9 *inst/extdata/dummy_tile.zip +acdbbf4d5eb10d242c61a1a843bcd28d *inst/templates/gdalcubes_theia.json e60ca1b59ddb91d5b7e0a0deaade3f71 *man/TheiaAuth.Rd -78713cc3c1b83dcf4196b91bb0a3590c *man/TheiaCollection.Rd +6e12f6337fa5c7ad82f956a04160c11e *man/TheiaCollection.Rd b4bbbe6e27b24fdd802952e04de6cb77 *man/TheiaQuery.Rd -ca5226f7340fa33a548eb5159db04dfa *man/TheiaTile.Rd -70b672cdce97f164a78472ec59d6fc5d *man/theiaR.Rd +4108da0c693b84f88ee7912d1662559d *man/TheiaTile.Rd +c427909fd2fcce0ae42d0ab0e155f664 *man/theiaR.Rd ff542859e7d16cd3c52de8f14881841a *vignettes/quick-start.Rmd diff --git a/NEWS.md b/NEWS.md index fbc9c40..09294cd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,27 @@ +# theiaR 0.3.0 + +## New features + +- Adds export to gdalcubes' image collection + +## Bug fixes + +- Fix error due to bad file path on Windows + +## Minor changes + +- Adds quiet arguments to control verbose output +- Adds 'check' argument to 'TheiaTile' and 'TheiaCollection' download methods +- Do not parse meta.data on tile creation, but do it on the fly + + +# theiaR 0.2.1 + +## Bug fixes + +- Fix printing of TheiaQuery objects + + # theiaR 0.2.0 ## New features diff --git a/R/TheiaCollection.R b/R/TheiaCollection.R index 17191cc..cef3a76 100644 --- a/R/TheiaCollection.R +++ b/R/TheiaCollection.R @@ -14,12 +14,14 @@ #' query = NULL, #' dir.path = NULL, #' check = TRUE) +#' quiet = TRUE) #' -#' c$download(auth, overwrite = FALSE) +#' c$download(auth, overwrite = FALSE, check = TRUE, quiet = TRUE) #' c$check() #' c$status #' c$extract(overwrite = FALSE, dest.dir = NULL) #' c$read(bands) +#' c$as_gdalcube(out.file = "gdalcube_collection.sqlite") #' } #' #' @section Arguments: @@ -28,6 +30,7 @@ #' \item{c:}{A \code{TheiaCollection} object} #' \item{dir.path:}{The path to the directory containing zip files} #' \item{check:}{Whether or not to check existing files on collection's creation} +#' \item{quiet:}{Control verbose output} #' \item{tiles:}{A list of TheiaTile objects} #' \item{cart:}{An XML cart parsed from a 'meta4' file downloaded from Theia} #' website. Used only if Collection is created from a cart @@ -39,12 +42,13 @@ #' Or a \code{\link{TheiaAuth}} object} #' \item{overwrite:}{Overwrite existing tiles (default to `FALSE`)} #' \item{bands:}{A character vector of bands to load from tiles} +#' \item{out.file:}{Filename to store gdalcubes' image collection} #' } #' #' @section Details: #' \code{TheiaCollection$new()} Create a new instance of the class #' -#' \code{c$download(overwrite = FALSE)} Download the tiles of the collection +#' \code{c$download(overwrite = FALSE, check = TRUE)} Download the tiles of the collection #' and check the resulting files #' #' \code{$ccheck()} Check the tiles of the collection @@ -58,6 +62,10 @@ #' (as specified in Theia's product information), and return a list of #' RasterStack objects (one stack per tile) #' +#' \code{c$as_gdalcube(out.file)} Create a `gdalcubes` image collection from +#' downloaded tiles. See \url{https://github.com/appelmar/gdalcubes_R} for +#' more details. +#' #' @examples #' #' \donttest{ @@ -114,9 +122,16 @@ TheiaCollection <- tiles = NULL, query = NULL, dir.path = NULL, - check = TRUE) + check = TRUE, + quiet = TRUE) { - .TheiaCollection_initialize(self, cart.path, tiles, query, dir.path, check) + if (quiet == TRUE) { + suppressMessages({ + .TheiaCollection_initialize(self, cart.path, tiles, query, dir.path, check) + }) + } else { + .TheiaCollection_initialize(self, cart.path, tiles, query, dir.path, check) + } }, print = function(...) @@ -129,9 +144,9 @@ TheiaCollection <- .TheiaCollection_check(self) }, - download = function(auth, overwrite = FALSE) + download = function(auth, overwrite = FALSE, check = TRUE, quiet = TRUE) { - .TheiaCollection_download(self, auth, overwrite) + .TheiaCollection_download(self, auth, overwrite, check, quiet) }, extract = function(overwrite = FALSE, dest.dir = NULL) @@ -142,6 +157,11 @@ TheiaCollection <- read = function(bands) { .TheiaCollection_read(self, private, bands) + }, + + as_gdalcube = function(out.file) + { + .TheiaCollection_as_gdalcube(self, private, out.file) }), # active ----------------------------------------------------------- @@ -246,7 +266,7 @@ TheiaCollection <- } -.TheiaCollection_download <- function(self, auth, overwrite) +.TheiaCollection_download <- function(self, auth, overwrite, check, quiet) { if (is.character(auth)) { # create authentification system if not supplied @@ -255,10 +275,10 @@ TheiaCollection <- # download needed tiles lapply(self$tiles, - function(x, auth, overwrite) { - x$download(auth, overwrite = overwrite) + function(x, auth, overwrite, check, quiet) { + x$download(auth, overwrite = overwrite, check = check, quiet) }, - auth = auth, overwrite = overwrite) + auth = auth, overwrite = overwrite, check = check, quiet = quiet) return(invisible(self)) } @@ -303,3 +323,33 @@ TheiaCollection <- return(tiles.list) } + + +.TheiaCollection_as_gdalcube <- function(self, private, out.file = "gdalcube_collection.sqlite") +{ + # export collection as a gdalcube image collection + if (!(requireNamespace("gdalcubes", quietly = TRUE))) { + # check if package 'gdalcubes' is installed + stop("Package 'gdalcubes' needed for this function. Please install it.", + call. = FALSE) + } + + if (!(all(as.logical(self$status$exists)))) { + # check if all files are downloaded + stop("Some files in the collection are not downloaded. Please check `mycollection$status()`", + call. = FALSE) + } + + # extract file paths to collection + files <- unname(sapply(self$tiles, function(x) x$file.path)) + + # create gdalcubes image collection + gdalcubes.col <- + gdalcubes::create_image_collection(files = files, + format = system.file("templates", + "gdalcubes_theia.json", + package = "theiaR"), + out_file = out.file) + + return(gdalcubes.col) +} diff --git a/R/TheiaQuery.R b/R/TheiaQuery.R index 1fb252e..73a1f54 100644 --- a/R/TheiaQuery.R +++ b/R/TheiaQuery.R @@ -129,11 +129,15 @@ TheiaQuery <- cat("Search terms:\n") + # get maximum length of search terms to format printing + max.chars <- max(nchar(names(self$query))) + 1 + + # print search terms lapply(1:length(self$query), function(x) { l <- nchar(names(self$query))[[x]] - cat(" ", names(self$query)[[x]], rep(" ", 11 - l), ": ", + cat(" ", names(self$query)[[x]], rep(" ", max.chars - l), ": ", self$query[[x]], "\n", sep = "") diff --git a/R/TheiaTile.R b/R/TheiaTile.R index 4c1ecdd..e0dbbfb 100644 --- a/R/TheiaTile.R +++ b/R/TheiaTile.R @@ -9,9 +9,10 @@ #' t <- TheiaTile$new(file.path, #' url, #' file.hash, -#' check = TRUE) +#' check = TRUE, +#' quiet = TRUE) #' -#' t$download(overwrite = FALSE) +#' t$download(overwrite = FALSE, check = TRUE, quiet = TRUE) #' t$check() #' t$extract(overwrite = FALSE, dest.dir = NULL) #' t$read(bands) @@ -25,6 +26,7 @@ #' \item{url:}{The url to download the tile} #' \item{file.hash:}{The md5sum used to check the zip file} #' \item{check:}{Whether or not to check existing files on tile's creation} +#' \item{quiet:}{Control verbose output} #' \item{auth:}{A character string giving the file path to Theia credentials. #' Or a \code{\link{TheiaAuth}} object} #' \item{overwrite:}{Overwrite existing tiles (default to `FALSE`)} @@ -32,11 +34,11 @@ #' } #' #' @section Details: -#' \code{TheiaTile$new(file.path, url, file.hash)} Create a new instance of +#' \code{TheiaTile$new(file.path, url, file.hash, check)} Create a new instance of #' the class #' -#' \code{t$download(auth, overwrite = FALSE)} Download the tiles of the collection -#' and check the resulting files +#' \code{t$download(auth, overwrite = FALSE, check = TRUE)} Download the +#' tiles of the collection and check the resulting files #' #' \code{t$check()} Check the tiles of the collection #' @@ -56,21 +58,6 @@ NULL TheiaTile <- R6Class("TheiaTile", - # public ------------------------------------------------------------- - private = - list(meta.data = NULL, - - add_md = function() - { - # parse and add metadata from the zip archive - .TheiaTile_add_md(self, private) - }, - - get_bands = function() - { - .TheiaTile_get_bands(self, private) - }), - # public ------------------------------------------------------------- public = list(file.path = NA, @@ -78,17 +65,21 @@ TheiaTile <- url = NA, tile.name = NA, path.extracted = NA, - bands = NA, collection = NA, status = list(exists = FALSE, checked = FALSE, correct = FALSE, extracted = FALSE), - initialize = function(file.path, url, tile.name, file.hash, check = TRUE) + initialize = function(file.path, url, tile.name, file.hash, check = TRUE, quiet = TRUE) { - .TheiaTile_initialize(self, private, file.path, url, - tile.name, file.hash, check) + if (quiet == TRUE) { + suppressMessages({ + .TheiaTile_initialize(self, file.path, url, tile.name, file.hash, check) + }) + } else { + .TheiaTile_initialize(self, file.path, url, tile.name, file.hash, check) + } }, print = function(...) @@ -101,19 +92,36 @@ TheiaTile <- .TheiaTile_check(self, check) }, - download = function(auth, overwrite = FALSE) + download = function(auth, overwrite = FALSE, check = TRUE, quiet = TRUE) { - .TheiaTile_download(self, private, auth, overwrite) + if (quiet == TRUE) { + suppressMessages({ + .TheiaTile_download(self, auth, overwrite, check) + }) + } else { + .TheiaTile_download(self, auth, overwrite, check) + } }, read = function(bands) { - .TheiaTile_read(self, private, bands) + .TheiaTile_read(self, bands) }, extract = function(overwrite = FALSE, dest.dir = NULL) { - .TheiaTile_extract(self, private, overwrite, dest.dir) + .TheiaTile_extract(self, overwrite, dest.dir) + }), + + active = + list(meta.data = function() + { + .TheiaTile_read_md(self) + }, + + bands = function() + { + .TheiaTile_get_bands(self) }) ) @@ -123,7 +131,6 @@ TheiaTile <- .TheiaTile_print <- function(self) { # Special method to print - # TODO: better method to print cat("An Tile from Theia\n\n") cat("Collection:", self$collection, "\n\n") @@ -137,7 +144,7 @@ TheiaTile <- } -.TheiaTile_initialize <- function(self, private, file.path, url, tile.name, file.hash, check) +.TheiaTile_initialize <- function(self, file.path, url, tile.name, file.hash, check) { # Fill fields of the object self$file.path <- file.path @@ -151,14 +158,6 @@ TheiaTile <- # check the tile self$check(check) - # adds meta data if file is present and correct - if (self$status$correct == TRUE) { - tryCatch(private$add_md(), - error = function(e) { - message("Could not retrieve meta data from archive") - }) - } - return(invisible(self)) } @@ -196,6 +195,7 @@ TheiaTile <- self$status$correct <- TRUE } else { self$status$correct <- FALSE + warning(self$file.path, "incorrectly downloaded") } } @@ -203,7 +203,7 @@ TheiaTile <- } -.TheiaTile_download <- function(self, private, auth, overwrite = FALSE) +.TheiaTile_download <- function(self, auth, overwrite, check) { if (is.character(auth)) { # create authentification system if not supplied @@ -239,24 +239,28 @@ TheiaTile <- " already exists. Use 'overwrite=TRUE' to ovewrite.") } - # check the tile - self$check() + if (check == TRUE) { + # check the tile + self$check() + } else { + # do not check file + message("Assuming file is correctly downloaded. Set 'check=TRUE' to check file's hash") - # adds meta data if file is present and correct - if (self$status$correct == TRUE) { - private$add_md() + self$status$exists <- TRUE + self$status$checked <- FALSE + self$status$correct <- TRUE } return(invisible(self)) } -.TheiaTile_add_md <- function(self, private) +.TheiaTile_read_md <- function(self) { message("Parsing meta data...") # create temporary directory - tmp.dir <- paste0(tempdir(), "/") + tmp.dir <- file.path(tempdir(), "/") # get file name to extract file.name <- extraction_wrapper(self$file.path, args = list(list = TRUE)) @@ -264,24 +268,19 @@ TheiaTile <- # extract and parse xml file extraction_wrapper(self$file.path, args = list(files = file.name, exdir = tmp.dir)) - private$meta.data <- XML::xmlToList(XML::xmlParse(paste0(tmp.dir, file.name))) + meta.data <- XML::xmlToList(XML::xmlParse(file.path(tmp.dir, file.name))) # remove temporary file - unlink(paste(tmp.dir, file.name, sep = "/")) + unlink(file.path(tmp.dir, file.name)) - # adds bands information (Sentinel2 only) - if (self$collection == "SENTINEL2") { - self$bands <- private$get_bands() - } - - return(invisible(self)) + return(meta.data) } -.TheiaTile_get_bands <- function(self, private) +.TheiaTile_get_bands <- function(self) { # get bands list from meta data - bands <- lapply(private$meta.data$Product_Characteristics$Band_Group_List, + bands <- lapply(self$meta.data$Product_Characteristics$Band_Group_List, function(x) { band.list <- unlist(x$Band_List[-(length(x$Band_List))]) band.id <- unname(x$.attrs) @@ -296,7 +295,7 @@ TheiaTile <- } -.TheiaTile_read <- function(self, private, bands) +.TheiaTile_read <- function(self, bands) { # check if requested bands are available avail.bands <- self$bands @@ -326,7 +325,7 @@ TheiaTile <- } -.TheiaTile_extract <- function(self, private, overwrite, dest.dir) +.TheiaTile_extract <- function(self, overwrite, dest.dir) { if (is.null(dest.dir)) { # create destination directory if not supllied @@ -337,7 +336,7 @@ TheiaTile <- # get extracted archive name file.path <- extraction_wrapper(self$file.path, args = list(list = TRUE))[1] file.path <- gsub("(^.*/)(.*$)", "\\1", file.path) - file.path <- paste0(dest.dir, file.path) + file.path <- file.path(dest.dir, file.path) if (!(dir.exists(file.path)) | overwrite == TRUE) { # check if it exists diff --git a/build/vignette.rds b/build/vignette.rds index fdbde78..b462be6 100644 Binary files a/build/vignette.rds and b/build/vignette.rds differ diff --git a/inst/WORDLIST b/inst/WORDLIST index 3fef0dc..0a00b5c 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -4,6 +4,7 @@ cnes dest dir GDAL +gdalcubes github Hagolle https diff --git a/inst/doc/quick-start.R b/inst/doc/quick-start.R index 6c221fb..48b7c87 100644 --- a/inst/doc/quick-start.R +++ b/inst/doc/quick-start.R @@ -1,25 +1,25 @@ -## ----setup, include = FALSE---------------------------------------------- +## ----setup, include = FALSE--------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) -## ------------------------------------------------------------------------ +## ----------------------------------------------------------------------------- library(theiaR) -## ---- eval=T------------------------------------------------------------- +## ---- eval=T------------------------------------------------------------------ myquery <- list(collection = "SENTINEL2", town = "Grenoble", start.date = "2018-07-01", end.date = "2018-07-06") -## ------------------------------------------------------------------------ +## ----------------------------------------------------------------------------- mycollection <- TheiaCollection$new(query = myquery, dir.path = ".", check = TRUE) -## ------------------------------------------------------------------------ +## ----------------------------------------------------------------------------- print(mycollection) -## ---- eval=T------------------------------------------------------------- +## ---- eval=T------------------------------------------------------------------ cart.path <- system.file("extdata", "cart.meta4", package = "theiaR") mycollection <- TheiaCollection$new(cart.path = cart.path, @@ -28,24 +28,24 @@ mycollection <- TheiaCollection$new(cart.path = cart.path, print(mycollection) -## ---- eval=TRUE---------------------------------------------------------- +## ---- eval=TRUE--------------------------------------------------------------- mycollection$status -## ---- eval=FALSE--------------------------------------------------------- +## ---- eval=FALSE-------------------------------------------------------------- # mycollection$download(auth = myauth) -## ---- eval=FALSE--------------------------------------------------------- +## ---- eval=FALSE-------------------------------------------------------------- # mycollection$download(auth = myauth, overwrite = TRUE) -## ---- eval=FALSE--------------------------------------------------------- +## ---- eval=FALSE-------------------------------------------------------------- # file.path <- mycollection$extract() -## ---- eval=FALSE--------------------------------------------------------- +## ---- eval=FALSE-------------------------------------------------------------- # mytile$bands -## ---- eval=FALSE--------------------------------------------------------- +## ---- eval=FALSE-------------------------------------------------------------- # mybands <- mytile$read(bands = c("B5", "B6")) -## ---- eval=FALSE--------------------------------------------------------- +## ---- eval=FALSE-------------------------------------------------------------- # mybands <- mycollection$read(bands = c("B5", "B6")) diff --git a/inst/doc/quick-start.html b/inst/doc/quick-start.html index 9ab132f..250c3e9 100644 --- a/inst/doc/quick-start.html +++ b/inst/doc/quick-start.html @@ -363,12 +363,9 @@

Download your tiles

collection by running:

mycollection$status
-#>                                          tile exists checked correct
-#> 1 SENTINEL2B_20190128-104831-308_L2A_T31TGK_D  FALSE   FALSE   FALSE
-#> 2 SENTINEL2A_20190113-104826-809_L2A_T31TGK_D  FALSE   FALSE   FALSE
-#>   extracted
-#> 1     FALSE
-#> 2     FALSE
+#>                                          tile exists checked correct extracted
+#> 1 SENTINEL2B_20190128-104831-308_L2A_T31TGK_D  FALSE   FALSE   FALSE     FALSE
+#> 2 SENTINEL2A_20190113-104826-809_L2A_T31TGK_D  FALSE   FALSE   FALSE     FALSE
 

To download all tiles in a collection, simply run:

diff --git a/inst/extdata/dummy_tile.zip b/inst/extdata/dummy_tile.zip deleted file mode 100644 index 253af8c..0000000 Binary files a/inst/extdata/dummy_tile.zip and /dev/null differ diff --git a/inst/templates/gdalcubes_theia.json b/inst/templates/gdalcubes_theia.json new file mode 100644 index 0000000..b76ee91 --- /dev/null +++ b/inst/templates/gdalcubes_theia.json @@ -0,0 +1,60 @@ +{ + "description" : "Image collection format for Sentinel 2 Level 2A data as downloaded from Theia.", + "tags" : ["Sentinel", "ESA", "Flat Reflectance", "Theia"], + "pattern" : ".+SENTINEL2[AB].+\\.tif", + "images" : { + "pattern" : ".*/(.+)_[A-Z]_V[0-9]-[0-9]_.*" + }, + "datetime" : { + "pattern" : ".*/SENTINEL2[AB]_([0-9]{8}-[0-9]{6})-.*", + "format" : "%Y%m%d-%H%M%S" + }, + "bands" : { + "B2" : { + "nodata" : -10000, + "pattern" : ".+_FRE_B2\\.tif" + }, + "B3" : { + "nodata" : -10000, + "pattern" : ".+_FRE_B3\\.tif" + }, + "B4" : { + "nodata" : -10000, + "pattern" : ".+_FRE_B4\\.tif" + }, + "B5" : { + "nodata" : -10000, + "pattern" : ".+_FRE_B5\\.tif" + }, + "B6" : { + "nodata" : -10000, + "pattern" : ".+_FRE_B6\\.tif" + }, + "B7" : { + "nodata" : -10000, + "pattern" : ".+_FRE_B7\\.tif" + }, + "B8" : { + "nodata" : -10000, + "pattern" : ".+_FRE_B8\\.tif" + }, + "B8A" : { + "nodata" : -10000, + "pattern" : ".+_FRE_B8A\\.tif" + }, + "B11" : { + "nodata" : -10000, + "pattern" : ".+_FRE_B11\\.tif" + }, + "B12" : { + "nodata" : -10000, + "pattern" : ".+_FRE_B12\\.tif" + }, + "CLOUDS" : { + "pattern" : ".+_CLM_R1\\.tif" + }, + "SATURATED" : { + "pattern" : ".+_SAT_R1\\.tif" + } + } +} diff --git a/man/TheiaCollection.Rd b/man/TheiaCollection.Rd index 5922987..5b097ab 100644 --- a/man/TheiaCollection.Rd +++ b/man/TheiaCollection.Rd @@ -17,12 +17,14 @@ from a \code{\link{TheiaQuery}} object or from a list of query = NULL, dir.path = NULL, check = TRUE) + quiet = TRUE) - c$download(auth, overwrite = FALSE) + c$download(auth, overwrite = FALSE, check = TRUE, quiet = TRUE) c$check() c$status c$extract(overwrite = FALSE, dest.dir = NULL) c$read(bands) + c$as_gdalcube(out.file = "gdalcube_collection.sqlite") } } @@ -33,6 +35,7 @@ from a \code{\link{TheiaQuery}} object or from a list of \item{c:}{A \code{TheiaCollection} object} \item{dir.path:}{The path to the directory containing zip files} \item{check:}{Whether or not to check existing files on collection's creation} + \item{quiet:}{Control verbose output} \item{tiles:}{A list of TheiaTile objects} \item{cart:}{An XML cart parsed from a 'meta4' file downloaded from Theia} website. Used only if Collection is created from a cart @@ -44,6 +47,7 @@ from a \code{\link{TheiaQuery}} object or from a list of Or a \code{\link{TheiaAuth}} object} \item{overwrite:}{Overwrite existing tiles (default to `FALSE`)} \item{bands:}{A character vector of bands to load from tiles} + \item{out.file:}{Filename to store gdalcubes' image collection} } } @@ -51,7 +55,7 @@ from a \code{\link{TheiaQuery}} object or from a list of \code{TheiaCollection$new()} Create a new instance of the class - \code{c$download(overwrite = FALSE)} Download the tiles of the collection + \code{c$download(overwrite = FALSE, check = TRUE)} Download the tiles of the collection and check the resulting files \code{$ccheck()} Check the tiles of the collection @@ -64,6 +68,10 @@ from a \code{\link{TheiaQuery}} object or from a list of \code{c$read(bands)} Read requested bands, apply corrections on values (as specified in Theia's product information), and return a list of RasterStack objects (one stack per tile) + + \code{c$as_gdalcube(out.file)} Create a `gdalcubes` image collection from + downloaded tiles. See \url{https://github.com/appelmar/gdalcubes_R} for + more details. } \examples{ diff --git a/man/TheiaTile.Rd b/man/TheiaTile.Rd index a7cfd3d..44879af 100644 --- a/man/TheiaTile.Rd +++ b/man/TheiaTile.Rd @@ -12,9 +12,10 @@ Generate and manage a tile from Theia (download, check, load). t <- TheiaTile$new(file.path, url, file.hash, - check = TRUE) + check = TRUE, + quiet = TRUE) - t$download(overwrite = FALSE) + t$download(overwrite = FALSE, check = TRUE, quiet = TRUE) t$check() t$extract(overwrite = FALSE, dest.dir = NULL) t$read(bands) @@ -30,6 +31,7 @@ Generate and manage a tile from Theia (download, check, load). \item{url:}{The url to download the tile} \item{file.hash:}{The md5sum used to check the zip file} \item{check:}{Whether or not to check existing files on tile's creation} + \item{quiet:}{Control verbose output} \item{auth:}{A character string giving the file path to Theia credentials. Or a \code{\link{TheiaAuth}} object} \item{overwrite:}{Overwrite existing tiles (default to `FALSE`)} @@ -39,11 +41,11 @@ Generate and manage a tile from Theia (download, check, load). \section{Details}{ - \code{TheiaTile$new(file.path, url, file.hash)} Create a new instance of + \code{TheiaTile$new(file.path, url, file.hash, check)} Create a new instance of the class - \code{t$download(auth, overwrite = FALSE)} Download the tiles of the collection - and check the resulting files + \code{t$download(auth, overwrite = FALSE, check = TRUE)} Download the + tiles of the collection and check the resulting files \code{t$check()} Check the tiles of the collection diff --git a/man/theiaR.Rd b/man/theiaR.Rd index ffa66f0..f24773d 100644 --- a/man/theiaR.Rd +++ b/man/theiaR.Rd @@ -3,7 +3,6 @@ \docType{package} \name{theiaR} \alias{theiaR} -\alias{theiaR-package} \title{theiaR: search, download and manage theia data} \description{ Search, manage and download data from Theia website