Section A: Performing Change Detection Analysis in the Cloud Using Google Earth Engine

Introduction

Google Earth Engine is a cloud-based platform for planetary-scale environmental data analysis. The main components of Earth Engine are:
– Datasets: A petabyte-scale archive of publicly available remotely sensed imagery and other data. Explore the data catalog.
– Compute power: Google’s computational infrastructure optimized for parallel processing of geospatial data.
– APIs: APIs for JavaScript and Python (hosted on GitHub) for making requests to the Earth Engine servers. These docs focus on JavaScript; (Get started guide for the JavaScript API). For Python, see the Python install guide and the Python examples in the Earth Engine GitHub repository.
– Code Editor: An online Integrated Development Environment (IDE) for rapid prototyping and visualization of complex spatial analyses using the JavaScript API. Explore the Code Editor docs.

Learning Objectives

By going through this exercise, you will become familiarized with some basic tools and functionalities of Google Earth Engine (GEE) and you will be able to:
– Open Google Earth Engine (GEE)
– Get familiar with GEE interface and toolbars
– Work with data layers
– Load and display satellite image
– Calculate vegetation index

WHAT IS GOOGLE EARTH ENGINE AND HOW YOU CAN USE IT?

Google Earth Engine (GEE) is an advanced cloud-based geospatial processing platform, designed mainly for planetary-scale environmental data analysis. It combines a multi-petabyte catalog of satellite imagery and geospatial datasets, which allow users to visualizemanipulateedit, and create spatial data in an easy and fast way. It incorporates a wide range of spatial manipulation tools which allows scientists, researchers, and developers to detect changesmap trends, and quantify differences on the Earth’s surface.

The ability to analyse and manipulate data according to user needs, differentiate this application from the traditional Google Earth.

Earth Engine stores, more than thirty years of historical imagery and scientific datasets, updated and expanded daily. It organizes them and make them available for public users, as well as, for commercial ones or administrations systems.
https://www.giscourse.com/what-is-google-earth-engine-and-how-you-can-use-it/

Google Earth Engine (GEE)

To work with GEE, it is necessary to register as a user and for that, click on the “Sign up” button.

GEE Sign Up Page

After registration is completed, you can access the platform and start exploring its capabilities. For example, you can load different types of satellite images already processed.

One of the best capabilities of this platform is that one can use different types of datasets. Among them are the satellite, geophysical and weather images as well as demographic data, etc. User can also load and visualize both raster and vector data.

GEE Data Catalog

GETTING STARTED WITH GEE

Google Earth Engine allows users to run algorithms on georeferenced imagery and vectors stored on Google’s infrastructure. The Google Earth Engine API provides a library of functions which may be applied to imagery for display and analysis. Earth Engine’s public data catalog contains a large amount of publicly available imagery and vector datasets. Private assets can also be created in users’ personal folders.

The Code Editor is an interactive environment for developing Earth Engine applications. The centre panel provides a JavaScript code editor. Above the editor are buttons to save the current script, run it, and clear the map. The Get Link button generates a unique URL for the script in the address bar. The map in the bottom panel contains the layers added by the script. At the top is a search box for datasets and places. The left panel contains code examples, your saved scripts, a searchable API reference and an asset manager for private data. The right panel has an inspector for querying the map, an output console, and a manager for long-running tasks.

GEE Code Editor

EARTH ENGINE CODE EDITOR

The Earth Engine (EE) Code Editor at code.earthengine.google.com is a web-based IDE for the Earth Engine JavaScript API. Code Editor features are designed to make developing complex geospatial workflows fast and easy.
– JavaScript code editor
– Map display for visualizing geospatial datasets
– API reference documentation (Docs tab)
Git-based script manager (Scripts tab)
– Console output (Console tab)
– Task manager (Tasks tab) to handle long-running queries
– Interactive map query (Inspector tab)
– Search of the data archive or saved scripts
– Geometry drawing tools

GEE Code Editor explained

– The Code Editor has a variety of features that helps in proper use of the Earth Engine API.
– View example scripts or save your own scripts on the Scripts tab.
– Query objects placed on the map with the Inspector tab.
Display and chart numeric results using the Google Visualization API.
– Share a unique URL to your script with collaborators and friends with the Get Link button.
– Scripts developed in the Code Editor are sent to Google for processing and the generated map tiles and/or messages are sent back for display in the Map and/or Console tab.
– All you need to run the Code Editor is a web browser such as Google Chrome and an internet connection.

OPENING AND RUNNING CODE IN THE CODE EDITOR

The steps below demonstrate how to open Earth Engine and execute a custom script that displays an image.

  • Open the Earth Engine Code Editor here: code.earthengine.google.com using a registered Google account
  • Navigate to the Scripts tab located on the far left of the Code Editor. There you will find a collection of example scripts that access, display, and analyze Earth Engine data
  • Under “Image Collection,” select the “Filtered Composite” example. You will see a script appear in the center console
  • Press the Run button to execute the script

The Filtered Composite example will select Landsat 7 images that intersect or are within the boundaries of Colorado and Utah and displays the true color composites. The samples introduce you to commonly used methods, such as filter(), clip(), and Map.addLayer().

QUESTIONS

Explore the output code and result in the map window of google earth engine and answer the following questions:

What sensor data is displayed?
______________________________________________________________________________

Which time period?
______________________________________________________________________________

If there are many images in same location which value is picked?
______________________________________________________________________________

Which color composite is displayed?
______________________________________________________________________________

BUILD YOUR OWN SCRIPT TO VISUALIZE OPTICAL SATELLITE IMAGE

Stat new script

  • From the top right corner of scripts panel, Click New > Repository
  • Enter your home folder name: “CommonSensing” > Click Continue. (Note: you can only create home folder one time and cannot change home folder name)
  • Provide a repository name as “CS_Fiji_UNOSAT” > Click on “Create” to create a new repository
Creating a new repository
  • From the top right corner of scripts panel, Click New > File > type “Landsat_8_Mosaic”
GEE – Create File

Now you can open the new script by clicking on “Landsat_8_Mosaic” from scripts panel.

Defining Area of Interest (AOI)

  • Scroll and zoom in the map to Ba, Fiji
  • Follow to infographic below to create a point of interest
Creating a point of interest
  • Use the same technique to create a rectangular area of interest covering Ba city and name it “aoi”

Load a single Landsat 8 Image

By using EO Browser we have identified a very nice cloud free Landsat 8 image over Ba from “2020-07-01”.

QUESTION

Using Landsat Acquisition Tool can you find the path and row for Landsat 8 acquisition for Ba?
______________________________________________________________________________

You can use the following code structure to load the specific Landsat image:

Code structure to load the specific Landsat image
  • Type the following code to load a single Landsat 8 image
var dataset = ee.Image('LANDSAT/LC08/C01/T1/LC08_075072_20200701');

Display Natural and False Colour Image

  • Define the display parameter like the following:
var visParams = {
  bands: ['B4', 'B3', 'B2'],
  min: 7000,
  max: 15000,
  gamma: 1.2,
};
  • Set map center and zoom level based on the point created earlier:
Map.centerObject(poi, 12);
  • Display data using following code
Map.addLayer(dataset, visParams, 'Band Composite');
  • Click on the RUN button from top right
GEE entering the codes to display parameters

Your turn: Play with different values of visualization parameter to find the best visual output.

Calculate NDVI and Display

  • Use the following formula to calculate NDVI
var NDVI = dataset.normalizedDifference(['B5','B4']);
  • Display NDVI using the code below
Map.addLayer(NDVI,{min:-1.0, max:1.0}, 'NDVI');
  • Click the RUN button from top right
  • If you want to display the NDVI with colour Palette, use the code below:
var vegPalette = ['3b09d0','171dea','1916f4','ddeec9','13d622','07850b']
Map.addLayer(NDVI,{min:-1.0, max:1.0, palette: vegPalette},'NDVI Pallete');

To get more color palette, check ColorBrewer

CHALLENGE: LET US SEE A WHOLE COUNTRY WITH LANDSAT 8 (OPTIONAL)

  • Setup AOI for whole Fiji
  • Create cloud free mosaic for the year 2019
  • Display the Natural Colour cloud free image

Sample code, [you will need to adjust a few things!]

