system:time_start
Open
@ambarja is already working on this.
Since Sep 16, 2023.
question
- Dominant language
- R
- Stars
- 777
- Forks
- 159
- PR merge metrics
- No merged PRs in 30d
Description
- rgee version: 1.5.5
- R version: 4.2.2
- Operating System: windows 10
Description
I tried to to rename each image from sentinel 2 at format "YYYY-MM-dd". But the images dont change the format of the dates
What I Did
library(pacman)
p_load(rgee, reticulate, sf, sp, tidyverse, lubridate, DescTools)
ee_Initialize(drive = T)
archivo <- choose.files(caption = "Seleccione archivo a estandatizar (shp, gpkg)",
multi = FALSE)
file_name <- paste0(tools::file_path_sans_ext(archivo),
'_AMBIENTADO_GCI.',
tools::file_ext(archivo))
poligono<-st_read(archivo, crs= 32721, stringsAsFactors = FALSE,
quiet = TRUE)
roi <-poligono %>%
sf_as_ee()
#Creamos una coleccion de imagenes
collection_imag<- ee$ImageCollection("COPERNICUS/S2_HARMONIZED")$
filterBounds(roi)$
filter(ee$Filter$lt("CLOUD_COVERAGE_ASSESSMENT", 1))
#function to calculate satellite index
func_gci <-function(image){
gci =image$expression(
expression = 'NIR/GREEN-1',
opt_map = list(
'NIR' = image$select('B8'),
'GREEN' = image$select('B3')
)
)
return(image$addBands(gci$rename('GCI')))
}
collection_gci<- collection_imag$map(func_gci)$
select("GCI")$map(function(image) {
image$clip(roi)
}
)
rescale_rename <- function(image) {
date <- ee$Date(image$get("system:time_start"))$format('YYYY_MM_dd')
return(image$select('GCI')$rename(date))
}
gci_rescaled <- collection_gci$map(rescale_rename)
# Crear una grilla regular de 10 metros x 10 metros centrada en los polígonos
grid <- poligono%>%
st_make_grid(what = "centers", cellsize = c(250, 250))%>%
st_intersection(poligono)%>%
sf_as_ee()
# Extraer los valores de la imagen apilada utilizando la grilla
valores <- ee_extract(gci_rescaled, grid, sf = T, scale = 20)
X20230531T135709_20230531T140936_T21HTE_2023_05_31
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.