Homework

Replicate the process to run a mangrove classification using the Landsat-8 collection.

  1. Create a cloudless composite with Landsat-8 imagery. Define the time range to filter the collection. Do not forget to explore the properties, documentation, and band names of this specific collection. For masking clouds of Landsat-8 images use the following function:
function maskL8sr(image) {
  // Bit 0 - Fill
  // Bit 1 - Dilated Cloud
  // Bit 2 - Cirrus
  // Bit 3 - Cloud
  // Bit 4 - Cloud Shadow
  var qaMask = image.select('QA_PIXEL').bitwiseAnd(parseInt('11111', 2)).eq(0);
  var saturationMask = image.select('QA_RADSAT').eq(0);

  // Replace the original bands with the scaled ones and apply the masks.
  return image.updateMask(qaMask)
              .updateMask(saturationMask);
}
  1. Generate NDVI and NDWI data. Export your Composite, NDVI and NDWI images.
  2. Skip the script for mangrove data collection. Use the same dataset we generated before.
  3. Go to the classification script. Import your saved images (composite, NDVI, NDWI), select adequate bands to sample, and change the scale to 30, which is the native resolution of Landsat data. The rest of the script should run without no more changes.
  4. Run the script, see the output. How does the map looks? What about the accuracy?

Solution

The solution can be found in these two scripts. The original first and third scripts were adjusted to work with Landsat-8 imagery. The second script about collecting ground-truth data was not necessary to be modified or run again, since we can use the exported dataset we did in class.

See Part 1 and Part 2.


Copyright © 2023 SERVIR-Amazonia / Spatial Informatics Group. Distributed by an EPL 2.0 license.