r-spatial / rgee

Google Earth Engine for R
https://r-spatial.github.io/rgee/
Other
677 stars 146 forks source link

error/rlang_error `file` does not identify at least one Drive file #210

Closed Leprechault closed 2 years ago

Leprechault commented 2 years ago

At submit an issue, please attached the following information of your rgee session:

library(rgee)

# Initialize the Earth Engine module.
ee_Initialize(drive=TRUE)
-- rgee 1.1.2.9000 ------------------------------------------------- earthengine-api 0.1.292 -- 
 √ user: not_defined
 √ Google Drive credentials:  FOUND
 √ Initializing Google Earth Engine:  DONE!
 √ Earth Engine account: users/ASANTOS 
-----------------------------------------------------------------------------------------------

Attach your Python (reticulate) configuration:

library(reticulate)
py_config()
python:         C:/Users/fores/anaconda3/envs/rgee_py/python.exe
libpython:      C:/Users/fores/anaconda3/envs/rgee_py/python39.dll
pythonhome:     C:/Users/fores/anaconda3/envs/rgee_py
version:        3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)]
Architecture:   64bit
numpy:          C:/Users/fores/anaconda3/envs/rgee_py/Lib/site-packages/numpy
numpy_version:  1.21.4
ee:             C:\Users\fores\ANACON~1\envs\rgee_py\lib\site-packages\ee\__init__.p

NOTE: Python version was forced by RETICULATE_PYTHON

I install several times rgee again and I don't find anyway to salve the images in my local machine. I try to:

> # Download the results
> s2_ic_local <- ee_imagecollection_to_local(
+     ic = s2_roi_add_area,
+     scale = 10,
+     region = roi,
+     #via = "drive",
+     add_metadata = FALSE,
+     dsn = paste0("G:/.shortcut-targets-by-id/1-0KQ6FeSVCd0L8meSCn9Qbf1DHmyub5b/biomass_RS_Ronald/S2/",ID2[i],"_",str_extract(gsub("COPERNICUS/S2_SR/","",ic_date$id),
+                                                                                                                              "20\\d{2}\\d{2}\\d{2}"),"_",substrRight(ic_date$id,6))
+ )
---------------------------------------------------- Downloading ImageCollection - via drive --- region parameters
 sfg      : POLYGON ((-51.60063 -20.229 .... .2298, -51.60063 -20.22979)) 
 CRS      : GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563, ..... 
 geodesic : TRUE 
 evenOdd  : TRUE 

Error: `file`G:/.shortcut-targets-by-id/1-0KQ6FeSVCd0L8meSCn9Qbf1DHmyub5b/biomass_RS_Ronald/S2/BelaVistaOtoboni_PR001_46_2016-03-04_20200510_T22KDC.tif
Run `rlang::last_error()` to see where the error occurred.
> rlang::last_error()
<error/rlang_error>
`file` does not identify at least one Drive file.
Backtrace:
  1. rgee::ee_imagecollection_to_local(...)
  2. rgee::ee_as_stars(...)
  3. rgee:::to_evaluate()
  4. rgee:::ee_image_local(...)
  5. rgee:::ee_image_local_drive(task, dsn, metadata, public, quiet)
  6. rgee::ee_drive_to_local(...)
 10. googledrive::drive_share_anyone(file = files_gd)
 11. googledrive::drive_share(file = file, role = "reader", type = "anyone")
 12. googledrive::confirm_some_files(file)
 13. googledrive:::drive_abort("{.arg {in_var}} does not identify at least one Drive file.")
 14. cli::cli_abort(message = message, ..., .envir = .envir)
Run `rlang::last_trace()` to see the full context.

Please, any help with it?

csaybar commented 2 years ago

hi @Leprechault can u run:

library(rgee)
library(googledrive)
sessionInfo()
Leprechault commented 2 years ago

Hi @csaybar thanks for your answer. The session info is:

library(rgee)
library(googledrive)
sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)

Matrix products: default

locale:
[1] LC_COLLATE=Portuguese_Brazil.1252  LC_CTYPE=Portuguese_Brazil.1252   
[3] LC_MONETARY=Portuguese_Brazil.1252 LC_NUMERIC=C                      
[5] LC_TIME=Portuguese_Brazil.1252    

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

other attached packages:
[1] googledrive_2.0.0 rgee_1.1.2.9000  

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7        compiler_4.1.2    pillar_1.6.4      tools_4.1.2       digest_0.6.29    
 [6] jsonlite_1.7.2    gargle_1.2.0      lifecycle_1.0.1   tibble_3.1.6      lattice_0.20-45  
[11] pkgconfig_2.0.3   png_0.1-7         rlang_0.4.12      Matrix_1.3-4      cli_3.1.0        
[16] DBI_1.1.2         crosstalk_1.2.0   fastmap_1.1.0     dplyr_1.0.7       generics_0.1.1   
[21] fs_1.5.2          vctrs_0.3.8       htmlwidgets_1.5.4 leaflet_2.0.4.1   grid_4.1.2       
[26] tidyselect_1.1.1  reticulate_1.22   glue_1.6.0        R6_2.5.1          processx_3.5.2   
[31] fansi_0.5.0       purrr_0.3.4       magrittr_2.0.1    ps_1.6.0          htmltools_0.5.2  
[36] ellipsis_0.3.2    assertthat_0.2.1  utf8_1.2.2        crayon_1.4.2  
csaybar commented 2 years ago

Hi @Leprechault, it seems the GEE & GD sync has been experiencing some delay. Now it's working perfectly on my side (please let me know if it's the same for you). I will add a warning message when this happens.

Leprechault commented 2 years ago

Hi @csaybar, please, look the output:


---------------------------------------------------- Downloading ImageCollection - via drive --- region parameters_19_2020-08-11_20200724_T21KZT.tif
 sfg      : POLYGON ((-53.31203 -20.398 .... .39861, -53.31203 -20.3986)) 
 CRS      : GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563, ..... 
 geodesic : TRUE 
 evenOdd  : TRUE 

---------------------------------------------------- Downloading ImageCollection - via drive --- region parameters_21_2020-08-11_20200724_T21KZT.tif
 sfg      : POLYGON ((-53.29494 -20.374 .... 37488, -53.29494 -20.37486)) 
 CRS      : GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563, ..... 
 geodesic : TRUE 
 evenOdd  : TRUE 

Downloading: G:/.shortcut-targets-by-id/1-0KQ6FeSVCd0L8meSCn9Qbf1DHmyub5b/biomass_RS_Ronald/S2/CaniveteRibas_PR002_7_2020-08-12_20200724_T21KZT.tif> 

Don't show Saved locally as: and the file is not in the directory.

csaybar commented 2 years ago

Hi @Leprechault unfortunately I can't reproduce your issue, but it seems to be an issue with the paths. I notice that ee_imagecollection_to_local does not return an error when the directory does not exist. I will fix this in the next release. Please, we will be very grateful if you can figure out why the output file is not written in your system