Skip to content

Instantly share code, notes, and snippets.

View jdbcode's full-sized avatar

Justin Braaten jdbcode

View GitHub Profile
@jdbcode
jdbcode / medium_chart_doc_update_ex_02.js
Created March 18, 2021 19:41
[Medium] Code example 02 for the Medium blog on Earth Engine charting guide update
var collection = ee.ImageCollection('MODIS/006/MOD13A2');
var band = 'NDVI';
var where = ee.Geometry.Point([-93.51, 35.76]);
print(ui.Chart.image.doySeriesByYear(collection, band, where));
@jdbcode
jdbcode / medium_chart_doc_update_ex_03.js
Created March 18, 2021 19:42
[Medium] Code example 03 for the Medium blog on Earth Engine charting guide update
var what = ee.ImageCollection('MODIS/006/MOD13A2').select('NDVI');
var where = ee.FeatureCollection([
ee.Feature(ee.Geometry.Point([-93.51, 35.76]), {'veg_type': 'Deciduous'}),
ee.Feature(ee.Geometry.Point([-122.06, 37.01]), {'veg_type': 'Coniferous'})
]);
var how = ee.Reducer.mean();
var by = 'veg_type';
print(ui.Chart.image.seriesByRegion(what, where, how, null, null, null, by));
@jdbcode
jdbcode / medium_chart_doc_update_ex_04.js
Created March 18, 2021 19:42
[Medium] Code example 04 for the Medium blog on Earth Engine charting guide update
var what = ee.ImageCollection('MODIS/006/MOD13A2').select('NDVI');
var where = ee.Geometry.Point([-93.51, 35.76]);
var chartStyle = {
title: 'ggplot2 Default Chart Style',
colors: ['F8766D'],
hAxis: {
title: 'Observation Date',
titleTextStyle: {italic: false, bold: true},
gridlines: {color: 'FFF'},
baselineColor: 'FFF'
@jdbcode
jdbcode / gee_calculate_tc.ipynb
Last active March 19, 2021 20:54
Calculate Landsat surface reflectance Tasseled Cap transformation using Earth Engine
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jdbcode
jdbcode / naip_in_earth_engine.ipynb
Created April 21, 2021 22:08
naip_in_earth_engine.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jdbcode
jdbcode / ee_pdsi_chart_altair_ggplot2.ipynb
Last active April 27, 2021 21:20
Earth Engine PDSI data reduction plotted with Altair and ggplot2
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jdbcode
jdbcode / medium_rstudio_cloud_rgee_ndvi.R
Last active May 22, 2021 18:19
[Medium] RStudio Cloud and rgee NDVI animation
library(rgee)
library(sf)
library(magick)
ee_Initialize()
mask <- system.file("shp/arequipa.shp", package = "rgee") %>%
st_read(quiet = TRUE) %>%
sf_as_ee()
@jdbcode
jdbcode / medium_rstudio_cloud_rgee_eemont_ndwi.R
Last active May 12, 2021 16:40
[Medium] RStudio Cloud and rgee eemont NDWI
library(rgee)
library(RColorBrewer)
library(reticulate)
ee_Initialize()
eemont <- reticulate::import("eemont")
point <- ee$Geometry$Point(c(-76.9, 7.2))
L8 <- (ee$ImageCollection('LANDSAT/LC08/C01/T1_SR')
@jdbcode
jdbcode / medium_rstudio_cloud_rgee_precip.R
Last active May 21, 2021 22:59
[Medium] RStudio Cloud and rgee precip
library(rgee)
library(tidyverse)
library(sf)
ee_Initialize()
nc <- st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
terraclimate <- (ee$ImageCollection("IDAHO_EPSCOR/TERRACLIMATE")
$filterDate("2001-01-01", "2002-01-01")
@jdbcode
jdbcode / medium_rstudio_cloud_rgee_nightlights.R
Last active May 22, 2021 18:20
[Medium] RStudio Cloud and rgee nightlights
library(rgee)
ee_Initialize()
createTimeBand <- function(img) {
year <- (ee$Date(img$get("system:time_start"))
$get("year")$subtract(1991L))
ee$Image(year)$byte()$addBands(img)
}