Skip to content

Commit

Permalink
RC v. 2.0.6 (#242)
Browse files Browse the repository at this point in the history
## Minor edits
- Avoid errors in case of missing internet connection

## Bug fixes 
- Fix CRAN notes
  • Loading branch information
ranghetti committed Aug 3, 2021
1 parent 1f413b4 commit d9c0d4c
Show file tree
Hide file tree
Showing 110 changed files with 31,098 additions and 508 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@
^vignettes/products_list\.Rmd
^vignettes/standalone_execution\.Rmd
^CONDUCT\.md$
^\.github$
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: MODIStsp
Title: Find, Download and Process MODIS Land Products
Data
Type: Package
Version: 2.0.5.9003
Version: 2.0.6
Authors@R: c(person("Lorenzo", "Busetto",
role = c("aut"),
comment = c(ORCID = '0000-0001-9634-6038')),
Expand Down
14 changes: 14 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## MODIStsp 2.0.6

## Minor changes
- Replace `M*D17A3H` with `M*D17A3HGF` and add `M*D17A2HGF` (#237)
- Avoid errors in case of missing internet connection

## Bug fixes
- Patch for bbox loaded from json in case of drawn extent (#228)
- Fix #226
- Fix #232
- Fix #234
- Fix CRAN notes


## MODIStsp 2.0.5

### Main changes
Expand Down
27 changes: 14 additions & 13 deletions R/MODIStsp.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,14 @@
#' @importFrom tools file_path_sans_ext
#' @importFrom utils unzip
#' @examples
#' \donttest{
#'
#' #' # - Running the tool using the GUI
#' # Running the tool without any option will start the GUI with the default or
#' # last used settings, in interactive mode (i.e., with gui = TRUE).
#' \donttest{
#' if (interactive()) {
#' MODIStsp()
#' }
#' }
#'
#'
#' #' # - Running the tool specifying processing arguments in the call
Expand All @@ -155,7 +154,6 @@
#' # Users can exploit multicore functionalities skipping to set this argument.
#'
#' MODIStsp_get_prodlayers("M*D13A2")
#' \donttest{
#' MODIStsp(
#' gui = FALSE,
#' out_folder = "$tempdir",
Expand All @@ -170,7 +168,6 @@
#' verbose = FALSE,
#' parallel = FALSE
#' )
#' }
#'
#'
#' #' # - Running the tool using the settings previously saved in a specific options file
Expand All @@ -183,9 +180,8 @@
#' # and retrieves NDVI and EVI data, plus the Usefulness Index Quality Indicator.
#'
#' opts_file <- system.file("testdata/test_MOD13A2.json", package = "MODIStsp")
#' \donttest{
#'
#' MODIStsp(gui = FALSE, opts_file = opts_file, verbose = TRUE, parallel = FALSE)
#' }
#'
#'
#' # Running the tool using the settings previously saved in a specific option file
Expand All @@ -194,7 +190,6 @@
#'
#' opts_file <- system.file("testdata/test_MOD13A2.json", package = "MODIStsp")
#' spatial_file <- system.file("testdata/lakeshapes/garda_lake.shp", package = "MODIStsp")
#' \donttest{
#' MODIStsp(
#' gui = FALSE,
#' opts_file = opts_file,
Expand All @@ -203,7 +198,6 @@
#' verbose = TRUE,
#' parallel = FALSE
#' )
#' }
#'
#'
#' # Running the tool using the settings previously saved in a
Expand All @@ -220,7 +214,6 @@
#' extent_list
#' opts_file <- system.file("testdata/test_MOD13A2.json", package = "MODIStsp")
#'
#' \donttest{
#' for (single_shape in extent_list) {
#' MODIStsp(
#' gui = FALSE,
Expand All @@ -229,7 +222,7 @@
#' spafile = single_shape,
#' verbose = TRUE,
#' parallel = FALSE
#' )
#' )
#' }
#'
#' # output files are placed in separate folders:
Expand All @@ -238,18 +231,22 @@
#' full.names = TRUE
#' )
#' outfiles_garda
#' library(raster)
#' plot(raster(outfiles_garda[1] ))
#' require(raster)
#' if (length(outfiles_garda) > 0) {
#' plot(raster(outfiles_garda[1] ))
#' }
#'
#' outfiles_iseo <- list.files(
#' file.path(tempdir(), "MODIStsp/iseo_lake/VI_16Days_1Km_v6/NDVI"),
#' full.names = TRUE
#' )
#' outfiles_iseo
#' plot(raster(outfiles_iseo[1]))
#' if (length(outfiles_garda) > 0) {
#' plot(raster(outfiles_iseo[1]))
#' }
#'
#' # See also https://docs.ropensci.org/MODIStsp/articles/noninteractive_execution.html
#' }

MODIStsp <- function(...,
gui = TRUE,
Expand Down Expand Up @@ -546,6 +543,10 @@ MODIStsp <- function(...,
tools::file_path_sans_ext(basename(spafile))
)
}

if (inherits(proc_opts$bbox, "list")) {
proc_opts$bbox <- unlist(proc_opts$bbox)
}

# Create output folders if needed. No recursive to avoid creating big
# folder trees by mistake
Expand Down
6 changes: 4 additions & 2 deletions R/MODIStsp_process.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#' @author Luigi Ranghetti, phD (2015) \email{luigi@@ranghetti.info}
#' @note Thanks Tomislav Hengl and Babak Naimi, whose scripts made the starting point for
#' development of this function ([ModisDownload](http://r-gis.net/?q=ModisDownload);
#' [Download_and_resampling_of_MODIS_images](http://spatial-analyst.net/wiki/index.php?title=Download_and_resampling_of_MODIS_images))
#' [Download_and_resampling_of_MODIS_images](https://en.wikipedia.org/wiki/Regression-kriging?title=Download_and_resampling_of_MODIS_images))
#' @note License: GPL 3.0
#' @export
#' @importFrom jsonlite read_json
Expand Down Expand Up @@ -282,6 +282,8 @@ MODIStsp_process <- function(proc_opts,

download_server <- attr(date_dirs_all, "server")

if (download_server == "unreachable") {return(invisible(NULL))}

dates <- get_yeardates(proc_opts$download_range,
yy,
start_year, end_year,
Expand Down Expand Up @@ -619,5 +621,5 @@ MODIStsp_process <- function(proc_opts,

}

return("DONE")
return(invisible(NULL))
}
26 changes: 17 additions & 9 deletions R/get_mod_dirs.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,28 @@ get_mod_dirs <- function(http,
response <- data.frame(status_code = "")
while (response$status_code != 200) {
# send request to server
response <- try(httr::RETRY("GET",
http,
httr::authenticate(user, password),
times = n_retries,
pause_base = 0.1,
pause_cap = 3,
quiet = FALSE))
response <- try(
httr::RETRY("GET",
http,
httr::authenticate(user, password),
times = n_retries,
pause_base = 0.1,
pause_cap = 3,
quiet = FALSE),
silent = TRUE
)

# On interactive execution, after n_retries attempt ask if quit or ----
# retry

if (inherits(response, "try-error") || response$status_code != 200) {
stop("[", date(), "] Error: http server seems to be down! ",
"Please try again later. Aborting!", call. = FALSE)
message(
"[", date(), "] Error: http server seems to be down! ",
"Please try again later. Aborting!"
)
date_dirs <- character()
attr(date_dirs, "server") <- "unreachable"
return(date_dirs)
}
}
# On httr success get the directory names (available dates) ----
Expand Down
12 changes: 12 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
MODIStsp 2.0.6
================

* Windows 10 on local install, R 4.1.0
* ArchLinux on local install, R 4.1.0
* win-builder (R-devel, R-release, R-oldrelease)

## R CMD check results

There were no ERRORs, WARNINGs nor NOTEs.


MODIStsp 2.0.5
================

Expand Down
4 changes: 2 additions & 2 deletions docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/CONDUCT.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d9c0d4c

Please sign in to comment.