GEE Tutorials

Google Earth Engine Tutorial: Downscale MODIS NDVI with ML

Credit: Youtube Channel “Terra Spatial, Learn how to downscale MODIS NDVI data from 500m to 30m resolution using machine learning approaches.”

You can see all the tutorials from here: Techgeo Academy.

Google Earth Engine (GEE) offers powerful tools for remote sensing analysis, including the ability to downscale datasets like MODIS NDVI. MODIS (Moderate Resolution Imaging Spectroradiometer) provides global vegetation indices at 250m-500m resolution, but for local-scale studies, higher-resolution data is often needed. Machine learning (ML) can bridge this gap by leveraging high-resolution data (e.g., Landsat, Sentinel) as a reference to enhance lower-resolution MODIS products. Below is a step-by-step guide to downscale MODIS NDVI using ML in Google Earth Engine.

Step 1: Load and Preprocess MODIS NDVI

In GEE, MODIS NDVI datasets are available in the Earth Engine Data Catalog. Use the following code to load the MODIS Surface Reflectance product and compute NDVI:

var modis = ee.ImageCollection("MODIS/061/MOD09GA")
  .filterDate('2020-01-01', '2020-12-31')
  .select(['NDVI'])
  .map(function(img) {
    return img.multiply(0.0001); // Scale factor for MODIS NDVI
  });

Step 2: Prepare High-Resolution Data for Training

Acquire high-resolution data (e.g., Landsat 8 or Sentinel-2) with a matching time period. For example, use Landsat 8 surface reflectance (COPERNICUS/S2_SR_20MS) and extract the NDVI band:

var landsat = ee.ImageCollection("COPERNICUS/S2_SR")
  .filterDate('2020-01-01', '2020-12-31')
  .select(['NDVI'])
  .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 30));

Step 3: Create Training Samples with Machine Learning

Use a supervised ML model to learn the relationship between MODIS and high-resolution NDVI. Extract sample points from the Landsat data to train the model:

var training = landsat
  .select(['NDVI'])
  .merge(modis.select(['NDVI']))
  .sample({region: roi, numPixels: 1000, seed: 0});

Train a Random Forest classifier:

var classifier = ee.Classifier.randomForest().train(training, 'NDVI');

Step 4: Apply the Model to Downscale MODIS NDVI

Apply the trained model to the MODIS dataset to generate high-resolution predictions:

var downscaledNDVI = modis.select(['NDVI'])
  .map(function(img) {
    return img.classify(classifier).rename('NDVI_downscaled');
  });

Step 5: Visualize and Export Downscaled Data

Visualize the downscaled results on the map or export them to Google Drive:

Map.addLayer(downscaledNDVI.select('NDVI_downscaled'), {min: 0, max: 1, palette: ['green', 'yellow', 'red']}, 'Downscaled NDVI');

To export, use:

Export.image.toDrive({
  image: downscaledNDVI.select('NDVI_downscaled').first(),
  description: 'downscaled_ndvi',
  folder: 'GEE_Exports',
  region: roi,
  scale: 10,
  crs: 'EPSG:4326'
});

FAQ

  • What is the benefit of downscaled MODIS NDVI?

    Downscaling increases the spatial resolution of MODIS data, making it suitable for local-scale analysis while retaining the temporal continuity of MODIS.

  • Can I use other ML models instead of Random Forest?

    Yes, GEE supports models like Support Vector Machines (SVM), Logistic Regression, and Gradient-Boosted Trees (e.g., GBT). Choose based on your dataset and performance needs.

  • How do I handle large datasets?

    Use region restrictions, temporal filtering, and optimize sample sizes. GEE’s parallel processing capabilities can manage large-scale computations.

  • Is the training area important for accuracy?

    Yes. Ensure the training area encompasses diverse vegetation conditions. Avoid overfitting by using spatially distributed samples.

  • What if there is no high-resolution data available?

    If gap-filling is required, consider using synthetic datasets or simulating resolutions with GEE’s resampling tools, though these may not match the accuracy of real high-res data.

  • How to validate the downscaled results?

    Compare with independent high-resolution data using metrics like RMSE, R², or visual inspection. Cross-validation during the training phase can also help assess model reliability.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *