I'm trying to apply $select at a imageCollection object in rgee but I face the error when I source my script: Error in py_get_attr_impl(x, name, silent) : OverflowError: Python int too large to convert to C long
When I run every command individually,line by line, in R studio console no problem happens.
Here is the shapefile used in this example : https://mega.nz/file/RkcDxARZ#9lgwP6-RMGE1DgMZ5eE6YoxI8cmYER6iJflVUzsmGtI
rgee version: rgee 1.1.4 R version: 4.2.1 Operating System: Win 10
If I run this code in R Studio console it executes and finish without problems, when I source the script it does not work.
shid<-shapefile("D:/temp/rgee_example/feat1.shp")
ids<-shid$text1
require(rgee)
require(mapview)
ee_Initialize(drive = TRUE)
shp<-ee$FeatureCollection("users/********/feat1")
sentinel2 <- ee$ImageCollection$Dataset$COPERNICUS_S2$
filterDate("2021-08-01","2021-08-30")$
filterBounds(shp)
#info<-sentinel2$getInfo()
sentBands<-sentinel2$toBands()
nshp<-shp$filter('text1 == "id1"')
k=1
#for(k in 1:length(ids)){
#nshp<-shp$filter(paste0("'text1 == " ,'"', ids[k] ,'"', "'"))
sentBands<-sentBands$clip(nshp)
info<-sentBands$getInfo()
b2Sele<-NULL
for(i in 1:length(info$bands)){
imId<-info$bands[[i]]$id
if(length(grep("_B2",imId))==1)b2Sele[length(b2Sele)+1]<-imId
}
sentB2 <- sentBands$select(c(b2Sele))
ee_raster <- ee_as_raster(
image = sentB2,
region = nshp$geometry(),
dsn = paste0("D:/gee/sentinel2/date_stack/sentinel2_B2_",ids[k],".tif"),
via = "drive"
)
> source("~/.active-rstudio-document")
── rgee 1.1.4 ─────────────────────────────────────────────────────── earthengine-api 0.1.318 ──
✔ user: not_defined
✔ Google Drive credentials: FOUND
✔ Initializing Google Earth Engine: DONE!
✔ Earth Engine account: users/*********
────────────────────────────────────────────────────────────────────────────────────────────────
Error in py_get_attr_impl(x, name, silent) :
OverflowError: Python int too large to convert to C long