Before starting, make sure you understand these terms. They appear throughout all code blocks in this course.
| Term | Full Name | What it means in simple words |
|---|---|---|
| MODIS | Moderate Resolution Imaging Spectroradiometer | A key instrument aboard the Terra and Aqua satellites, providing daily global observations. |
| Surface Reflectance | Surface Reflectance | The fraction of incoming solar radiation reflected from the Earth's surface. |
| Dust Storm | Dust Storm | A meteorological phenomenon where strong winds lift large quantities of dust and sand into the air. |
| Aerosols | Aerosols | Tiny particles suspended in the atmosphere, affecting air quality and climate. |
| NDVI | Normalized Difference Vegetation Index | A simple graphical indicator used to analyze remote sensing measurements, often used to assess the presence of live green vegetation. |
| GEE | Google Earth Engine | A cloud-based platform for planetary-scale geospatial analysis. |
| Band | Spectral Band | A specific range of wavelengths in the electromagnetic spectrum that a sensor is designed to detect. |
| Threshold | Threshold | A value used to separate different classes or features in an image. |
| Pixel | Pixel | The smallest unit of an image, representing a single value or set of values. |
| Classification | Image Classification | The process of assigning pixels in an image to specific categories or classes. |
| False Color Composite | False Color Composite | A color image created by assigning different bands of multispectral data to the red, green, and blue channels. |
| DeepSeek | DeepSeek Coder | An AI model designed to generate code from natural language prompts. |
Dust storms are a recurring environmental hazard in North Africa, impacting air quality and visibility. This course will guide you through using MODIS satellite data and the power of DeepSeek to automatically detect and visualize these events in the Rif Mountains and Middle Atlas region of Morocco. You'll learn how to access, process, and analyze MODIS data within Google Earth Engine, and use DeepSeek to generate code for dust storm detection.
MODIS/061/MOD09GAYou need two browser tabs open side by side throughout this course.
Course18_Dust Storm Detection with MODIS and DeepSeek
The prompt is the core skill of this course. A good prompt includes the exact dataset ID, band names, study area coordinates, dates, preprocessing steps, and desired outputs.
Paste the following code into your GEE code editor and click Run. Read the beginner notes below to understand what each line does.
// Define the region of interest (North Morocco).
var roi = ee.Geometry.Rectangle([-6, 32, -2, 35]);
// Define the date range.
var startDate = '2023-07-01';
var endDate = '2023-07-31';
// Load the MODIS surface reflectance dataset.
var modis = ee.ImageCollection('MODIS/061/MOD09GA')
.filterDate(startDate, endDate)
.filterBounds(roi);
// Function to calculate NDVI.
var calculateNDVI = function(image) {
return image.normalizedDifference(['sur_refl_b02', 'sur_refl_b01']).rename('NDVI');
};
// Apply the NDVI calculation to the MODIS collection.
var modisWithNDVI = modis.map(calculateNDVI);
Add this block after the previous code. It continues the analysis with additional processing and visualization.
// Composite the MODIS collection to a single image (median).
var modisImage = modisWithNDVI.median().clip(roi);
// Define a threshold for NDVI to identify potential dust areas.
var ndviThreshold = 0.1;
// Create a mask for dust storms based on the NDVI threshold.
var dustMask = modisImage.select('NDVI').lt(ndviThreshold);
// Create a false-color composite for visualization.
var falseColor = modisImage.select(['sur_refl_b04', 'sur_refl_b03', 'sur_refl_b01']).multiply(0.0001);
// Display the false-color composite on the map.
Map.addLayer(falseColor, {min: 0, max: 0.3}, 'False Color Composite');
// Display the dust storm mask on the map.
Map.addLayer(dustMask.updateMask(dustMask), {palette: 'red'}, 'Dust Storms');
Add this block at the end of your script to export the final map as a GeoTIFF to your Google Drive. After clicking Run, go to the Tasks tab in GEE and click Run next to each export task.
// Export the dust storm mask to Google Drive.
Export.image.toDrive({
image: dustMask,
description: 'Dust_Storm_Mask',
folder: 'GEE_Exports',
region: roi,
scale: 1000,
maxPixels: 1e13
});
Use DeepSeek to extend the script for each exercise below. Write a follow-up prompt describing what you want to add, then copy the generated code and paste it into your GEE script.
To get the best results from DeepSeek for GEE tasks, always include these elements in your prompts:
| Element | Example |
|---|---|
| Exact dataset ID | MODIS/061/MOD09GA |
| Band names | "select band 'B4' for red, 'B8' for NIR" |
| Study area | "rectangle [-6.5, 33.0, -1.5, 36.0] North Morocco" |
| Date range | "filter from 2020-01-01 to 2023-12-31" |
| Output format | "print area in hectares, add a legend, export to Drive" |
| Error fixing | "The code gives error X. Please fix it." |
| Iteration | "Add a time series chart for each year 2018-2023" |