Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ee_print wrong Nominal scale #341

Open
TianyaImpression opened this issue Jun 29, 2023 · 0 comments
Open

ee_print wrong Nominal scale #341

TianyaImpression opened this issue Jun 29, 2023 · 0 comments

Comments

@TianyaImpression
Copy link

  • 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)

image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant