@@ -310,8 +310,7 @@ chelsa_process <- function(
310310
311311 tiffs_okay <- all(
312312 ecokit :: check_tiff(file_tif , warning = FALSE ),
313- ecokit :: check_tiff(file_nc , warning = FALSE )) %> %
314- suppressWarnings()
313+ ecokit :: check_tiff(file_nc , warning = FALSE ))
315314
316315 if (tiffs_okay ) {
317316 return (FALSE )
@@ -330,14 +329,21 @@ chelsa_process <- function(
330329 attempt <- attempt + 1
331330 try_n <- try(
332331 expr = {
333- IASDT.R :: chelsa_project(
334- metadata = dplyr :: slice(chelsa_to_process , x ),
335- env_file = env_file , compression_level = compression_level ) %> %
336- # suppress known warning
337- # https://github.com/rspatial/terra/issues/1212
338- # https://github.com/rspatial/terra/issues/1832
339- # https://stackoverflow.com/questions/78098166
340- suppressWarnings()
332+ # suppress known warning
333+ # https://github.com/rspatial/terra/issues/1212
334+ # https://github.com/rspatial/terra/issues/1832
335+ # https://stackoverflow.com/questions/78098166
336+
337+ ecokit :: quietly(
338+ expr = {
339+ IASDT.R :: chelsa_project(
340+ metadata = dplyr :: slice(chelsa_to_process , x ),
341+ env_file = env_file , compression_level = compression_level )
342+ },
343+ " is not a Time or Vertical dimension" ,
344+ " driver GTiff does not support open option so" ,
345+ " is not a Longitude/X dimension" )
346+
341347 " Okay"
342348 },
343349 silent = TRUE )
@@ -346,16 +352,14 @@ chelsa_process <- function(
346352
347353 tiffs_okay <- all(
348354 ecokit :: check_tiff(file_tif , warning = FALSE ),
349- ecokit :: check_tiff(file_nc , warning = FALSE )) %> %
350- suppressWarnings()
355+ ecokit :: check_tiff(file_nc , warning = FALSE ))
351356
352- if ((! inherits(try_n , " try-error" ) && tiffs_okay ) || attempt > = 5 ) {
357+ if ((! inherits(try_n , " try-error" ) && tiffs_okay ) || attempt > = 10 ) {
353358 break
354359 }
355360
356361 if (inherits(try_n , " try-error" ) &&
357- isFALSE(
358- ecokit :: check_tiff(path_download , warning = FALSE ))) {
362+ isFALSE(ecokit :: check_tiff(path_download , warning = FALSE ))) {
359363 # re-download the file if it fails to be processed and downloaded
360364 # file is not valid
361365 system(
@@ -390,7 +394,7 @@ chelsa_process <- function(
390394 ecokit :: stop_ctx(
391395 paste0(
392396 " \n >> " , nrow(chelsa_to_process ), " files failed to process.\n " ,
393- " >> Check `FailedProcessing .txt` for more details" ),
397+ " >> Check `failed_processing .txt` for more details" ),
394398 chelsa_to_process = chelsa_to_process , include_backtrace = TRUE )
395399 }
396400
0 commit comments