Mapping Tsunami impacts
Step 1: Setup the visualization and specify the cloud threshold the visualization parameters.
//Script name: Aceh tsunami //PURPOSE: disaster mapping //SENSORS: landsat 5 // User specified parameters // setup Visualization var vizrgb = {bands: ['B3', 'B2', 'B1'], max: 0.3}; var vizndbi = {palette: ['red']}; var vizdem = {min: 0.0, max: 20.0, palette: ['FF0000','FFFF00','2EFEF7',"013ADF","FF00FF"]}; // set the cloud threshold var cloud_thresh = 40;
Step 2: Import the administrative boundaries of Sumatra. The shapefile is converted into a linestring and buffered for 10km. This buffer is used to clip only the area of interest close to the coastline.
// Data // shapefile of sumatra var sumatra = ee.FeatureCollection("ft:1U1tGgUkzkvnDpJiV0BFsvL_09ozvEssixG0dlBj4"); // convert polygon into linestring var lineString = ee.Geometry.LineString(sumatra.geometry().coordinates().get(0)); // simplify to reduce calculation time var lineStringSimple = lineString.simplify(10000); // buffer 10 to both sides var coastline = lineString.buffer(10000);
Step 3: Get a landsat 5 image before the Tsunami and one for after the Tsunami.
// get landsat 5 images var beforeImage = ee.Image("LANDSAT/LT5_L1T_TOA/LT51310562004356BKT00"); print("Before image:" ,beforeImage.get("DATE_ACQUIRED")); var afterImage = ee.Image("LANDSAT/LT5_L1T_TOA/LT51310562005006BKT00"); print("After image:" ,afterImage.get("DATE_ACQUIRED"));
Step 4: import the srtm digital elevation model
// import digital elevation model var dem = ee.Image("CGIAR/SRTM90_V4");
Step 5: Mask clouds in both images.
// Functions // cloud function to remove clouds from the image var cloudfunction = function(image){ //use add the cloud likelihood band to the image var CloudScore = ee.Algorithms.Landsat.simpleCloudScore(image); //isolate the cloud likelihood band var quality = CloudScore.select('cloud'); //get pixels above the threshold var cloud01 = quality.gt(cloud_thresh); //create a mask from high likelihood pixels var cloudmask = image.mask().and(cloud01.not()); //mask those pixels from the image return image.updateMask(cloudmask); }; var beforeImage = cloudfunction(beforeImage); var afterImage = cloudfunction(afterImage);
Step 6: Calculate the normalized difference bare index.
// calculate the normalized difference bare index var ndbiAfter = afterImage.normalizedDifference(['B7', 'B4']); var ndbiBefore = beforeImage.normalizedDifference(['B7', 'B4']);
Step 7: mask the areas that are not bare.
// mask the ares that are not bare var ndbiAfterth = ndbiAfter.gt(-0.35); ndbiAfterth = ndbiAfterth.mask(ndbiAfterth);
Step 8: determine the areas that are identified as bare after the tsunami but not before.
// mask the areas that are not bare var ndbiBeforeth = ndbiBefore.gt(-0.35).not(); // select areas that are affected var tsunami = ndbiAfterth.updateMask(ndbiBeforeth);
Step 9: select the are lower than 20 meter mean sea level.
// area below +20 meter msl var waveheight = dem.lt(20); waveheight = dem.updateMask(waveheight);
Step 10: visualize the results
Map.centerObject(beforeImage,10); Map.addLayer(beforeImage.clip(sumatra),vizrgb,"before"); Map.addLayer(afterImage.clip(sumatra),vizrgb," after"); Map.addLayer(tsunami.clip(sumatra).clip(coastline),vizndbi,"Affected areas"); Map.addLayer(waveheight,vizdem,"area below 20m MSL");