Google Earth Engine Tutorial: Identify Drought Severity with SPEI Data
Credit: Youtube Channel “Terra Spatial, Tutorial on identifying drought severity using Standardized Precipitation Evapotranspiration Index data from 1980-2023.”
You can see all the tutorials from here: Techgeo Academy.
Google Earth Engine Tutorial: Identify Drought Severity with SPEI Data
This tutorial demonstrates how to use the Standardized Precipitation Evapotranspiration Index (SPEI) in Google Earth Engine (GEE) to assess drought severity across a region. SPEI is a drought index that accounts for both precipitation and evapotranspiration, making it more effective than other indices like SPI for capturing the impact of temperature changes on drought.
Step 1: Accessing the SPEI Dataset
To begin, access the SPEI dataset in GEE. SPEI data is available from the NOAA/UCSB/SPAEI
collection, which provides monthly values at a 0.5° spatial resolution. Here’s how you can load it:
// Load SPEI dataset
var spei = ee.ImageCollection("NOAA/UCSB/SPAEI/12");
// Filter for a specific region (e.g., California)
var region = ee.FeatureCollection("FAO/GAUL/2015/level1");
var california = region.filter(ee.Filter.eq("ADM1_NAME", "California"));
// Filter SPEI data for the desired time range
var speiFiltered = spei.filterDate('2010-01-01', '2020-12-31');
Step 2: Calculating SPEI Values
Once the dataset is loaded, calculate SPEI values for your region of interest. Use the clip
function to limit the data to your area and select the relevant band:
// Select SPEI band (e.g., 'spei')
var speiBand = speiFiltered.select('spei');
// Clip SPEI data to the region
var speiClipped = speiBand.map(function(image) {
return image.clip(california);
});
Step 3: Visualizing SPEI Data
Visualize the SPEI data on a map to identify patterns. Use a color palette to highlight areas of drought severity:
// Set visualization parameters
var visParams = {
min: -3,
max: 3,
palette: ['#f7fbff', '#08306b']
};
// Create a map and add the SPEI data
var map = ui.Map();
map.setCenter(-119.5, 36.5, 6);
map.addLayer(speiClipped, visParams, 'SPEI');
Step 4: Analyzing Drought Severity
Identify drought severity using SPEI thresholds. For example:
- Standardized SPEI Thresholds:
> 0
: Normal-1 to 0
: Mild drought-1.5 to -1
: Moderate drought-2 to -1.5
: Severe drought< -2
: Extreme drought
Use the following code to create a drought mask:
// Define drought thresholds
var droughtMask = speiClipped.map(function(image) {
return image.updateMask(image.lt(-1.5)); // Severe drought threshold
});
// Display the mask
map.addLayer(droughtMask, {palette: 'red'}, 'Drought Areas');
Step 5: Exporting and Further Analysis
Export the processed SPEI data to a CSV file for statistical analysis or use reduceRegion
to compute aggregated drought indices for specific areas:
// Export drought severity data to CSV
Export.image.toDrive({
image: droughtMask.select('spei'),
description: 'SPEIDroughtExport',
fileNamePrefix: 'spei_drought',
folder: 'SPEI_Drought',
region: california.geometry(),
scale: 50000,
fileFormat: 'csv'
});
FAQ
How do I access the SPEI dataset in GEE?
Use the ImageCollection
method and specify the dataset ID "NOAA/UCSB/SPAEI/12"
for the 12-month time scale.
What is the appropriate SPEI time scale for drought analysis?
The time scale depends on your study’s context. The 12-month scale (SPEI12) is commonly used for agricultural and hydrological droughts, as it captures long-term water shortages.
Can SPEI thresholds vary by region?
Yes. While standard thresholds provide a baseline, local climate conditions may require adjustments. Always validate thresholds against regional climate data.
Why is SPEI better than SPI for drought analysis?
SPEI incorporates both precipitation and evapotranspiration, making it more responsive to temperature-driven droughts (e.g., due to climate change). SPI focuses only on precipitation, limiting its applicability in certain scenarios.