r-spatial / rgee

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

Error in `confirm_some_files()`:....! `file` does not identify at least one Drive file. #240

Closed Fredtouz closed 2 years ago

Fredtouz 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()
── rgee 1.1.2.9000 ───────────────────────────────────────────────earthengine-api 0.1.301 ── 
 ✓ user: not_defined
 ✓ Google Drive credentials:Auto-refreshing stale OAuth token.
 ✓ Google Drive credentials:  FOUND
 ✓ Initializing Google Earth Engine:  DONE!
 ✓ Earth Engine account: users/fredt 
───────────────────────────────────────────────────────────────────────────────────
# Print metadata for a DEM dataset.
print(ee$Image('USGS/SRTMGL1_003')$getInfo())
$type
[1] "Image"

$bands
$bands[[1]]
$bands[[1]]$id
[1] "elevation"

$bands[[1]]$data_type
$bands[[1]]$data_type$type
[1] "PixelType"

$bands[[1]]$data_type$precision
[1] "int"

$bands[[1]]$data_type$min
[1] -32768

$bands[[1]]$data_type$max
[1] 32767

$bands[[1]]$dimensions
[1] 1296001  417601

$bands[[1]]$crs
[1] "EPSG:4326"

$bands[[1]]$crs_transform
$bands[[1]]$crs_transform[[1]]
[1] 0.0002777778

$bands[[1]]$crs_transform[[2]]
[1] 0

$bands[[1]]$crs_transform[[3]]
[1] -180.0001

$bands[[1]]$crs_transform[[4]]
[1] 0

$bands[[1]]$crs_transform[[5]]
[1] -0.0002777778

$bands[[1]]$crs_transform[[6]]
[1] 60.00014

$id
[1] "USGS/SRTMGL1_003"

$version
[1] -1000009435

$properties
$properties$`system:visualization_0_min`
[1] "0.0"

$properties$type_name
[1] "Image"

$properties$keywords
[1] "dem"         "elevation"   "geophysical" "nasa"        "srtm"        "topography"  "usgs"       

$properties$thumb
[1] "https://mw1.google.com/ges/dd/images/SRTM90_V4_thumb.png"

$properties$description
[1] "<p>The Shuttle Radar Topography Mission (SRTM, see <a href=\"https://onlinelibrary.wiley.com/doi/10.1029/2005RG000183/full\">Farr\net al. 2007</a>)\ndigital elevation data is an international research effort that\nobtained digital elevation models on a near-global scale. This\nSRTM V3 product (SRTM Plus) is provided by NASA JPL\nat a resolution of 1 arc-second (approximately 30m).</p><p>This dataset has undergone a void-filling process using open-source data\n(ASTER GDEM2, GMTED2010, and NED), as opposed to other versions that\ncontain voids or have been void-filled with commercial sources.\nFor more information on the different versions see the\n<a href=\"https://lpdaac.usgs.gov/documents/13/SRTM_Quick_Guide.pdf\">SRTM Quick Guide</a>.</p><p>Documentation:</p><ul><li><p><a href=\"https://lpdaac.usgs.gov/documents/179/SRTM_User_Guide_V3.pdf\">User&#39;s Guide</a></p></li><li><p><a href=\"https://lpdaac.usgs.gov/documents/13/SRTM_Quick_Guide.pdf\">General Documentation</a></p></li><li><p><a href=\"https://doi.org/10.1029/2005RG000183\">Algorithm Theoretical Basis Document (ATBD)</a></p></li></ul><p><b>Provider: <a href=\"https://cmr.earthdata.nasa.gov/search/concepts/C1000000240-LPDAAC_ECS.html\">NASA / USGS / JPL-Caltech</a></b><br><p><b>Bands</b><table class=\"eecat\"><tr><th scope=\"col\">Name</th><th scope=\"col\">Description</th></tr><tr><td>elevation</td><td><p>Elevation</p></td></tr></table><p><b>Terms of Use</b><br><p>Unless otherwise noted, images and video on JPL public\nweb sites (public sites ending with a jpl.nasa.gov address) may\nbe used for any purpose without prior permission. For more information\nand exceptions visit the <a href=\"https://www.jpl.nasa.gov/imagepolicy/\">JPL Image Use Policy site</a>.</p><p><b>Suggested citation(s)</b><ul><li><p>Farr, T.G., Rosen, P.A., Caro, E., Crippen, R., Duren, R., Hensley,\nS., Kobrick, M., Paller, M., Rodriguez, E., Roth, L., Seal, D.,\nShaffer, S., Shimada, J., Umland, J., Werner, M., Oskin, M., Burbank,\nD., and Alsdorf, D.E., 2007, The shuttle radar topography mission:\nReviews of Geophysics, v. 45, no. 2, RG2004, at\n<a href=\"https://doi.org/10.1029/2005RG000183\">https://doi.org/10.1029/2005RG000183</a>.</p></li></ul><style>\n  table.eecat {\n  border: 1px solid black;\n  border-collapse: collapse;\n  font-size: 13px;\n  }\n  table.eecat td, tr, th {\n  text-align: left; vertical-align: top;\n  border: 1px solid gray; padding: 3px;\n  }\n  td.nobreak { white-space: nowrap; }\n</style>"

