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

Failing to get spectral indexes #11

Open
Cidree opened this issue Sep 21, 2023 · 0 comments
Open

Failing to get spectral indexes #11

Cidree opened this issue Sep 21, 2023 · 0 comments

Comments

@Cidree
Copy link

Cidree commented Sep 21, 2023

Hello,

I am trying to get spectral indexes using the function ee$Image$spectralIndex() without success.

# Load libraries
library(rgee)
library(rgeeExtra)

# Initialize Earth Engine
ee_Initialize()
extra_Initialize()

## Attempt 1: copied from rgee book ----

ds <- 'LANDSAT/LC08/C01/T1_SR'

ee$ImageCollection(ds) %>% 
  ee_ImageCollection_scaleAndOffset() %>% 
  ee_ImageCollection_spectralIndex(c('NDVI', 'GNDVI', 'NDSI'))

# Error in ee_ImageCollection_spectralIndex(., c("NDVI", "GNDVI", "NDSI")) : 
#   could not find function "ee_ImageCollection_spectralIndex"

## Attempt 2: copied from function reference ----

s2_indices <- ee$ImageCollection("COPERNICUS/S2_SR") %>%
  ee$ImageCollection$first() %>%
  ee$Image$preprocess()%>%
  ee$Image$spectralIndex(c("NDVI", "SAVI"))

# Error in EEextra_PYTHON_PACKAGE$QA : 
#   RuntimeError: $ operator is invalid for atomic vectors

## Attempt 3 ----

## Get an image (works)
s2_img <- ee$ImageCollection("COPERNICUS/S2_SR") %>% 
  ee$ImageCollection$first()

## Preprocess (no not work)
ee$Image$preprocess(s2_img)

#Error in EEextra_PYTHON_PACKAGE$Spectral : 
#  RuntimeError: $ operator is invalid for atomic vectors

## Get spectral indexes (do not work)
ee$Image$spectralIndex(s2_img)

#Error in EEextra_PYTHON_PACKAGE$Spectral : 
#  RuntimeError: $ operator is invalid for atomic vectors

I am working with R 4.3.1, RStudio 2023.06.1, rgee version 1.1.7 and rgeeExtra development version.

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