appelmar / gdalcubes

Creating and analyzing Earth observation data cubes in R
https://gdalcubes.github.io
Other
120 stars 28 forks source link

ERROR in stream_apply_pixel_cube::read_chunk(): external program returned exit code 1 #38

Open erydit opened 3 years ago

erydit commented 3 years ago

Hello. Im trying to reproduce an apply_pixel example:

library(gdalcubes)

L8_files <- list.files(system.file("L8NY18", package = "gdalcubes"),
                         ".TIF", recursive = TRUE, full.names = TRUE)
create_image_collection(L8_files, "L8_L1TP", file.path(tempdir(), "L8.db")) 

L8.col = image_collection(file.path(tempdir(), "L8.db"))
v = cube_view(extent=list(left=388941.2, right=766552.4, 
                          bottom=4345299, top=4744931, t0="2018-04", t1="2018-06"),
              srs="EPSG:32618", nx = 497, ny=526, dt="P1M")
L8.cube = raster_cube(L8.col, v) 
L8.cube = select_bands(L8.cube, c("B04", "B05")) 

L8.ndvi.noisy = apply_pixel(L8.cube, names="NDVI_noisy", 
                            FUN=function(x) {
                              rnorm(1, 0, 0.1) + (x["B05"]-x["B04"])/(x["B05"]+x["B04"])
                            })
L8.ndvi.noisy
plot(L8.ndvi.noisy)

On the stage of calculation (plotting) i get a bunch of errors: Error: ERROR in stream_apply_pixel_cube::read_chunk(): external program returned exit code 1 Error: Child process failed with exit code 1 Error: Child process output: Execution stopped

The same behaviour I get when applying another user functons in apply_pixel, apply_time, reduce_time. The tinyexpr functions work with no issue.

my sessionInfo()

R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=Russian_Russia.1251  LC_CTYPE=Russian_Russia.1251    LC_MONETARY=Russian_Russia.1251 LC_NUMERIC=C                   
[5] LC_TIME=Russian_Russia.1251    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] gdalcubes_0.3.1 magrittr_2.0.1 

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.5         pillar_1.4.7       compiler_4.0.3     prettyunits_1.1.1  remotes_2.2.0      tools_4.0.3        ncdf4_1.17        
 [8] testthat_3.0.0     digest_0.6.27      pkgbuild_1.1.0     pkgload_1.1.0      jsonlite_1.7.2     dtupdate_1.5       memoise_1.1.0     
[15] lifecycle_0.2.0    tibble_3.0.4       pkgconfig_2.0.3    rlang_0.4.9        cli_2.2.0          rstudioapi_0.13    parallel_4.0.3    
[22] stringr_1.4.0      httr_1.4.2         withr_2.3.0        dplyr_1.0.2        desc_1.2.0         generics_0.1.0     fs_1.5.0          
[29] vctrs_0.3.5        devtools_2.3.2     tidyselect_1.1.0   rprojroot_2.0.2    glue_1.4.2         R6_2.5.0           processx_3.4.5    
[36] pbapply_1.4-3      fansi_0.4.1        sessioninfo_1.1.1  purrr_0.3.4        callr_3.5.1        ps_1.5.0           ellipsis_0.3.1    
[43] RcppProgress_0.4.2 usethis_1.6.3      assertthat_0.2.1   stringi_1.5.3      crayon_1.3.4  
erydit commented 3 years ago

On my home system I get same errors: Error: Child process failed with exit code 1 Error: Child process output: Ошибка в write_chunk_from_array(apply_pixel(read_chunk_as_array(), f)) : cant find function "write_chunk_from_array" Execution stopped

sessionInfo():

R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Manjaro Linux

Matrix products: default
BLAS:   /usr/lib/libblas.so.3.9.0
LAPACK: /usr/lib/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=ru_RU.UTF-8       LC_NUMERIC=C               LC_TIME=ru_RU.UTF-8        LC_COLLATE=ru_RU.UTF-8    
 [5] LC_MONETARY=ru_RU.UTF-8    LC_MESSAGES=ru_RU.UTF-8    LC_PAPER=ru_RU.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=ru_RU.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] gdalcubes_0.3.1 magrittr_2.0.1 

loaded via a namespace (and not attached):
[1] compiler_4.0.3     tools_4.0.3        Rcpp_1.0.5         tinytex_0.27       ncdf4_1.17        
[6] jsonlite_1.7.2     xfun_0.19          RcppProgress_0.4.2