$properties$source_tags
[1] "nasa" "usgs"

$properties$visualization_0_max
[1] "6000.0"

$properties$title
[1] "NASA SRTM Digital Elevation 30m"

$properties$product_tags
[1] "srtm"        "elevation"   "topography"  "dem"         "geophysical"

$properties$provider
[1] "NASA / USGS / JPL-Caltech"

$properties$visualization_0_min
[1] "0.0"

$properties$visualization_0_name
[1] "Elevation"

$properties$date_range
[1] 1039427584 1989827584

$properties$`system:visualization_0_gamma`
[1] "1.6"

$properties$period
[1] 0

$properties$`system:visualization_0_bands`
[1] "elevation"

$properties$provider_url
[1] "https://cmr.earthdata.nasa.gov/search/concepts/C1000000240-LPDAAC_ECS.html"

$properties$visualization_0_gamma
[1] "1.6"

$properties$sample
[1] "https://mw1.google.com/ges/dd/images/SRTM90_V4_sample.png"

$properties$tags
[1] "dem"         "elevation"   "geophysical" "nasa"        "srtm"        "topography"  "usgs"       

$properties$`system:visualization_0_max`
[1] "6000.0"

$properties$`system:visualization_0_name`
[1] "Elevation"

$properties$`system:asset_size`
[1] -351347924

$properties$visualization_0_bands
[1] "elevation"

Attach your Python (reticulate) configuration:

library(reticulate)
py_config()
python:         /home/fredt/.virtualenvs/rgee/bin/python
libpython:      /home/fredt/.local/share/r-miniconda/envs/r-reticulate/lib/libpython3.8.so
pythonhome:     /home/fredt/.virtualenvs/rgee:/home/fredt/.virtualenvs/rgee
version:        3.8.12 | packaged by conda-forge | (default, Jan 30 2022, 23:53:36)  [GCC 9.4.0]
numpy:          /home/fredt/.virtualenvs/rgee/lib/python3.8/site-packages/numpy
numpy_version:  1.22.2
ee:             /home/fredt/.virtualenvs/rgee/lib/python3.8/site-packages/ee

NOTE: Python version was forced by RETICULATE_PYTHON

Description

