r-spatial / rgee

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

ee_extract doesn't work #321

Open wildeco opened 1 year ago

wildeco commented 1 year ago

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

Error: object 'earthengine' not found


- [ ] You can find the credentials file on your system: 
```r
library(rgee)
ee_path <- path.expand("~/.config/earthengine/credentials")
file.exists(ee_path)
TRUE
library(rgee)

# Initialize the Earth Engine module.
ee_Initialize()

 ✔ user: not_defined 
 ✔ Initializing Google Earth Engine:  DONE!
 ✔ Earth Engine account: users/rosh

# Print metadata for a DEM dataset.
$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"

> Sys.which("python")
                                     python 
"/home/roshan/.virtualenvs/rgee/bin/python" 
> earthengine -h
Error: object 'earthengine' not found
> Sys.getenv("HOME")
[1] "/home/roshan"
> ee_check()
◉  Python version
✔ [Ok] /home/roshan/.virtualenvs/rgee/bin/python v3.10
◉  Python packages:
✔ [Ok] numpy
✔ [Ok] earthengine-api
Error in ee_check_gcloud() : 
  gcloud failed [os.system('gcloud --help')]. Please check
      for any errors above and install gcloud if needed (https://cloud.google.com/sdk/docs/install).
> 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:

python: /home/roshan/.virtualenvs/rgee/bin/python libpython: /home/roshan/.local/share/r-miniconda/lib/libpython3.10.so pythonhome: /home/roshan/.virtualenvs/rgee:/home/roshan/.virtualenvs/rgee version: 3.10.8 (main, Nov 24 2022, 14:13:03) [GCC 11.2.0] numpy: /home/roshan/.virtualenvs/rgee/lib/python3.10/site-packages/numpy numpy_version: 1.24.1 ee: /home/roshan/.virtualenvs/rgee/lib/python3.10/site-packages/ee

NOTE: Python version was forced by RETICULATE_PYTHON

Description

I can run all the examples from rgee site. However, I can't run the ee_extract function.

What I Did

ee_nc_rain <- ee_extract(x = terraclimate, y = nc["NAME"], sf = FALSE) 

Returns this error: 

The image scale is set to 1000.
Error in class(res) <- c(class(res), c("geo_json", "json")) : 
  attempt to set an attribute on NULL
csaybar commented 1 year ago

Hi @R-Sharmaa, thanks for opening this issue.

Unfortunately, I can't reproduce this issue, can you provide us with a reproducible example?