Homework
Replicate the process to run a mangrove classification using the Landsat-8 collection.
- 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);
}
- Generate NDVI and NDWI data. Export your Composite, NDVI and NDWI images.
- Skip the script for mangrove data collection. Use the same dataset we generated before.
- 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.
- 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.