Practical Course 29

Global Air Pollution and Respiratory Health Risk Mapping via GeoAI

Quantify urban NO2 exposure and predict respiratory health risk using Sentinel-5P, ERA5, GHSL, and Machine Learning
Global Urban and Industrial Regions ~2 hours Advanced
Dataset: COPERNICUS/S5P/OFFL/L3_NO2 Sentinel-5P OFFL NO2: Offline Nitrogen Dioxide Tropo Column Density

📖 Key Terms for Beginners

Before starting, make sure you understand these terms. They appear throughout all code blocks in this course.

TermFull NameWhat it means in simple words
S5PSentinel-5 PrecursorEarth observation satellite launched by ESA dedicated to monitoring atmospheric chemistry and air quality.
NO2Nitrogen DioxideA respiratory irritant trace gas primarily emitted by fossil fuel combustion and industrial processes.
AODAerosol Optical DepthA measure of atmospheric light extinction caused by airborne particulate matter and aerosol particles.
GeoAIGeospatial Artificial IntelligenceIntegration of spatial data science with machine learning algorithms to model geographic phenomena.
Exposure AssessmentEnvironmental Exposure AssessmentQuantitative estimation of population contact intensity with environmental hazards across space and time.
Vulnerability IndexSocio-Environmental Vulnerability IndexA composite score reflecting population susceptibility and lack of adaptive capacity to environmental stressors.
GHSLGlobal Human Settlement LayerSpatial raster datasets mapping human presence, built-up surfaces, and population density globally.
Random ForestRandom Forest Ensemble Classifier/RegressorAn ensemble machine learning method that constructs multiple decision trees to predict complex nonlinear targets.
Tropospheric Column DensityTropospheric Column DensityTotal vertically integrated molecular count of a trace gas per unit horizontal surface area in the troposphere.
Spatial AutocorrelationSpatial AutocorrelationThe formal measurement of spatial dependency where geographic proximity implies similarity in feature values.
Ecological FallacyEcological FallacyA logical error in interpretation occurring when individual health outcomes are inappropriately deduced from aggregate spatial data.
Risk ProxyEnvironmental Health Risk ProxyAn indirect, spatially continuous indicator used to estimate potential health threats when direct epidemiological surveillance is absent.
Confounding VariableConfounding FactorAn unmeasured or unmodeled variable that influences both environmental exposure and health outcomes simultaneously.

Contents

  1. 1. Introduction to Ambient Air Pollution and Health
  2. 2. Satellite Remote Sensing of Atmospheric Trace Gases
  3. 3. Dataset Selection and Multi-Source Harmonization
  4. 4. Defining Urban and Industrial Regions of Interest
  5. 5. Preprocessing Sentinel-5P NO2 Tropospheric Columns
  6. 6. Integrating ERA5-Land Meteorology and GHSL Population
  7. 7. Quantifying Spatial Exposure and Population Weighted Indices
  8. 8. Machine Learning Modelling of Integrated Respiratory Health Risk
  9. 9. Model Validation, Uncertainty, and Ethics
  10. 10. Exporting GeoAI Deliverables for Public Health Policy
1
Introduction
10 min

Ambient nitrogen dioxide (NO2) and aerosol pollution from urban transport and heavy industrial activity present critical global public health risks, strongly linked to acute and chronic respiratory disorders. Satellite remote sensing from TROPOMI aboard Sentinel-5P provides unprecedented daily global observations of atmospheric chemistry, yet translating raw column densities into actionable health risk metrics requires integrating meteorology, population density, and machine learning. This course demonstrates how to harmonize multi-sensor satellite imagery and population grids within Google Earth Engine to map respiratory health risk indicators across major global urban regions.

GEE Asset ID
COPERNICUS/S5P/OFFL/L3_NO2
Dataset Name
Sentinel-5P OFFL NO2: Offline Nitrogen Dioxide Tropo Column Density
Study Area
Global Urban and Industrial Regions
AI Tool
DeepSeek (free, no API key needed)
🌍
What you will build: By the end of this course you will have a working GEE script that analyzes Global Air Pollution and Respiratory Health Risk Mapping via GeoAI, computes statistics, visualizes results on an interactive map, and exports data to Google Drive.

2
Setup: GEE + DeepSeek
5 min

You need two browser tabs open side by side throughout this course.

1
Open chat.deepseek.com -- free account, no API key needed
2
Open code.earthengine.google.com in a second tab
3
Create a new GEE script named Course29_Global Air Pollution and Respiratory Health Risk Mapping via GeoAI
💡
Workflow: Write a prompt in DeepSeek describing your task with exact dataset IDs and requirements. Copy the generated GEE JavaScript. Paste into GEE code editor. Click Run. Inspect results. Iterate.

3
Crafting the DeepSeek Prompt
15 min

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.

