This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rgee) | |
ee_Initialize() | |
download_point <- function(point_name, output = ".") { | |
# Create folder | |
point_dir <- sprintf("%s/%s", output, point_name) | |
dir.create(point_dir, showWarnings = FALSE) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Spatial R packages ------------------------------------------------------ | |
library(cptcity) | |
library(mapview) | |
library(leaflet) | |
library(rgee) | |
library(sf) | |
# Initialize Google Earth Engine (Just One time) | |
ee_Initialize() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(rgee) | |
library(sf) | |
library(googledrive) | |
library(googleCloudStorageR) | |
library(lwgeom) | |
library(reticulate) | |
library(jsonlite) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Save here your images |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rgee) | |
# ------------------------------------------------------------------------- | |
# 1. Load Earth Engine ---------------------------------------------------- | |
# ------------------------------------------------------------------------- | |
ee_Initialize(drive = TRUE) | |
# ------------------------------------------------------------------------- | |
# 2. Auxiliary functions -------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import List | |
import datetime | |
import pathlib | |
import re | |
class Sen2CubeFiles: | |
def __init__(self, path: str): | |
self.path = path | |
self.__fake_path = path | |
self._files = self.search_iter(".") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Travel time to school facilities as a marker of geographical ## | |
## accessibility across heterogeneous land cov ## | |
##' @GabrielCarrasco-Escobar, @EdgarManrique, @KellyTello-Lizarraga, ## | |
##' @J.JaimeMiranda,@AntonyBarja ## | |
##'-------------------------------------------------------------------## | |
# Requerements | |
library(tidyverse) | |
library(cptcity) | |
library(rgee) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rgee) | |
ee_Initialize() | |
col <- ee$ImageCollection("JRC/GSW1_1/YearlyHistory")$map(function(img) { | |
year <- img$date()$get("year") | |
yearImg <- img$gte(2)$multiply(year) | |
despeckle <- yearImg$connectedPixelCount(15, TRUE)$eq(15) | |
yearImg$updateMask(despeckle)$selfMask()$set("year", year) | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(stars) | |
library(rgee) | |
# remotes::install_github("r-spatial/[email protected]") | |
ee_Initialize("csaybar", gcs = TRUE) | |
# Properties to attach to the uploaded raster | |
raster_properties <- list(prop2=1, prop1=2) | |
# ------------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rgee) | |
library(magick) | |
ee_Initialize() | |
col <- ee$ImageCollection("JRC/GSW1_1/YearlyHistory")$map(function(img) { | |
year <- img$date()$get("year") | |
yearImg <- img$gte(2)$multiply(year) | |
despeckle <- yearImg$connectedPixelCount(15, TRUE)$eq(15) | |
yearImg$updateMask(despeckle)$selfMask()$set("year", year) |