I open a second time this issue (https://github.com/r-spatial/rgee/issues/210) as it does not seem to be solved, at least for me. I reinstalled rgee with the last version and each time I tried to dowload image collections I got the same error message. Specifying or note dsn in ee_imagecollection_to_local does not change anything.

What I Did

library(rgee)
ee_install()
library(rgeeExtra)
dataset <- ee$ImageCollection('MODIS/MOD09GA_006_EVI') %>%
  ee$ImageCollection$filterBounds(mask) %>%
  ee$ImageCollection$filterDate("2010-01-01", "2010-12-31") %>%
  ee_get(0:4)
ee_Initialize(drive = TRUE, gcs = FALSE)
ee_imagecollection_to_local(
+   ic = dataset,
+   region = mask$geometry()$bounds(),
+   dsn = "~/Documents/Chiro/GM/DATA/DataChasse/MODIS/MOD09GA_EVI_",
+   via = "drive",
+   container = "MOD09GA_006_EVI"
+ )
──────────────────────── Downloading ImageCollection - via drive ──- region parameters
 sfg      : POLYGON ((-2.857247 47.2487 .... .91235, -2.857247 47.24873)) 
 CRS      : GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563, ..... 
 geodesic : FALSE 
 evenOdd  : TRUE 

Error in `confirm_some_files()`:M/DATA/DataChasse/MODIS/MOD09GA_EVI_2010_01_01.tif
! `file` does not identify at least one Drive file.
Run `rlang::last_error()` to see where the error occurred.
sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=fr_FR.UTF-8       LC_NUMERIC=C               LC_TIME=fr_FR.UTF-8        LC_COLLATE=fr_FR.UTF-8     LC_MONETARY=fr_FR.UTF-8   
 [6] LC_MESSAGES=fr_FR.UTF-8    LC_PAPER=fr_FR.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] rgeeExtra_0.0.1 sf_1.0-7        dplyr_1.0.8     lubridate_1.8.0 readxl_1.3.1    reticulate_1.24 rgee_1.1.2.9000 remotes_2.4.2  

loaded via a namespace (and not attached):
 [1] httr_1.4.2         jsonlite_1.8.0     assertthat_0.2.1   askpass_1.1        sp_1.4-6           cellranger_1.1.0   yaml_2.3.5        
 [8] globals_0.14.0     pillar_1.7.0       lattice_0.20-45    glue_1.6.2         digest_0.6.29      htmltools_0.5.2    Matrix_1.4-0      
[15] pkgconfig_2.0.3    httpcode_0.3.0     listenv_0.8.0      stars_0.5-5        purrr_0.3.4        processx_3.5.2     tibble_3.1.6      
[22] openssl_1.4.6      proxy_0.4-26       googledrive_2.0.0  generics_0.1.2     ellipsis_0.3.2     withr_2.5.0        geojsonio_0.9.4   
[29] lazyeval_0.2.2     cli_3.2.0          magrittr_2.0.2     crayon_1.5.0       evaluate_0.15      maptools_1.1-2     ps_1.6.0          
[36] parallelly_1.30.0  fs_1.5.2           fansi_1.0.2        future_1.24.0      lwgeom_0.2-8       foreign_0.8-82     class_7.3-20      
[43] geojsonsf_2.0.2    pkgbuild_1.3.1     tools_4.1.2        prettyunits_1.1.1  gargle_1.2.0       lifecycle_1.0.1    geojson_0.3.4     
[50] V8_4.1.0           callr_3.7.0        compiler_4.1.2     e1071_1.7-9        jqr_1.2.2          rlang_1.0.2        classInt_0.4-3    
[57] units_0.8-0        grid_4.1.2         rstudioapi_0.13    htmlwidgets_1.5.4  crosstalk_1.2.0    rmarkdown_2.11     codetools_0.2-18  
[64] abind_1.4-5        DBI_1.1.2          curl_4.3.2         R6_2.5.1           knitr_1.37         rgdal_1.5-23       fastmap_1.1.0     
[71] rgeos_0.5-9        utf8_1.2.2         rprojroot_2.0.2    KernSmooth_2.23-20 parallel_4.1.2     crul_1.2.0         Rcpp_1.0.8        
[78] vctrs_0.3.8        png_0.1-7          xfun_0.30          leaflet_2.1.0      tidyselect_1.1.2  

Any idea of the issue? Thanks, Fred

Fredtouz commented 2 years ago

Adding the argumment lazy = TRUE in the function ee_imagecollection_to_local solved the issue.