Skip to content

Instantly share code, notes, and snippets.

View jdbcode's full-sized avatar

Justin Braaten jdbcode

View GitHub Profile
@jdbcode
jdbcode / g4g22_ndvi_animation.ipynb
Created October 3, 2022 15:35
g4g22_ndvi_animation.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jdbcode
jdbcode / medium_featureview_styling.js
Created May 11, 2022 17:19
[Medium] FeatureView styling
var styleRules = {
pointSize: 15,
pointFillColor: {
property: 'fuel1',
categories: [
['Coal', '#CD3290'],
['Gas', '#3290CD'],
['Nuclear', '#90CD32'],
]
},
@jdbcode
jdbcode / ee_landtrendr_example.ipynb
Last active February 3, 2024 18:43
ee_landtrendr_example.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_numpy_array_with_pixel_coordinates.ipynb
Last active March 1, 2022 21:43
Include coordinates of image pixels transferred from Earth Engine to Numpy array
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jdbcode
jdbcode / ee_zonal_stats_demo.ipynb
Last active January 13, 2022 17:19
Demo for calculating raster zonal statistics for many zones in parallel using Google 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 / colab_to_markdown.ipynb
Last active January 5, 2022 20:08
Convert a Colab notebook to Markdown with nbconvert
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// Get the fire/hotspot characterization dataset.
var fdcCol = ee.ImageCollection('NOAA/GOES/17/FDCF')
.filterDate('2020-09-05T15:00', '2020-09-06T02:00');
// Identify fire-detected pixels of medium to high confidence.
var fireMaskCodes = [10, 30, 11, 31, 12, 32, 13, 33, 14, 34, 15, 35];
var confVals = [1.0, 1.0, 0.9, 0.9, 0.8, 0.8, 0.5, 0.5, 0.3, 0.3, 0.1, 0.1];
var defaultConfVal = 0;
var fdcVisCol = fdcCol.map(function(img) {
var confImg = img.remap(fireMaskCodes, confVals, defaultConfVal, 'Mask');
// Change display bands to false color.
visParams.bands = ['CMI_C05', 'CMI_C03', 'CMI_GREEN'];
print(ui.Thumbnail(geosVisCol, visParams));
// Get CMI image collection and process it for visualization.
var geosVisCol = ee.ImageCollection('NOAA/GOES/17/MCMIPF')
.filterDate('2020-09-05T15:00', '2020-09-06T02:00')
.map(processForVis);
// Set display parameters and render the animation.
var visParams = {
bands: ['CMI_C02', 'CMI_GREEN', 'CMI_C01'],
min: 0,
max: 0.8,
// Applies scaling factors.
var applyScaleAndOffset = function(img) {
var getFactorImg = function(factorNames) {
var factorList = img.toDictionary().select(factorNames).values();
return ee.Image.constant(factorList);
};
var scaleImg = getFactorImg(['CMI_C.._scale']);
var offsetImg = getFactorImg(['CMI_C.._offset']);
var scaled = img.select('CMI_C..').multiply(scaleImg).add(offsetImg);
return img.addBands({srcImg: scaled, overwrite: true});