📋 Main Prompt -- copy and paste this into DeepSeek
Act as an expert GeoAI developer and environmental health scientist. Write a complete, executable Google Earth Engine JavaScript script that quantifies atmospheric NO2 pollution exposure and predicts a respiratory risk proxy across major global urban hubs (e.g., the Pearl River Delta, Indo-Gangetic Plain, or Western Europe). Use 'COPERNICUS/S5P/OFFL/L3_NO2' band 'tropospheric_NO2_column_number_density' filtered for summer 2023. Combine this with 'JRC/GHSL/P2023A/GHS_POP/2020' band 'population_count', 'MODIS/061/MCD19A2_GRANULES' band 'Optical_Depth_047', and 'ECMWF/ERA5_LAND/MONTHLY_AGGR' bands 'temperature_2m' and 'u_component_of_wind_10m'. Compute population-weighted exposure, construct a training sample across urban grids, fit an ee.Classifier.smileRandomForest model to predict an integrated respiratory health risk index, and display the result using a custom health risk palette (blue to red). Provide inline comments explaining spatial resolution differences and potential ecological fallacy limitations.
✨
After pasting the prompt: Wait 20-30 seconds for DeepSeek to generate the full GEE script. Copy the entire code block it produces. If the output is cut short, type "Continue the code" to get the rest.

4
Data filtering, preprocessing, and spatial harmonization
10 min

Paste the following code into your GEE code editor and click Run. Read the beginner notes below to understand what each line does.

Data filtering, preprocessing, and spatial harmonization
// 1. Define Urban Study Area (Example: Northern Italy Industrial Hub / Po Valley)
var roi = ee.Geometry.Polygon([
  [[7.5, 44.5], [12.5, 44.5], [12.5, 46.5], [7.5, 46.5]]
]);

// 2. Load and Filter Sentinel-5P Tropospheric NO2
var startPeriod = '2023-05-01';
var endPeriod = '2023-09-30';

var s5p_no2 = ee.ImageCollection('COPERNICUS/S5P/OFFL/L3_NO2')
  .filterBounds(roi)
  .filterDate(startPeriod, endPeriod)
  .select('tropospheric_NO2_column_number_density')
  .mean()
  .clip(roi);

// 3. Load Population Density from GHSL 2020
var pop = ee.Image('JRC/GHSL/P2023A/GHS_POP/2020')
  .select('population_count')
  .clip(roi);

// 4. Load Meteorological Covariates (ERA5-Land Monthly)
var era5 = ee.ImageCollection('ECMWF/ERA5_LAND/MONTHLY_AGGR')
  .filterBounds(roi)
  .filterDate(startPeriod, endPeriod)
  .select(['temperature_2m', 'u_component_of_wind_10m', 'v_component_of_wind_10m'])
  .mean()
  .clip(roi);

// 5. Load MODIS AOD (Aerosol Optical Depth at 0.47um)
var aod = ee.ImageCollection('MODIS/061/MCD19A2_GRANULES')
  .filterBounds(roi)
  .filterDate(startPeriod, endPeriod)
  .select('Optical_Depth_047')
  .mean()
  .multiply(0.001)
  .rename('AOD_470')
  .clip(roi);

// 6. Calculate Population-Weighted Exposure Raster
// Exposure = NO2 Concentration * Log(Population Count + 1)
var popExposure = s5p_no2.multiply(pop.add(1).log()).rename('Pop_Weighted_Exposure');

// 7. Visualization Setup
Map.centerObject(roi, 7);
Map.addLayer(pop, {min: 0, max: 1000, palette: ['white', 'yellow', 'red']}, 'GHSL Population Count');
Map.addLayer(s5p_no2, {min: 0.00002, max: 0.00015, palette: ['black', 'blue', 'purple', 'orange', 'red']}, 'Sentinel-5P NO2 Mol/m2');
Map.addLayer(popExposure, {min: 0, max: 0.001, palette: ['green', 'yellow', 'orange', 'red', 'purple']}, 'Population Weighted Exposure');
🔑
Beginner note: This code block filters Sentinel-5P atmospheric NO2, GHSL human population grids, ERA5-Land monthly meteorology, and MODIS Aerosol Optical Depth (AOD) over a high-density industrial region. It harmonizes these multi-source data streams temporally and spatially across the summer period and computes a population-weighted exposure index combining gas concentration with population scale.

5
GeoAI Machine Learning modeling for respiratory health risk prediction
10 min

Add this block after the previous code. It continues the analysis with additional processing and visualization.

GeoAI Machine Learning modeling for respiratory health risk prediction
// 1. Stack All Predictors into a Multi-Band Composite Image
var composite = ee.Image.cat([
  s5p_no2.rename('NO2'),
  aod,
  pop.rename('Population'),
  era5.select('temperature_2m').rename('Temp'),
  era5.select('u_component_of_wind_10m').rename('U_Wind'),
  era5.select('v_component_of_wind_10m').rename('V_Wind')
]);

