Skip to content

Commit d9c0d4c

Browse files
authored
RC v. 2.0.6 (#242)
## Minor edits - Avoid errors in case of missing internet connection ## Bug fixes - Fix CRAN notes
1 parent 1f413b4 commit d9c0d4c

File tree

110 files changed

+31098
-508
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+31098
-508
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@
2727
^vignettes/products_list\.Rmd
2828
^vignettes/standalone_execution\.Rmd
2929
^CONDUCT\.md$
30+
^\.github$

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Package: MODIStsp
22
Title: Find, Download and Process MODIS Land Products
33
Data
44
Type: Package
5-
Version: 2.0.5.9003
5+
Version: 2.0.6
66
Authors@R: c(person("Lorenzo", "Busetto",
77
role = c("aut"),
88
comment = c(ORCID = '0000-0001-9634-6038')),

NEWS.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## MODIStsp 2.0.6
2+
3+
## Minor changes
4+
- Replace `M*D17A3H` with `M*D17A3HGF` and add `M*D17A2HGF` (#237)
5+
- Avoid errors in case of missing internet connection
6+
7+
## Bug fixes
8+
- Patch for bbox loaded from json in case of drawn extent (#228)
9+
- Fix #226
10+
- Fix #232
11+
- Fix #234
12+
- Fix CRAN notes
13+
14+
115
## MODIStsp 2.0.5
216

317
### Main changes

R/MODIStsp.R

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,14 @@
131131
#' @importFrom tools file_path_sans_ext
132132
#' @importFrom utils unzip
133133
#' @examples
134+
#' \donttest{
134135
#'
135136
#' #' # - Running the tool using the GUI
136137
#' # Running the tool without any option will start the GUI with the default or
137138
#' # last used settings, in interactive mode (i.e., with gui = TRUE).
138-
#' \donttest{
139139
#' if (interactive()) {
140140
#' MODIStsp()
141141
#' }
142-
#' }
143142
#'
144143
#'
145144
#' #' # - Running the tool specifying processing arguments in the call
@@ -155,7 +154,6 @@
155154
#' # Users can exploit multicore functionalities skipping to set this argument.
156155
#'
157156
#' MODIStsp_get_prodlayers("M*D13A2")
158-
#' \donttest{
159157
#' MODIStsp(
160158
#' gui = FALSE,
161159
#' out_folder = "$tempdir",
@@ -170,7 +168,6 @@
170168
#' verbose = FALSE,
171169
#' parallel = FALSE
172170
#' )
173-
#' }
174171
#'
175172
#'
176173
#' #' # - Running the tool using the settings previously saved in a specific options file
@@ -183,9 +180,8 @@
183180
#' # and retrieves NDVI and EVI data, plus the Usefulness Index Quality Indicator.
184181
#'
185182
#' opts_file <- system.file("testdata/test_MOD13A2.json", package = "MODIStsp")
186-
#' \donttest{
183+
#'
187184
#' MODIStsp(gui = FALSE, opts_file = opts_file, verbose = TRUE, parallel = FALSE)
188-
#' }
189185
#'
190186
#'
191187
#' # Running the tool using the settings previously saved in a specific option file
@@ -194,7 +190,6 @@
194190
#'
195191
#' opts_file <- system.file("testdata/test_MOD13A2.json", package = "MODIStsp")
196192
#' spatial_file <- system.file("testdata/lakeshapes/garda_lake.shp", package = "MODIStsp")
197-
#' \donttest{
198193
#' MODIStsp(
199194
#' gui = FALSE,
200195
#' opts_file = opts_file,
@@ -203,7 +198,6 @@
203198
#' verbose = TRUE,
204199
#' parallel = FALSE
205200
#' )
206-
#' }
207201
#'
208202
#'
209203
#' # Running the tool using the settings previously saved in a
@@ -220,7 +214,6 @@
220214
#' extent_list
221215
#' opts_file <- system.file("testdata/test_MOD13A2.json", package = "MODIStsp")
222216
#'
223-
#' \donttest{
224217
#' for (single_shape in extent_list) {
225218
#' MODIStsp(
226219
#' gui = FALSE,
@@ -229,7 +222,7 @@
229222
#' spafile = single_shape,
230223
#' verbose = TRUE,
231224
#' parallel = FALSE
232-
#' )
225+
#' )
233226
#' }
234227
#'
235228
#' # output files are placed in separate folders:
@@ -238,18 +231,22 @@
238231
#' full.names = TRUE
239232
#' )
240233
#' outfiles_garda
241-
#' library(raster)
242-
#' plot(raster(outfiles_garda[1] ))
234+
#' require(raster)
235+
#' if (length(outfiles_garda) > 0) {
236+
#' plot(raster(outfiles_garda[1] ))
237+
#' }
243238
#'
244239
#' outfiles_iseo <- list.files(
245240
#' file.path(tempdir(), "MODIStsp/iseo_lake/VI_16Days_1Km_v6/NDVI"),
246241
#' full.names = TRUE
247242
#' )
248243
#' outfiles_iseo
249-
#' plot(raster(outfiles_iseo[1]))
244+
#' if (length(outfiles_garda) > 0) {
245+
#' plot(raster(outfiles_iseo[1]))
250246
#' }
251247
#'
252248
#' # See also https://docs.ropensci.org/MODIStsp/articles/noninteractive_execution.html
249+
#' }
253250

254251
MODIStsp <- function(...,
255252
gui = TRUE,
@@ -546,6 +543,10 @@ MODIStsp <- function(...,
546543
tools::file_path_sans_ext(basename(spafile))
547544
)
548545
}
546+
547+
if (inherits(proc_opts$bbox, "list")) {
548+
proc_opts$bbox <- unlist(proc_opts$bbox)
549+
}
549550

550551
# Create output folders if needed. No recursive to avoid creating big
551552
# folder trees by mistake

R/MODIStsp_process.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#' @author Luigi Ranghetti, phD (2015) \email{luigi@@ranghetti.info}
3535
#' @note Thanks Tomislav Hengl and Babak Naimi, whose scripts made the starting point for
3636
#' development of this function ([ModisDownload](http://r-gis.net/?q=ModisDownload);
37-
#' [Download_and_resampling_of_MODIS_images](http://spatial-analyst.net/wiki/index.php?title=Download_and_resampling_of_MODIS_images))
37+
#' [Download_and_resampling_of_MODIS_images](https://en.wikipedia.org/wiki/Regression-kriging?title=Download_and_resampling_of_MODIS_images))
3838
#' @note License: GPL 3.0
3939
#' @export
4040
#' @importFrom jsonlite read_json
@@ -282,6 +282,8 @@ MODIStsp_process <- function(proc_opts,
282282

283283
download_server <- attr(date_dirs_all, "server")
284284

285+
if (download_server == "unreachable") {return(invisible(NULL))}
286+
285287
dates <- get_yeardates(proc_opts$download_range,
286288
yy,
287289
start_year, end_year,
@@ -619,5 +621,5 @@ MODIStsp_process <- function(proc_opts,
619621

620622
}
621623

622-
return("DONE")
624+
return(invisible(NULL))
623625
}

R/get_mod_dirs.R

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,28 @@ get_mod_dirs <- function(http,
5050
response <- data.frame(status_code = "")
5151
while (response$status_code != 200) {
5252
# send request to server
53-
response <- try(httr::RETRY("GET",
54-
http,
55-
httr::authenticate(user, password),
56-
times = n_retries,
57-
pause_base = 0.1,
58-
pause_cap = 3,
59-
quiet = FALSE))
53+
response <- try(
54+
httr::RETRY("GET",
55+
http,
56+
httr::authenticate(user, password),
57+
times = n_retries,
58+
pause_base = 0.1,
59+
pause_cap = 3,
60+
quiet = FALSE),
61+
silent = TRUE
62+
)
6063

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

6467
if (inherits(response, "try-error") || response$status_code != 200) {
65-
stop("[", date(), "] Error: http server seems to be down! ",
66-
"Please try again later. Aborting!", call. = FALSE)
68+
message(
69+
"[", date(), "] Error: http server seems to be down! ",
70+
"Please try again later. Aborting!"
71+
)
72+
date_dirs <- character()
73+
attr(date_dirs, "server") <- "unreachable"
74+
return(date_dirs)
6775
}
6876
}
6977
# On httr success get the directory names (available dates) ----

cran-comments.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
MODIStsp 2.0.6
2+
================
3+
4+
* Windows 10 on local install, R 4.1.0
5+
* ArchLinux on local install, R 4.1.0
6+
* win-builder (R-devel, R-release, R-oldrelease)
7+
8+
## R CMD check results
9+
10+
There were no ERRORs, WARNINGs nor NOTEs.
11+
12+
113
MODIStsp 2.0.5
214
================
315

docs/404.html

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/CONDUCT.html

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)