Skip to content

Instantly share code, notes, and snippets.

@jdbcode
Last active October 25, 2021 22:22
Show Gist options
  • Save jdbcode/dc261845572fbd9e53602c55bfdc2ee0 to your computer and use it in GitHub Desktop.
Save jdbcode/dc261845572fbd9e53602c55bfdc2ee0 to your computer and use it in GitHub Desktop.
// 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');
return confImg.gte(0.3).selfMask()
.set('system:time_start', img.get('system:time_start'));
});
// Join the fire collection to the CMI collection.
var joinFilter = ee.Filter.equals({
leftField: 'system:time_start',
rightField: 'system:time_start'
});
var joinedCol = ee.Join.saveFirst('match')
.apply(geosVisCol, fdcVisCol, joinFilter);
// Overlay visualized fire pixels on corresponding visualized CMI image.
var cmiFdcVisCol = ee.ImageCollection(joinedCol.map(function(img) {
var cmi = ee.Image(img).visualize({
bands: ['CMI_C02', 'CMI_GREEN', 'CMI_C01'],
min: 0,
max: 0.8,
gamma: 0.8,
});
var fdc = ee.Image(img.get('match')).visualize({
palette: ['ff5349'],
min: 0,
max: 1,
opacity: 0.7
});
return cmi.blend(fdc).set('system:time_start', img.get('system:time_start'));
}));
// Set display parameters and render the animation.
var cmiFdcVisParams = {
dimensions: 600,
framesPerSecond: 10,
region: ee.Geometry.BBox(-120.61, 36.84, -118.23, 37.87),
crs: 'EPSG:3857'
};
print(ui.Thumbnail(cmiFdcVisCol, cmiFdcVisParams));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment