1. POINT OF INTEREST

Define a point of interest at coordinate -122.20432, 49.02834 using ee.Geometry.Point()
Zoom to the point using Map.centerObject()
Add the point to the map using Map.addLayer()

/* 1. DEFINE POINT OF INTEREST */
  var flood_point = ee.Geometry.Point([-122.20432, 49.02834]);
  // Map.centerObject(flood_point, 8); // OPTIONAL
  Map.addLayer(flood_point, {}, "Flood point", 1);

2. DEFINE SENTINEL 1 GRD COLLECTION

Load the COPERNICUS/S1_GRD image collection, and print the first image.

/* 2. DEFINE SENTINEL 1 GRD COLLECTION */
  var S1 = ee.ImageCollection('COPERNICUS/S1_GRD');
  print(S1.first());

3. FILTER COLLECTION

Filter the image collection by transmitterReceiverPolarisation, instrumentMode, and orbitProperties_pass. Then select only the VV band.

/* 3. FILTER COLLECTION */
  var S1_filter = S1
    .filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VV'))
    .filter(ee.Filter.eq('instrumentMode', 'IW'))
    .filter(ee.Filter.eq('orbitProperties_pass', 'DESCENDING'))
    .select('VV');
  print(S1_filter.first());

4. ADD FILTERED COLLECTION TO MAP

/* 4. ADD FILTERED COLLECTION TO MAP */
  Map.addLayer(S1_filter,  {min: -25, max: 5}, "S1 Filter", 1);

5. ADD CHART

Add a time series chart of the pixel values at the point of interest.

/* 5. ADD CHART */
  var myChart = ui.Chart.image.series(S1_filter, flood_point)
	.setChartType('ScatterChart')
    .setOptions({
     title: 'Sentinel-1 Amplitude over Time',
     lineWidth: 1,
     pointSize: 3});
  print(myChart);

6. PRE-FLOOD IMAGE

/* 6. PRE-FLOOD IMAGE */
  var pre_flood_date_start = "2021-11-04";
  var pre_flood_date_end = "2021-11-05";
  var pre_flood = S1_filter.filterDate(pre_flood_date_start,pre_flood_date_end).mosaic();
  Map.addLayer(pre_flood,  {min: -25, max: 5}, "pre", 1);

7. POST-FLOOD IMAGE

/* 7. POST-FLOOD IMAGE */
  var post_flood_date_start = "2021-11-16";
  var post_flood_date_end = "2021-11-17";
  var post_flood = S1_filter.filterDate(post_flood_date_start,post_flood_date_end).mosaic();
  Map.addLayer(post_flood,  {min: -25, max: 5}, "post", 1); 

8. PRE-POST DIFFERENCE

/* 8. PRE-POST DIFFERENCE */
  var diff = post_flood.subtract(pre_flood);
  var my_pal = ["pink","red","white","blue","black"];
  Map.addLayer(diff,  {min: -25, max: 25, palette: my_pal}, "diff", 1);

9. THRESHOLD THE DIFFERENCE RASTER

/* 9. THRESHOLD THE DIFFERENCE RASTER */
  var diff_th = diff.lt(-5);
  Map.addLayer(diff_th.selfMask(),  {min: 0, max: 1, palette: ["blue"]}, "diff_th", 1);

10. CLEAN THE THRESHOLD RASTER USING FOCALMIN

/* 10. CLEAN THE THRESHOLD RASTER USING FOCALMIN */
  var diff_th_clean = diff_th
    .focalMin({radius: 2, kernelType: "circle", units: "pixels"});
  Map.addLayer(diff_th_clean.selfMask(),  {min: 0, max: 1, palette: ["blue"]}, "diff_th_clean", 1);

11. MAKE A POLYGON TO EXPORT A MAP

/* 11. MAKE A POLYGON TO EXPORT A MAP */
  var export_geometry = flood_point.buffer(20000).bounds();
  Map.addLayer(export_geometry, {}, "Export geometry");

12. EXPORT IMAGES

/* 12. EXPORT IMAGES */
  Export.image.toDrive({
    image: post_flood.visualize({min: -25, max: 5}), 
    description: "post_flood", 
    folder: "Lab2", 
    region: export_geometry, 
    scale: 20});
  Export.image.toDrive({
    image: diff_th_clean, 
    description: "diff_th_clean", 
    folder: "Lab2", 
    region: export_geometry, 
    scale: 20});

Questions

Send your answers to bevington@unbc.ca by email before the end of the lab.

Question 1: What is the total size of the COPERNICUS/S1_GRD collection when you filter over the flood_point feature? By filtering the metadata, how many of those are from Sentinel-1A and how many are from Sentinel-1B? What is this number not the same?

Question 2: Name two reasons why SAR is commonly used for flood mapping.

Question 3: Using your GIS of choice, make a similar figure to this. Make sure you include a legend, title, north arrow, coordinates, scale bar, date, and author.

Categories: GEOG 457Labs