// 2. Define Proxy Target Variable: Integrated Respiratory Risk Score (0-100 Normalized)
// Target combines normalized NO2 exposure, aerosol load, and population vulnerability
var normalizedNO2 = s5p_no2.unitScale(0.00001, 0.00020).clamp(0, 1);
var normalizedAOD = aod.unitScale(0.05, 0.8).clamp(0, 1);
var normalizedPop = pop.log().unitScale(0, 8).clamp(0, 1);

var targetRisk = normalizedNO2.multiply(0.5)
  .add(normalizedAOD.multiply(0.3))
  .add(normalizedPop.multiply(0.2))
  .multiply(100)
  .rename('Respiratory_Risk_Index');

// 3. Sample Training Points across the Region of Interest
var trainingData = composite.addBands(targetRisk).sample({
  region: roi,
  scale: 1000,
  numPixels: 2000,
  seed: 42,
  geometries: true
});

// 4. Train a Random Forest Regression Model
var rfRegressor = ee.Classifier.smileRandomForest(100)
  .setOutputMode('REGRESSION')
  .train({
    features: trainingData,
    classProperty: 'Respiratory_Risk_Index',
    inputProperties: ['NO2', 'AOD_470', 'Population', 'Temp', 'U_Wind', 'V_Wind']
  });

// 5. Predict Respiratory Health Risk across the Entire Spatial Domain
var predictedRiskMap = composite.classify(rfRegressor, 'Predicted_Respiratory_Risk');

// 6. Visualization of Machine Learning Risk Prediction
var riskPalette = ['#1a9641', '#a6d96a', '#ffffbf', '#fdae61', '#d7191c'];
Map.addLayer(predictedRiskMap, {min: 10, max: 80, palette: riskPalette}, 'Predicted Respiratory Risk Index');

// 7. Model Feature Importance Verification
var explanation = rfRegressor.explain();
print('Random Forest Model Details:', explanation);
🔑
Beginner note: This script stacks atmospheric, meteorological, and demographic predictors to construct a GeoAI machine learning workflow. A Random Forest regression model is trained on spatial samples to predict an integrated continuous Respiratory Health Risk Index, demonstrating how satellite measurements can be synthesized into actionable environmental health spatial intelligence.

6
Export Results to Google Drive
5 min

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 to Google Drive
// Export Predicted Respiratory Risk Map as a GeoTIFF to Google Drive
Export.image.toDrive({
  image: predictedRiskMap,
  description: 'Global_Urban_Respiratory_Health_Risk_2023',
  folder: 'GEE_Health_GeoAI',
  scale: 1000,
  region: roi,
  maxPixels: 1e9,
  fileFormat: 'GeoTIFF'
});

// Export Sampled Health Exposure Table as CSV
Export.table.toDrive({
  collection: trainingData,
  description: 'Respiratory_Risk_Sample_Points_2023',
  folder: 'GEE_Health_GeoAI',
  fileFormat: 'CSV'
});
🔑
Beginner note -- Export.image.toDrive(): This function does not export immediately. It creates a task in the GEE Tasks tab that you must manually start by clicking Run. The file will appear in your Google Drive folder (GEE_Courses) as a GeoTIFF that you can open in QGIS or ArcGIS.

7
Exercises Using DeepSeek Prompts
Homework

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.

Temporal Trend Analysis of NO2 Exposure

  1. Modify the date filter to compare winter (December to February) versus summer (June to August) NO2 column densities.
  2. Compute the mean exposure difference raster between winter and summer over the study region.
  3. Identify urban zones where seasonal atmospheric stagnant conditions exacerbate air quality hazards.

Aerosol and Trace Gas Correlation Mapping

  1. Extract pixel values for both Sentinel-5P NO2 and MODIS AOD across 500 random sample points.
  2. Export the feature collection as a CSV file to evaluate linear correlation statistics.
  3. Interpret spatial locations where high AOD occurs independently of local urban industrial NO2 emissions.

Sensitivity Assessment of Random Forest Feature Inputs

  1. Re-train the Random Forest model excluding meteorological predictors (ERA5 temperature and wind).
  2. Calculate the mean absolute error between the full model prediction and the reduced covariate model.
  3. Evaluate the role of wind dispersion parameters in controlling spatial health risk misclassification.

Cross-City Comparative Risk Analysis

  1. Shift the region of interest bounding box to a major megacity in East or South Asia (e.g., Delhi or Beijing).
  2. Re-run the spatial aggregation and population weighting routines without changing parameter thresholds.
  3. Compare the proportion of total population exposed to extreme risk categories across differing global urban structures.

8
Prompt Engineering Tips
Reference

To get the best results from DeepSeek for GEE tasks, always include these elements in your prompts:

ElementExample
Exact dataset IDCOPERNICUS/S5P/OFFL/L3_NO2
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"
🧠
Best practice: Start with the main prompt, run the code, then send follow-up prompts to add features one at a time. This gives you cleaner, more reliable code than asking for everything at once.
Course 29 - Global Air Pollution and Respiratory Health Risk Mapping via GeoAI | GeoAI for Climate Change | Dr. Ayoub Lahlouh | UM6P/CUS | 2025/2026