Notebook 2: Google Earth Engine

Cloud-based Earth Observation Data Processing

Date

November 17, 2025

Session 4 Hands-On Notebooks

This session includes TWO complementary notebooks designed for progressive learning:

๐Ÿ“˜ Notebook 1: GEE Fundamentals (Start Here)

Complete introduction to Google Earth Engine with standard cloud masking (QA60)

๐Ÿ“— Notebook 2: Advanced Cloud Masking (P0 Best Practices)

Advanced techniques using SCL and s2cloudless for production-quality results

Combined Learning Objectives

By completing both notebooks, you will:

  • Authenticate and initialize Google Earth Engine
  • Access Sentinel-1 SAR and Sentinel-2 optical data
  • Filter ImageCollections by location, date, and metadata
  • Apply basic (QA60) AND advanced (SCL, s2cloudless) cloud masking
  • Understand when to use each masking approach
  • Create temporal composites with best practices
  • Calculate vegetation indices (NDVI)
  • Export processed data for ML workflows
  • Apply concepts to Philippine use cases

๐Ÿ“˜ Notebook 1: GEE Fundamentals (Start Here)

What Youโ€™ll Learn

  • Complete GEE setup and authentication
  • Core concepts: Image, ImageCollection, Geometry
  • Filtering by location, date, and metadata
  • Standard QA60 cloud masking (simple, fast)
  • Median composite creation
  • NDVI calculation and visualization
  • Basic export workflows
  • Philippine case studies

Open in Google Colab

Open In Colab

NoteFirst Time Using This Notebook?

If you get a โ€œNot Foundโ€ error: 1. The notebook files need to be pushed to GitHub first 2. Alternative: Download the notebook below and upload to your own Google Drive 3. Then open from Drive in Colab

ImportantEarth Engine Account Required

You must have a registered Google Earth Engine account to run this notebook. If you havenโ€™t registered yet, see the Setup Guide.

Registration takes 24-48 hours for approval.

Why Start with Notebook 1: - Covers all GEE fundamentals systematically - Standard QA60 masking is easier to understand first - Complete workflow from setup to export - ~60 cells, ~2 hours

Download Option:

Download Notebook 1 .ipynb


๐Ÿ“— Notebook 2: Advanced Cloud Masking (P0 Best Practices)

What Youโ€™ll Learn

๐Ÿ†• P0 IMPROVEMENT: This notebook implements the expert-recommended cloud masking improvements:

  • Scene Classification Layer (SCL) masking
    • Detects clouds AND shadows (QA60 misses shadows!)
    • 12-class comprehensive classification
    • Better for NDVI time series and land cover
  • s2cloudless integration
    • Most accurate ML-based cloud detection
    • Adjustable probability thresholds
    • Production-grade quality
  • Comparative analysis
    • Visual comparison: QA60 vs SCL vs s2cloudless
    • When to use each method
    • Performance trade-offs
  • Export templates
    • Optimized for ML training data
    • Batch export workflows
    • Sample point extraction

When to Use This Notebook

โœ… After completing Notebook 1 โœ… For operational/production work โœ… When QA60 results have โ€œghostโ€ clouds or shadows โœ… For ML training data preparation โœ… For NDVI time series analysis

Open in Google Colab

NoteNotebook 2 Coming Soon

The advanced SCL cloud masking notebook is currently under development. For now, use Notebook 1 which covers all essential GEE concepts including QA60 cloud masking.

Why Notebook 2 (When Available): - Implements P0 improvement from expert review - Cleaner composites for ML training - Production-ready workflows - Focused and concise (~10-15 cells, ~30 minutes)


Quick Comparison

Aspect Notebook 1 Notebook 2
Focus Comprehensive GEE introduction Advanced cloud masking
Cloud Masking QA60 (standard) SCL + s2cloudless (advanced)
Length ~66 cells, 2 hours ~10-15 cells, 30 min
Complexity Beginner-friendly Intermediate
Use For Learning GEE fundamentals Production workflows
P0 Alignment Standard approach โœ… Implements P0 improvement

Whatโ€™s Covered Across Both Notebooks