// This example demonstrates the use of the Landsat 8 QA band to mask clouds.
//Set Map Center and Zoom Level
Map.centerObject(poi, 11);
// Function to mask clouds using the quality band of Landsat 8.
var maskL8 = function(image) {
var qa = image.select('BQA');
// Check that the cloud bit is off.
// See https://www.usgs.gov/land-resources/nli/landsat/landsat-collection-1-level-1-quality-assessment-band
var mask = qa.bitwiseAnd(1 << 6).eq(0);
  return image.updateMask(mask);
}
// Load the Landsat 8 TOA collection
var collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA');
//Filter for 2019 > mask cloud &gt; take median values of whole years collection
var L8C_2019 = collection.filterDate('YYYY-MM-DD', 'YYYY-MM-DD') //Date Filter
.map(maskL8) //call cloud Mask
.median()//Median of whole collection
;
//Define visualisation parameters
var visParams = {
bands: ['B4', 'B3', 'B2'],
min: 0,
max: 1,
gamma: 2.5,
};
//set map center and zoom level
Map.centerObject(poi, 12);
//Display map
Map.addLayer(L8C_2019, visParams, 'Band Composite');

Section B: Waterbody Change Detection using Synthetic Aperture Radar Data

INTRODUCTION

During the flooding season the weather is generally cloudy and observation from optical satellite imagery cannot provide a situational snapshot on the ground. The Synthetic Aperture Radar (SAR) sensors are very much useful in these cases due to its independence on weather and solar illumination. Since the launch of Sentinel-1, a European C-band SAR satellite, routine collections of large amounts of data with short revisit times are made freely available, enhancing the capabilities of flood response activities. However, pre-processing of SAR imagery is very computation heavy and requires a lot of time to perform analysis on a single scene. However, using GEE, it is possible to analysis a great number of satellite images for describing complex dynamics of flood waters. In this exercise, we are going to explore waterbody change in Ba City from 2015 to 2020.

Example of waterbody change detection

Learning Objectives

By going through this exercise, you will become familiarized with some basic tools and functionalities of Google Earth Engine (GEE) and you will be able to:
– Load Sentinel 1 SAR image collection
– Extract surface water from Sentinel 1 SAR
– Perform change detection analysis using data from two period

DEFINE AREA OF INTEREST (AOI)

  • Create a new script file name “Sentinal_1_ChangeDetection”
  • Scroll and zoom in the map to Ba, Fiji
  • Create a point of interest and name its “poi”

LOADING SENTINEL 1 IMAGE COLLECTION

Imagery in the “Earth Engine ‘COPERNICUS/S1_GRD’ Sentinel-1 Image Collection” consists of Level-1 Ground Range Detected (GRD) scenes processed to backscatter coefficient (σ°) in decibels (dB). The backscatter coefficient represents target backscattering area (radar cross-section) per unit ground area. Because it can vary by several orders of magnitude, it is converted to dB as 10*log10σ°. It measures whether the radiated terrain scatters the incident microwave radiation preferentially away from the SAR sensor dB < 0) or towards the SAR sensor dB > 0). This scattering behaviour depends on the physical characteristics of the terrain, primarily the geometry of the terrain elements and their electromagnetic characteristics.

var imgVV = ee.ImageCollection('COPERNICUS/S1_GRD')
        .filterBounds(poi)
        .filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VV'))
        .filter(ee.Filter.eq('instrumentMode', 'IW'))
        .filter(ee.Filter.eq('orbitProperties_pass', 'DESCENDING'))
        .select('VV');

SET MAP CENTER AND ZOOM LEVEL

Map.centerObject(poi, 12);

TAKING MEDIAN PIXEL VALUE FOR GETTING MAXIMUM WATER EXTENT FOR MARCH 2015 AND 2020

.filterDate(‘yyyy-mm-dd’, ‘yyyy-mm-dd’) filters the image collection within the defined date range. And the .median() is an image reducer that will output the median value of all different value in the same location from different time.

What an “image reducer” does
var img_2015 = imgVV.filterDate('2015-03-01', '2015-03-31').median();
Map.addLayer(img_2015, {min: -30, max: 0}, 'Median S1 VV image for March 2015', false);

var img_2020 = imgVV.filterDate('2020-03-01', '2020-03-31').median();
Map.addLayer(img_2020, {min: -30, max: 0}, 'Median S1 VV image for March 2020', false);

THRESHOLD DB SIGNAL OF SAR WITH -13.5 TO SEPARATE WATER

Lower values or darker areas in a SAR image usually represent water. All the dB values less than -13.5 (approximately) usually presents water. This is the default threshold for classifying water and not water area.

Example of a SAR image
var water_2015 = img_2015.lte(-13.5);
Map.addLayer(water_2015, {min: 0, max: 1}, 'Water Area March 2015', false);
var water_2020 = img_2020.lte(-13.5);
Map.addLayer(water_2020, {min: 0, max: 1}, 'Water Area March 2020', false);

You can modify the value -13.5 to find an optimal threshold which separates land and water best.

SIMPLE MATH TRICK TO GET WATER DYNAMICS

Now, we have two binary rasters with 0= land and 1= water code. If we use a formula “Before*10 + After”, we shall be able separate all different land-water dynamics.

The formula “Before*10 + After”
var water_change = water_2015.multiply(10).add(water_2020);
Map.addLayer(water_change, {min: 0, max: 11, palette: ['f7fcf2', 'ff1100', 'd3c5db', '7f92f0']}, 'Surface water change from 2015 - 2020', false);

EXPORT A GEOTIFF

  • Add a rectangle as a new polygon layer and named ‘aoi’ to clip your output
Export.image.toDrive({
  image: water_change,
  description: 'SurfaceWaterChange_2015_2020',
  scale: 10,
  region: aoi,
  fileFormat: 'GeoTIFF',
  formatOptions: {
    cloudOptimized: false
  }
});
  • Run the script from code editor panel and click run button from script panel. Save your output image to google drive.
Running the script to export image

Once process is finished, you will notice completion status is show in the tasks tab. If you click on the task you’ shall be able to download the output to your computer.

Completion status
  • Download the output image to your computer, open GeoTIFF file in ArcMap, and set symbology layer as unique values.
Display GEE image in ArcMap

QUESTIONS

Open the output image to ArcMap and calculate how much water area has become land. Can you describe what maybe the reason?
______________________________________________________________________________

What other change detection you shall be able to perform using google earth engine?
______________________________________________________________________________

Section C: Climate Engine: Big Data Applications Climate Observation

Introduction

What is Climate Engine?

Climate Engine uses Google’s Earth Engine for on-demand processing of satellite and climate data via a web browser. It is a tool developed jointly by Desert Research Institute, University of Idaho, and Google through a Google Faculty Research award White House Climate Initiative.

What are its Application Features?

  • On-demand value and anomaly mapping.
  • Time series and statistical summaries.
  • Downloadable results in GeoTIFF format, and time series results as .csv or .xlsx format.
  • Share map or time series results with web URL links.

Learning Objectives

By going through this exercise, you will become familiarized with some basic tools and functionalities of Google Earth Engine (GEE) and you will be able to:

  • Process and visualize satellite earth observations and gridded weather data.
  • Environmental monitoring and to improve early warning of drought, wildfire, and crop-failure risk.
  • Analyse and interact with climate and earth observations for decision support related to drought, water use, agricultural, wildfire, and ecology
https://climateengine.org/

Exercise on Drought Outlook

Exercise: 1:00 hour

  • Derive NDVI for your area of interest and observe the vegetation conditions for the region
  • Observe the precipitation pattern using CHIRPS data and compare the outputs with that of the derived NDVI
  • Prepare a drought outlook
  • Prepare a drought mitigation plan

Drought Outlook Requirement

  1. NDVI Map
  2. Precipitation map or graph
  3. Expected situations
  4. Alert levels (high, medium, and low)
  5. Advice to the farmers on drought conditions

Drought Mitigation Plan Requirement

  1. Who and what is at risk and why?
  2. Advice to farmers on cropping strategy
  3. Drought adaptation measures
  4. Propose alternate cropping depending on drought conditions

Evaluation: 15 mins

  • Presentation (5 mins)
  • Discussions (10 mins)