rgee
rgee copied to clipboard
ee_print wrong Nominal scale
- rgee version: 1.1.6.999
- R version: R 4.3.1
- Operating System: win 10
The code is as follows, the image resolution preview is correct, but the result of ee_print is wrong, why?
library(rgee)
library(sf)
# library(remotes)
# install_github("r-spatial/rgee")
# ee_reattach() # reattach ee as a reserved word
ee_Initialize(drive = T)
ee_roi <- read_sf("./ROI.gpkg", query = 'SELECT * FROM MongoliaTuLatest') %>%
sf_as_ee()
gimmsIC = ee$ImageCollection("NASA/GIMMS/3GV0")$
select('ndvi')
modis = ee$ImageCollection("MODIS/061/MOD13A2")$
select('NDVI')
#创建MODIS时间序列
startyear = 2001
endyear = 2021
startmonth = 1
endmonth= 12
startdate = ee$Date$fromYMD(startyear, startmonth, 1)
enddate = ee$Date$fromYMD(endyear+1, endmonth, 1)
years = ee$List$sequence(startyear, endyear)
months = ee$List$sequence(startmonth,endmonth)
Modis = modis$filterDate(startdate, enddate)$
sort('system:time_start', FALSE) #按时间对MODIS NDVI影像集排序
#MODIS 月度NDVI
Modism = ee$ImageCollection$fromImages(
years$map(
ee_utils_pyfunc(function(y){
return(
months$map(
ee_utils_pyfunc(function(m){
w = Modis$filter(ee$Filter$calendarRange(y, y, 'year'))$
filter(ee$Filter$calendarRange(m, m, 'month'))$
max()$
multiply(0.0001)
return(
w$set('year', y)$
set('month', m)$
set('system:time_start',ee$Date$fromYMD(y,m,1)$millis())
)
})
)
)
})
)$flatten()
)
ee_print(Modism)
modMAX1 = ee$Image(Modism$sort('system:time_start', FALSE)$toList(200)$get(100))
Map$centerObject(ee_roi)
Map$addLayer(
eeObject = modMAX1,
visParams = ndviVis,
"NDVI"
)+
Map$addLayer(ee_roi)+
Map$addLegend(ndviVis)