Skip to content

Commit

Permalink
version 1.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ranghetti authored and cran-robot committed May 4, 2021
1 parent d0ae12f commit cdefc46
Show file tree
Hide file tree
Showing 165 changed files with 956 additions and 609 deletions.
15 changes: 8 additions & 7 deletions DESCRIPTION
@@ -1,7 +1,7 @@
Package: sen2r
Type: Package
Title: Find, Download and Process Sentinel-2 Data
Version: 1.4.2
Version: 1.4.3
Authors@R: c(person("Luigi", "Ranghetti",
email = "luigi@ranghetti.info",
role = c("aut", "cre"),
Expand All @@ -19,25 +19,26 @@ Description: Functions to download Sentinel-2 optical images
Ranghetti et al. (2020) <doi:10.1016/j.cageo.2020.104473>.
License: GPL-3
Encoding: UTF-8
URL: http://sen2r.ranghetti.info, https://github.com/ranghetti/sen2r
URL: https://sen2r.ranghetti.info
BugReports: https://github.com/ranghetti/sen2r/issues
Depends: R (>= 3.5.0)
Imports: methods, sf (>= 0.9.2), stars (>= 0.4.1), data.table, raster,
rgdal, XML, jsonlite, geojsonio, foreach, parallel, doParallel,
httr, RcppTOML
Suggests: leaflet, leafpm, mapedit, shiny, shinyFiles, shinydashboard,
shinyjs, shinyWidgets, spelling, geojsonlint, httptest, knitr,
markdown, rmarkdown, sys, tools, units, testthat (>= 2.1.0)
Suggests: leaflet, leafpm, mapedit, s2, shiny, shinyFiles,
shinydashboard, shinyjs, shinyWidgets, spelling, geojsonlint,
httptest, knitr, markdown, rmarkdown, sys, tools, units,
testthat (>= 2.1.0)
SystemRequirements: GDAL (>= 2.1.2), PROJ (>= 4.9.1), GEOS (>= 3.4.2),
Cairo, Curl, NetCDF, jq, Protocol Buffers, V8, OpenSSL,
Libxml2.
VignetteBuilder: knitr
RoxygenNote: 7.1.1
Language: en-GB
NeedsCompilation: no
Packaged: 2021-03-04 11:33:41 UTC; lranghetti
Packaged: 2021-05-04 13:12:13 UTC; lranghetti
Author: Luigi Ranghetti [aut, cre] (<https://orcid.org/0000-0001-6207-5188>),
Lorenzo Busetto [aut] (<https://orcid.org/0000-0001-9634-6038>)
Maintainer: Luigi Ranghetti <luigi@ranghetti.info>
Repository: CRAN
Date/Publication: 2021-03-04 12:40:02 UTC
Date/Publication: 2021-05-04 13:40:02 UTC
327 changes: 164 additions & 163 deletions MD5

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion NAMESPACE
Expand Up @@ -125,12 +125,12 @@ importFrom(sf,st_intersection)
importFrom(sf,st_intersects)
importFrom(sf,st_is_longlat)
importFrom(sf,st_is_valid)
importFrom(sf,st_make_valid)
importFrom(sf,st_point)
importFrom(sf,st_polygon)
importFrom(sf,st_read)
importFrom(sf,st_sf)
importFrom(sf,st_sfc)
importFrom(sf,st_simplify)
importFrom(sf,st_transform)
importFrom(sf,st_union)
importFrom(sf,st_write)
Expand Down
22 changes: 21 additions & 1 deletion NEWS.md
@@ -1,3 +1,23 @@
# Version 1.4.3

## Minor changes
- Use API URLs `https://apihub.copernicus.eu/apihub` instead of
`https://scihub.copernicus.eu/apihub` as required after changes at
SciHub side (https://scihub.copernicus.eu/news/News00868).
- Manage multiple SciHub credentials when ordering SAFE archives from LTA
(experimental).

## Documentation
- Replace `http://` with `https://` in documentation _URLs.

## Checks
- Replace Travis with GitHub Actions (and fix tests accordingly).

## Bug fixes
- Avoid topology errors on S2 footprints (to fix errors using `{sf}` 1.0).
- Manage situations like in #397 (too many nodes for ESA API query).


# Version 1.4.2

## Bug fixes
Expand Down Expand Up @@ -423,7 +443,7 @@ First stable release of package **sen2r**! See the announcement [here](https://l
* `tiles_intersects()`: when an extent is loaded, now only required tiles are automatically used, instead than all the overlapping ones.

### Update dependencies
* after [V8 major update](https://www.r-bloggers.com/2019/02/a-major-upgrade-of-the-v8-package/), [Installation page](http://sen2r.ranghetti.info/articles/installation.html) was edited to refer to `v8` instead than to `v8-3.14`
* after [V8 major update](https://www.r-bloggers.com/2019/02/a-major-upgrade-of-the-v8-package/), [Installation page](https://sen2r.ranghetti.info/articles/installation.html) was edited to refer to `v8` instead than to `v8-3.14`

### Bug fixing:
* Fix bug in SciHub login
Expand Down
10 changes: 5 additions & 5 deletions R/abs2rel.R
Expand Up @@ -19,21 +19,21 @@
#' @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: \url{http://sen2r.ranghetti.info/}.
#' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}.
#' @note License: GPL 3.0
#' @export
#'
#' @examples
#' # the reference path
#' (ref_path <- system.file(package="sen2r"))
#' (ref_path <- system.file(package="sf"))
#' # a path with a common parent with ref_path
#' (in_path_1 <- system.file(package="gdalUtils"))
#' (in_path_1 <- system.file(package="rgdal"))
#' # a path included in ref_path
#' (in_path_2 <- system.file("R/abs2rel.R", package="sen2r"))
#' (in_path_2 <- system.file("DESCRIPTION", package="sf"))
#' # a path external to ref_path (in Linux)
#' (in_path_3 <- system.file(package="base"))
#' # an unexisting path
#' (in_path_4 <- gsub("sen2r","r2sen",ref_path))
#' (in_path_4 <- gsub("sf$","unexistingpackage",ref_path))
#'
#' abs2rel(in_path_1, ref_path)
#'
Expand Down
2 changes: 1 addition & 1 deletion R/add_rgb_image.R
Expand Up @@ -6,7 +6,7 @@
#' @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: \url{http://sen2r.ranghetti.info/}.
#' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}.
#' @note License: GPL 3.0

add_rgb_image <- function(s2_bands) {
Expand Down
3 changes: 2 additions & 1 deletion R/add_tile_suffix.R
Expand Up @@ -27,7 +27,7 @@
#' @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: \url{http://sen2r.ranghetti.info/}.
#' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}.
#' @note License: GPL 3.0
#' @examples
#' safe_names <- c(
Expand Down Expand Up @@ -56,6 +56,7 @@ add_tile_suffix <- function(paths, suffix) {
paths
} else {
# Custom behaviour: add specific suffix to all the paths
if (is.na(suffix)) {suffix <- ""}
gsub(
"(S2[AB][12][AC]\\_[0-9]{8}\\_[0-9]{3})\\_([0-9]{2}[A-Z]{3})\\_([^\\_\\.]+\\_[126]0\\.?[^\\_]*$)",
paste0("\\1_\\2",suffix,"_\\3"),
Expand Down
2 changes: 1 addition & 1 deletion R/build_example_param_file.R
Expand Up @@ -12,7 +12,7 @@
#' @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: \url{http://sen2r.ranghetti.info/}.
#' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}.
#' @note License: GPL 3.0
#' @importFrom jsonlite toJSON
#' @export
Expand Down
2 changes: 1 addition & 1 deletion R/calcindex.R
Expand Up @@ -29,7 +29,7 @@
#' @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: \url{http://sen2r.ranghetti.info/}.
#' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}.
#' @note License: GPL 3.0

calcindex_raster <- function(
Expand Down
4 changes: 2 additions & 2 deletions R/check_gdal.R
Expand Up @@ -25,12 +25,12 @@
#' @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: \url{http://sen2r.ranghetti.info/}.
#' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}.
#' @note License: GPL 3.0
#' @importFrom jsonlite toJSON
#' @export
#' @examples
#' \donttest{
#' \dontrun{
#' check_gdal()
#' }

Expand Down
2 changes: 1 addition & 1 deletion R/check_gui_deps.R
Expand Up @@ -14,7 +14,7 @@
#' @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: \url{http://sen2r.ranghetti.info/}.
#' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}.
#' @note License: GPL 3.0
#' @export
#' @examples
Expand Down
13 changes: 10 additions & 3 deletions R/check_param_list.R
Expand Up @@ -19,11 +19,12 @@
#'
#' @importFrom jsonlite fromJSON
#' @importFrom methods is
#' @importFrom sf st_is_valid st_make_valid
#' @author Luigi Ranghetti, phD (2019) \email{luigi@@ranghetti.info}
#' @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: \url{http://sen2r.ranghetti.info/}.
#' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}.
#' @note License: GPL 3.0


Expand Down Expand Up @@ -240,7 +241,7 @@ check_param_list <- function(pm, type = "string", check_paths = FALSE, correct =

# -- extent --
# convert to sf
if (is(pm$extent, "character") | is(pm$extent, "geojson")) {
if (inherits(pm$extent, "character") | inherits(pm$extent, "geojson")) {
tryCatch(
pm$extent <- st_read(pm$extent, quiet=TRUE),
error = function(e) {
Expand All @@ -250,9 +251,15 @@ check_param_list <- function(pm, type = "string", check_paths = FALSE, correct =
)
}
)
} else if (is(pm$extent, "Spatial")) {
} else if (inherits(pm$extent, "Spatial")) {
pm$extent <- st_as_sf(pm$extent)
}
# check validity
if (inherits(pm$extent, c("sfc", "sf"))) {
if (any(!st_is_valid(pm$extent))) {
pm$extent <- st_make_valid(pm$extent)
}
}


# -- s2tiles_selected --
Expand Down
2 changes: 1 addition & 1 deletion R/check_sen2r_deps.R
Expand Up @@ -15,7 +15,7 @@
#' @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: \url{http://sen2r.ranghetti.info/}.
#' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}.
#' @note License: GPL 3.0
#' @importFrom utils capture.output
#' @importFrom httr RETRY write_disk progress
Expand Down
2 changes: 1 addition & 1 deletion R/compute_s2_paths.R
Expand Up @@ -47,7 +47,7 @@
#' @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: \url{http://sen2r.ranghetti.info/}.
#' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}.
#' @note License: GPL 3.0
#' @import data.table

Expand Down
2 changes: 1 addition & 1 deletion R/comsub.R
Expand Up @@ -12,7 +12,7 @@
#' @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: \url{http://sen2r.ranghetti.info/}.
#' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}.
#' @note Modified from a suggestion taken from
#' [stackoverflow](https://stackoverflow.com/questions/28273716/r-implementation-for-finding-the-longest-common-starting-substrings-in-a-set-of).
#' @export
Expand Down
2 changes: 1 addition & 1 deletion R/create_indices_db.R
Expand Up @@ -21,7 +21,7 @@
#' @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: \url{http://sen2r.ranghetti.info/}.
#' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}.
#' @note License: GPL 3.0
#' @import data.table
#' @importFrom XML htmlTreeParse xmlRoot readHTMLTable xmlAttrs saveXML
Expand Down
2 changes: 1 addition & 1 deletion R/create_s2_dop.R
Expand Up @@ -13,7 +13,7 @@
#' @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: \url{http://sen2r.ranghetti.info/}.
#' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}.
#' @note License: GPL 3.0
#' @import data.table
#' @importFrom jsonlite toJSON fromJSON
Expand Down
4 changes: 2 additions & 2 deletions R/expand_path.R
Expand Up @@ -21,7 +21,7 @@
#' @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: \url{http://sen2r.ranghetti.info/}.
#' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}.
#' @note License: GPL 3.0


Expand Down Expand Up @@ -81,7 +81,7 @@ expand_path <- function(path, parent=getwd(), silent=TRUE, normalize=TRUE) {
#' @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: \url{http://sen2r.ranghetti.info/}.
#' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}.
#' @note License: GPL 3.0


Expand Down
2 changes: 1 addition & 1 deletion R/expect_equal_crs.R
Expand Up @@ -9,7 +9,7 @@
#' @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: \url{http://sen2r.ranghetti.info/}.
#' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}.
#' @note License: GPL 3.0

expect_equal_crs <- function(crs1, crs2) {
Expand Down
2 changes: 1 addition & 1 deletion R/fix_envi_format.R
Expand Up @@ -15,7 +15,7 @@
#' @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: \url{http://sen2r.ranghetti.info/}.
#' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}.
#' @note License: GPL 3.0

fix_envi_format <- function(infiles) {
Expand Down
4 changes: 3 additions & 1 deletion R/gdalUtil.R
Expand Up @@ -27,7 +27,7 @@
#' @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: \url{http://sen2r.ranghetti.info/}.
#' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}.
#' @note License: GPL 3.0
#' @examples
#' # Define product names
Expand Down Expand Up @@ -63,7 +63,9 @@
#' oldpar <- par(mfrow = c(1,2), mar = rep(0,4))
#' image(stars::read_stars(examplename), rgb = c(11,8,4), useRaster = TRUE)
#' image(stars::read_stars(outname2), rgb = c(11,8,4), useRaster = TRUE)
#' }
#'
#' \dontrun{
#' ## gdal_calc
#' outname3 <- tempfile(fileext = ".tif")
#' ndvirefname <- system.file(
Expand Down
2 changes: 1 addition & 1 deletion R/gdal_abs2rel.R
Expand Up @@ -14,7 +14,7 @@
#' @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: \url{http://sen2r.ranghetti.info/}.
#' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}.
#' @note License: GPL 3.0
#' @export
#' @name gdal_abs2rel
Expand Down
11 changes: 9 additions & 2 deletions R/gdal_warp.R
Expand Up @@ -40,6 +40,9 @@
#' If this argument is not used then nodata values will be copied from
#' the source datasets. At the moment it is not possible to set different
#' values for different `srcfiles` (use multiple calls of the functions).
#' @param tap Logical (target aligned pixels) align the coordinates of the
#' extent of the output file to the values of the `tr`, such that the aligned
#' extent includes the minimum extent. Default is FALSE.
#' @param overwrite Logical value: should existing output files be
#' overwritten? (default: FALSE)
#' @param tmpdir (optional) Path where intermediate files (maskfile)
Expand All @@ -59,7 +62,7 @@
#' @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: \url{http://sen2r.ranghetti.info/}.
#' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}.
#' @note License: GPL 3.0
#' @examples
#' \donttest{
Expand Down Expand Up @@ -167,6 +170,7 @@ gdal_warp <- function(srcfiles,
t_srs = NULL,
r = NULL,
dstnodata = NULL,
tap = FALSE,
overwrite = FALSE,
tmpdir = NA,
rmtmp = TRUE) {
Expand Down Expand Up @@ -429,7 +433,7 @@ gdal_warp <- function(srcfiles,
"-t_srs", sel_t_srs_string,
if (crop_in_step1) {c("-te", c(sel_te))},
if (exists("mask_file")) {c("-cutline", mask_file)},
if (!is.null(tr)) {c("-tr", as.vector(sel_tr))},
if (any(!is.null(tr), tap == TRUE)) {c("-tr", as.vector(sel_tr))},
if (!is.null(step1_of)) {c("-of",as.vector(step1_of))},
if (!is.null(step1_co)) {unlist(lapply(step1_co, function(x){c("-co", x)}))},
"-r", sel_r,
Expand All @@ -440,6 +444,7 @@ gdal_warp <- function(srcfiles,
c("-dstnodata", sel_nodata)
}
},
if (tap == TRUE) {"-tap"},
if (overwrite) {"-overwrite"}
),
quiet = TRUE
Expand All @@ -463,6 +468,7 @@ gdal_warp <- function(srcfiles,
destination = dstfile,
options = c(
"-te", c(sel_te),
if (tap == TRUE) {c("-tr", as.vector(sel_tr))},
if (!is.null(of)) {c("-of",as.vector(sel_of))},
if (!is.null(co)) {unlist(lapply(co, function(x){c("-co", x)}))},
if (!is.null(sel_nodata)) {
Expand All @@ -472,6 +478,7 @@ gdal_warp <- function(srcfiles,
c("-dstnodata", sel_nodata)
}
},
if (tap == TRUE) {"-tap"},
if (overwrite) {"-overwrite"}
),
quiet = TRUE
Expand Down

0 comments on commit cdefc46

Please sign in to comment.