r-spatial / rgee

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

ee_print Error in strsplit(code, ":") : non-character argument #313

Closed TianyaImpression closed 1 year ago

TianyaImpression commented 1 year ago

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

library(rgee)

# Initialize the Earth Engine module.
ee_Initialize()

# Print metadata for a DEM dataset.
print(ee$Image('USGS/SRTMGL1_003')$getInfo())

Attach your Python (reticulate) configuration:

library(reticulate)
py_config()

Description

I tried to use rgee to download terraclimate data, I use ee_print() to see the metadata, it failed.

library(rgee)

ee_Initialize(drive = T)

terraclimate = ee$ImageCollection('IDAHO_EPSCOR/TERRACLIMATE')
ee_print(terraclimate)

image

I tried to see the MODIS ImageCollection metadata, it's ok.

image

I wonder if there is a bug in ee_print(). The Earth Engine Snippet of terraclimate data has an underscore. Is the underscore in front of the slash affecting the work of ee_print()?

image

Thank you!

csaybar commented 1 year ago

Hi @TianyaImpression, I just fixed this issue in the latest version. Thank you so much for reporting!

TianyaImpression commented 1 year ago

Hi @TianyaImpression, I just fixed this issue in the latest version. Thank you so much for reporting!

The bug didnot fixed. I updated rgee 1.1.6 and tried to ee_print terraclimate data again, it report error: Error in strsplit(code, ":") : object 'band_metadata' not found

beatsandwich commented 1 year ago

I am receiving the same error when using ee_print on Images or ImageCollections. I do not receive the error when using ee_print on Features or FeatureCollections.

Error in strsplit(code, ":") : object 'band_metadata' not found

rgee version: 1.1.6 R version: 2022.12.0+353 OS: MacOS Venture 13.2.1 (Apple M1)

csaybar commented 1 year ago

Deeply sorry for the late reply, I just fixed this. Please let us know if the problem persists. I will work on it ASAP.

beatsandwich commented 1 year ago

That fixed it. Thank you @csaybar !

beatsandwich commented 1 year ago

Hi @csaybar . I am receiving the original error from this thread: Error in strsplit(code, ":") : non-character argument

This only occurs for certain Images and Image Collections I've tried.

For instance, running either of these generates the error: climate = ee$ImageCollection("OREGONSTATE/PRISM/Norm91m") ee_print(climate)

clay = ee$Image("projects/soilgrids-isric/clay_mean") ee_print(clay)

cdl = ee$ImageCollection('USDA/NASS/CDL') ee_print(cdl)

But these do not generate the error: cdl = ee$ImageCollection('USDA/NASS/CDL')$filterDate('2022-01-01','2022-12-31')$first() ee_print(cdl)

Here is the traceback for one of the errors:

ee_print(climate) Error in strsplit(code, ":") : non-character argument traceback() 8: strsplit(code, ":") 7: tolower(strsplit(code, ":")[[1]][1]) 6: ee_utils_get_crs(img_proj$crs) 5: ee_image_info(image = selected_img, compression_ratio = compression_ratio, quiet = TRUE) 4: ee_print.ee.image.Image(eeobject = img, img_band = img_band, time_end = time_end, compression_ratio = compression_ratio, quiet = TRUE, clean = TRUE) 3: ee_print(eeobject = img, img_band = img_band, time_end = time_end, compression_ratio = compression_ratio, quiet = TRUE, clean = TRUE) 2: ee_print.ee.imagecollection.ImageCollection(climate) 1: ee_print(climate)

gee version: 1.1.5 MacOS version: Ventura 13.2.1

beatsandwich commented 1 year ago

That should say 'rgee version' not 'gee version'