Notebook 1 Topics

  1. Earth Engine Fundamentals
    • Authentication and initialization
    • ee.Image and ee.ImageCollection
    • Geometry definitions
    • Data catalog navigation
  2. Sentinel-1 & Sentinel-2 Access
    • COPERNICUS/S2_SR_HARMONIZED collection
    • COPERNICUS/S1_GRD collection
    • Band names and metadata
  3. Filtering & Processing
    • Spatial, temporal, metadata filters
    • QA60 cloud masking
    • Median composites
    • NDVI calculation
  4. Philippine Case Studies
    • Metro Manila monitoring
    • Palawan land cover
    • Flood detection
    • Agricultural monitoring
  5. Export Workflows
    • Google Drive export
    • Scale and region parameters
    • Task management

Notebook 2 Additional Topics

  1. Advanced Cloud Masking (P0)
    • SCL 12-class classification
    • Shadow detection
    • s2cloudless ML-based detection
    • Method comparison
  2. Production Optimization
    • Export templates for ML
    • Sample point extraction
    • Batch processing workflows
    • Best practices

Prerequisites

Before starting this notebook, ensure you have:

  • โœ… Google Earth Engine account (registered and approved)
  • โœ… Completed Setup Guide
  • โœ… Understanding of Session 4 concepts
  • โœ… Basic Python knowledge
  • โœ… Familiarity with Jupyter/Colab

Notebook Contents

The full interactive notebook includes:

  • 20+ code cells with step-by-step instructions
  • 15+ visualizations including interactive maps
  • 4 Philippine case studies with real-world applications
  • Export workflows for downloading processed data
  • Troubleshooting section for common errors
  • Exercises to reinforce learning

Key Concepts Covered

Earth Engine Architecture

# Basic Earth Engine workflow
import ee
ee.Initialize()

# Define area of interest
philippines = ee.Geometry.Rectangle([116.0, 4.0, 127.0, 21.0])

# Access Sentinel-2 collection
collection = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED') \
    .filterBounds(philippines) \
    .filterDate('2024-01-01', '2024-12-31') \
    .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 20))

# Create composite
composite = collection.median()

# Calculate NDVI
ndvi = composite.normalizedDifference(['B8', 'B4'])

Interactive Mapping with geemap

import geemap

# Create interactive map
Map = geemap.Map()
Map.centerObject(philippines, 6)

# Add layers
Map.addLayer(composite, {'bands': ['B4', 'B3', 'B2'], 'min': 0, 'max': 3000}, 'True Color')
Map.addLayer(ndvi, {'min': 0, 'max': 1, 'palette': ['red', 'yellow', 'green']}, 'NDVI')

Map

Philippine Use Cases

Case Study 1: Metro Manila Urban Monitoring

Track urban expansion and changes in the National Capital Region using multi-temporal Sentinel-2 data.

Case Study 2: Palawan Forest Cover

Monitor forest cover and detect deforestation in Palawan Province using NDVI time series.

Case Study 3: Central Luzon Flood Mapping

Detect flood extents using Sentinel-1 SAR backscatter changes before and after typhoon events.

Case Study 4: Mindanao Agricultural Drought

Assess agricultural drought impacts using vegetation indices and SWIR bands.


Common Errors & Solutions

Error: โ€œPlease set project IDโ€

Cause: Earth Engine not authenticated

Solution:

ee.Authenticate()  # Follow prompts
ee.Initialize()

Error: โ€œUser memory limit exceededโ€

Solution: Reduce spatial or temporal scope, increase scale parameter

Error: โ€œToo many concurrent aggregationsโ€

Solution: Add .limit() to reduce collection size

See the FAQ for more troubleshooting help.


Support

During the Training

  • Ask questions in live session
  • Consult teaching assistants
  • Share your results with the group

After the Training


Next Steps

After completing this notebook:

  1. โœ… Practice with different Philippine regions
  2. โœ… Experiment with other satellites (Landsat, MODIS)
  3. โœ… Prepare for Day 2: Machine Learning for Land Cover Classification
  4. โœ… Export data for your own projects

TipReady to Explore Petabytes of Data?

Open the notebook in Colab and start accessing the entire Sentinel archive from your browser!

All processing happens in the cloud - no downloads required!