{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Detecting water with radar \n", "\n", "* **[Sign up to the DEA Sandbox](https://app.sandbox.dea.ga.gov.au/)** to run this notebook interactively from a browser\n", "* **Compatibility:** Notebook currently compatible with the `DEA Sandbox` environment only\n", "* **Products used:** \n", "[s1_gamma0_geotif_scene](https://explorer.sandbox.dea.ga.gov.au/s1_gamma0_geotif_scene)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Background\n", "\n", "Over 40% of the world’s population lives within 100 km of the coastline.\n", "However, coastal environments are constantly changing, with erosion and coastal change presenting a major challenge to valuable coastal infrastructure and important ecological habitats.\n", "Up-to-date data on the position of the coastline is essential for coastal managers to be able to identify and minimise the impacts of coastal change and erosion.\n", "\n", "While coastlines can be mapped using optical data (demonstrated in the [Coastal Erosion notebook](Coastal_erosion.ipynb)), these images can be strongly affected by the weather, especially through the presence of clouds, which obscure the land and water below.\n", "This can be a particular problem in cloudy regions (e.g. southern Australia) or areas where wet season clouds prevent optical satellites from taking clear images for many months of the year.\n", "\n", "### Sentinel-1 use case\n", "\n", "Radar observations are largely unaffected by cloud cover, so can take reliable measurements of areas in any weather.\n", "Radar data is readily available from the ESA/EC Copernicus program's Sentinel-1 satellites.\n", "The two satellites provide all-weather observations, with a revisit time of 6 days.\n", "By developing a process to classify the observed pixels as either water or land, it is possible to identify the shoreline from radar data.\n", "\n", "## Description\n", "\n", "In this example, we use data from the Sentinel-1 satellites to build a classifier that can determine whether a pixel is water or land in radar data.\n", "Specifically, this notebook uses an analysis-ready radar product known as backscatter, which describes the strength of the signal recieved by the satellite.\n", "The worked example takes users through the code required to:\n", "\n", "1. Load Sentinel-1 backscatter data for an area of interest\n", "2. Visualise the returned data.\n", "3. Perform pre-processing steps on the Sentinel-1 bands.\n", "4. Design a classifier to distinguish land and water.\n", "5. Apply the classifier to the area of interest and interpret the results.\n", "6. Investigate how to identify coastal change or the effect of tides.\n", "\n", "***" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Getting started\n", "\n", "**To run this analysis**, run all the cells in the notebook, starting with the \"Load packages\" cell.\n", "\n", "**After finishing the analysis**, return to the \"Analysis parameters\" cell, modify some values (e.g. choose a different location or time period to analyse) and re-run the analysis.\n", "There are additional instructions on modifying the notebook at the end." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Load packages\n", "Load key Python packages and supporting functions for the analysis." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "\n", "import datacube\n", "import numpy as np\n", "import xarray as xr \n", "import matplotlib.pyplot as plt\n", "from scipy.ndimage.filters import uniform_filter\n", "from scipy.ndimage.measurements import variance\n", "\n", "import sys\n", "sys.path.insert(1, '../Tools/')\n", "from dea_tools.plotting import display_map\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Connect to the datacube\n", "Activate the datacube database, which provides functionality for loading and displaying stored Earth observation data." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "dc = datacube.Datacube(app=\"Radar_water_detection\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Analysis parameters\n", "\n", "The following cell sets the parameters, which define the area of interest and the length of time to conduct the analysis over.\n", "The parameters are\n", "\n", "* `latitude`: The latitude range to analyse (e.g. `(-11.288, -11.086)`).\n", "For reasonable loading times, make sure the range spans less than ~0.1 degrees.\n", "* `longitude`: The longitude range to analyse (e.g. `(130.324, 130.453)`).\n", "For reasonable loading times, make sure the range spans less than ~0.1 degrees.\n", "\n", "**If running the notebook for the first time**, keep the default settings below.\n", "This will demonstrate how the analysis works and provide meaningful results.\n", "The example covers Melville Island, which sits off the coast of the Northern Territory, Australia.\n", "The study area also contains an additional small island, which will be useful for assessing how well radar data distinguishes between land and water. \n", "\n", "**To run the notebook for a different area**, make sure Sentinel-1 data is available for the chosen area using the [DEA Sandbox Explorer](https://explorer.sandbox.dea.ga.gov.au/s1_gamma0_geotif_scene).\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# Define the area of interest\n", "latitude = (-11.288, -11.086)\n", "longitude = (130.324, 130.453)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## View the selected location\n", "The next cell will display the selected area on an interactive map.\n", "Feel free to zoom in and out to get a better understanding of the area you'll be analysing.\n", "Clicking on any point of the map will reveal the latitude and longitude coordinates of that point." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "