{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Monitoring chlorophyll-*a* in Australian waterbodies \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 both the `NCI` and `DEA Sandbox` environments\n", "* **Products used:** \n", "[ga_s2am_ard_3](https://explorer.dea.ga.gov.au/ga_s2am_ard_3), \n", "[ga_s2bm_ard_3](https://explorer.dea.ga.gov.au/ga_s2bm_ard_3)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Background\n", "Inland waterbodies are essential for supporting human life, both through the supply of drinking water and the support of agriculture and aquaculture.\n", "Such waterbodies can be contaminated by outbreaks of blue-green (and other toxic) algae, causing health issues for people and animals.\n", "For example, up to a million fish died during an [algal bloom event](https://www.abc.net.au/news/2019-01-08/second-fish-kill-in-darling-river-at-menindee/10696632) in the Darling river in late 2018 and early 2019. \n", "While the health of waterbodies can be monitored from the ground through sampling, satellite imagery can complement this, potentially improving the detection of large algal bloom events.\n", "However, there needs to be a well-understood and tested way to link satellite observations to the presence of algal blooms.\n", "\n", "### Sentinel-2 use case\n", "Algal blooms are associated with the presence of clorophyll-*a* in waterbodies.\n", "[Mishra and Mishra (2012)](https://doi.org/10.1016/j.rse.2011.10.016) developed the normalised difference chlorophyll index (NDCI), which serves as a qualitative indicator for the concentration of clorophyll-*a* on the surface of a waterbody.\n", "The index requires information from a specific part of the infrared specturm, known as the 'red edge'. \n", "This is captured as part of Sentinel-2's 13 spectral bands, making it possible to measure the NDCI with Sentinel-2. \n", "\n", "## Description\n", "\n", "In this example, we measure the NDCI for one of the Menindee Lakes, which was strongly affected by the algal bloom event mentioned in the Background section.\n", "This is combined with information about the size of the waterbody, which is used to build a helpful visualisation of how the water-level and presence of chlorophyll-*a* changes over time.\n", "The worked example takes users through the code required to:\n", "\n", "1. Load cloud-free Sentinel-2 images for an area of interest.\n", "2. Compute indices to measure the presence of water and clorophyll-*a*.\n", "3. Generate informative visualisations to identify the presence of clorophyll-*a*.\n", "\n", "### Some caveats\n", "\n", "* The NDCI is currently treated as an experimental index for Australia, as futher work is needed to calibrate and validate how well the index relates to the presence of clorophyll-*a*. \n", "* It is also important to remember that algal blooms will usually result in increased values of the NDCI, but not all NDCI increases will be from algal blooms.\n", "For example, there may be seasonal fluctuations in the amount of clorophyll-*a* in a waterbody.\n", "* Further validation work is required to understand how shallow water and atmospheric effects affect the NDCI, and its use in identifying high concentrations of clorophyll-*a*.\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 matplotlib\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", "import xarray as xr\n", "\n", "import warnings\n", "warnings.filterwarnings(\"ignore\")\n", "\n", "import sys\n", "sys.path.insert(1, '../Tools/')\n", "from dea_tools.datahandling import load_ard\n", "from dea_tools.plotting import rgb, display_map\n", "from dea_tools.bandindices import calculate_indices\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=\"Chlorophyll_monitoring\")" ] }, { "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. `(-32.423, -32.523)`).\n", "For reasonable loading times, make sure the range spans less than ~0.1 degrees.\n", "* `longitude`: The longitude range to analyse (e.g. `(142.180, 142.280)`).\n", "For reasonable loading times, make sure the range spans less than ~0.1 degrees.\n", "* `time`: The date range to analyse (e.g. `('2015-01-01', '2019-09-01')`).\n", "For reasonable loading times, make sure the range spans less than 3 years.\n", "Note that Sentinel-2 data is only available after July 2015.\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 Lake Cawndilla, one of the Menindee Lakes in New South Wales.\n", "\n", "**To run the notebook for a different area**, make sure Sentinel-2 data is available for the chosen area using the [DEA Explorer](https://explorer.dea.ga.gov.au/ga_s2am_ard_3).\n", "Use the drop-down menu to check both Sentinel-2A (`ga_s2am_ard_3`) and Sentinel-2B (`ga_s2bm_ard_3`). \n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# Define the area of interest\n", "latitude = (-32.423, -32.523)\n", "longitude = (142.180, 142.280)\n", "\n", "# Set the range of dates for the analysis\n", "time = (\"2017-06-01\", \"2019-06-01\")" ] }, { "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": [ "
<xarray.Dataset>\n", "Dimensions: (time: 84, y: 596, x: 510)\n", "Coordinates:\n", " * time (time) datetime64[ns] 2017-06-03T00:31:18.395000 ... 20...\n", " * y (y) float64 -3.572e+06 -3.572e+06 ... -3.584e+06\n", " * x (x) float64 9.477e+05 9.478e+05 ... 9.579e+05 9.579e+05\n", " spatial_ref int32 3577\n", "Data variables:\n", " nbart_red_edge_1 (time, y, x) float32 1.614e+03 1.831e+03 ... 1.191e+03\n", " nbart_red (time, y, x) float32 1.296e+03 1.572e+03 ... 1.122e+03\n", " nbart_green (time, y, x) float32 699.0 823.0 929.0 ... 951.0 932.0\n", " nbart_blue (time, y, x) float32 418.0 449.0 526.0 ... 773.0 745.0\n", " nbart_nir_1 (time, y, x) float32 2.279e+03 2.526e+03 ... 1.448e+03\n", " nbart_swir_2 (time, y, x) float32 3.085e+03 3.454e+03 ... 1.667e+03\n", "Attributes:\n", " crs: EPSG:3577\n", " grid_mapping: spatial_ref