CZU Fire Complex
Introduction
This tutorial introduces a general workflow to map the burn severity of wildfire with Sentinel-2 data and compare the result to a global dataset of building footprints.
We will use the CZU Lightning Complex fires on California’s Slow Coast as a case study.
As you work through the tutorial, you may find it helpful to refer to the fire scars page in the glossary and the Sentinel-2 page in the starters.
Your final result should look and work like the map in the app below.
Start a new file
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Title: wk07_CZU_fire_complex.js
// Author: Jeff Howarth
// Date: Oct 24, 2023
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sentinel-2 starter script
Define aoi
Adjust ingredients
Adjust display
// Import image tools module.
var tools = require('users/jhowarth/eePrimer:modules/image_tools.js');
// Make a histogram to see data distribution.
var histogram = tools.makeHistogram(
output,
viz_bands[2],
30,
0,
0.5
)
;
// Print, print, print...
print(
"Histogram",
histogram
)
;
Write function
// ----------------------------------------------------------------------
// Write image processing workflow as a function.
// ----------------------------------------------------------------------
Apply function
// ----------------------------------------------------------------------
// Apply function to create a post- and pre- burn image.
// ----------------------------------------------------------------------
var post_burn ;
var pre_burn ;
// Display both as map layers.
Calculate NBR
// ----------------------------------------------------------------------
// Calculate normalized burn ratio for both snapshots.
// ----------------------------------------------------------------------
// var spectral = require("users/dmlmont/spectral:spectral");
// print(spectral);
// // Test the method.
var nbr_test ;
// Write a function to estimate normalized burn ratio.
var makeBurnRatio ;
// Apply function to post- and pre- conditions.
var post_burn_ratio ;
var pre_burn_ratio ;
// Display as map layers.
Calculate burn severity
// -------------------------------------------------------------
// Calculate burn severity index.
// -------------------------------------------------------------
// Subtract NBR values of post-conditions from values of pre-conditions.
var burn_severity ;
// Add as map layer.
Classify burn severity
// -------------------------------------------------------------
// Classify burn severity based on USGS thresholds.
// -------------------------------------------------------------
// Apply additive thresholds to burn severity image.
var burn_severity_classes ;
// Quickly see results
Display layer with color
// -------------------------------------------------------------
// Display result as a map layer
// -------------------------------------------------------------
// Make viz parameters for classified layer.
var bsc_viz = {
min: 0,
max: 6,
palette: [
'#778735',
'#a7c04f',
'#07e444',
'#f6fc0d',
'#f7b140',
'#f86819',
'#a601d4'
]
};
Map.addLayer(
burn_severity_classes,
bsc_viz,
'Burn severity classes',
true,
0.6
)
;
Display class key
// -------------------------------------------------------------
// Add key (legend) for burn severity classes.
// -------------------------------------------------------------
// Create a list of labels for classes.
// The length of this list must equal the length of class values.
var bsc_labels = [
'High post-fire regrowth',
'Low post-fire regrowth',
'Unburned',
'Low Severity',
'Moderate-low Severity',
'Moderate-high Severity',
'High Severity'
]
;
var cart = require('users/jhowarth/eePrimer:modules/cart.js');
var legend = cart
.makeLegend(
'Burn severity index',
bsc_viz.palette,
bsc_labels,
'bottom-left'
);
Map.add(legend);
Create ocean mask
// -------------------------------------------------------------
// Create a mask to hide the ocean.
// -------------------------------------------------------------
var ocean_mask ;
Get building footprints
// ----------------------------------------------------------------------
// Get building footprints
// ----------------------------------------------------------------------
var ee_folder ;
// print(ee_folder);
var buildings ;
// print(buildings.size());
// Add layer to map.
Select burned buildings
// ----------------------------------------------------------------------
// Select buildings in moderately to severely burned areas
// ----------------------------------------------------------------------
var burn_severity_buildings
;
var burned_buildings
;
print(
"Number of burned buildings",
burned_buildings.size()
);
Display building centroids
// ----------------------------------------------------------------------
// Display centroids on map
// ----------------------------------------------------------------------
// Make a centroid function
var makeCentroid ;
// Apply function
var burned_centroids ;
// Display as layer.
Checks for tutorial
After you have completed this tutorial, please copy and paste this code block at the end of your script, then run your script, and complete the tutorial quiz on Canvas.
Please note that these checks simply provide a means to quickly assess if you have successfully reproduced the workflow demonstrated in the tutorial. Developing skills in map interpretation – understanding what the results can tell us even though they represent a model of the world and not an exact replica of it – complements skills in map production. The checks below, however, simply provide a scalable method to evaluate the latter. The former we will explore more through class discussions.
// ----------------------------------------------------------------------
// Tutorial checks.
//
// This code block assumes that you have followed ALL the naming
// variable names used in the tutorial videos.
// ----------------------------------------------------------------------
var check = require('users/jhowarth/eePrimer:modules/checks.js');
print(
"CHECK 01:", aoi.area(1),
"CHECK 02:", check.t07(post_burn.select("B8")),
"CHECK 03:", check.t07(pre_burn.select("B8")),
"CHECK 04:", check.t07(post_burn_ratio),
"CHECK 05:", check.t07(pre_burn_ratio),
"CHECK 06:", check.t07(burn_severity),
"CHECK 07:", check.t07(burn_severity_classes),
"CHECK 08", burn_severity_buildings.first().get("max"),
"CHECK 09", burned_buildings.first().get("max"),
"CHECK 10", burned_centroids.first().geometry()
)
;
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 4.0 International License.