Introduction to DEA Mangroves 065526a422c14d8cb465a2af402b3e5a


Mangroves are unique, valuable and vulnerable woody plant species that inhabit intertidal regions around much of the Australian coastline.

They provide a diverse array of ecosystem services such as:

  • coastal protection

  • carbon storage

  • nursery grounds and habitat for a huge variety of avian, coastal and marine animal species.

However, mangrove ecosystems are impacted upon by both natural and anthropogenic drivers of change such as sea-level rise, coastal land reclaimation and severe tropical cyclone damage. In Australia, mangroves are protected by law and consequently, changes in their extent and canopy density are driven predominantly by natural drivers.

Modelling mangrove canopy density offers an effective mechanism to assess how mangroves are responding to these external influences and to monitor their recovery to ensure that they can continue to thrive and support our vital coastal ecosystems.

What this product offers

The DEA Mangroves data product maps the annual canopy cover density of Australian mangroves within a fixed extent around the entire continental coastline. The extent represents a union of Global Mangrove Watch layers for multiple years, produced by the Japanese Aerospace Exploration Agency.

Within this extent, mangroves are identified by leveraging a relationship between the 10th percentile green vegetation component of the DEA Fractional Cover data product with Light Detection And Ranging (LiDAR)-derived Planimetric Canopy Cover% (PCC). More detail on the method can be found here.

Three cover classes are identified within the product which are defined as:

  • Closed Forest - pixels with more than 80 % mangrove canopy cover

  • Open Forest - pixels with between 50 % and 80 % canopy cover

  • Woodland - pixels with between 20 % and 50 % canopy cover


  • Lymburner, L., Bunting, P., Lucas, R., Scarth, P., Alam, I., Phillips, C., Ticehurst, C., & Held, A., (2020). Mapping the multi-decadal mangrove dynamics of the Australian coastline. Remote Sensing of Environment, 238, 111185. Available at:


This notebook introduces the DEA Mangroves data product and steps through how to:

  1. View the product name and associated measurements in the DEA database

  2. Load the dataset and view the data classes within it

  3. Plot a single timestep image

  4. Create and view an animation of the whole timeseries

  5. Plot change over time by graphing the timeseries of each class

  6. Identify hotspot change areas within each class

Note: Visit the DEA Mangroves product documentation for detailed technical information including methods, quality, and data access.

Getting started

To run this analysis, run all the cells in the notebook, starting with the “Load packages” cell.

Load packages

Import Python packages that are used for the analysis.

%matplotlib inline

import datacube
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

from datacube.utils import masking
from IPython.core.display import Video
from matplotlib.colors import LinearSegmentedColormap

import sys

sys.path.insert(1, "../Tools/")
from dea_tools.plotting import display_map, xr_animation

Connect to the datacube

Connect to the datacube so we can access DEA data. The app parameter is a unique name for the analysis which is based on the notebook file name.

dc = datacube.Datacube(app="DEA_Mangroves")

Available products and measurements

List products available in Digital Earth Australia

dc_products = dc.list_products()
name description license default_crs default_resolution
ga_ls_mangrove_cover_cyear_3 ga_ls_mangrove_cover_cyear_3 Geoscience Australia Landsat Mangrove Cover Ca... CC-BY-4.0 None None

List measurements

View the list of measurements associated with the DEA Mangroves product. Note the single measurement unit, the nodata value and the flags_definitions.

dc_measurements = dc.list_measurements()
name dtype units nodata aliases flags_definition
product measurement
ga_ls_mangrove_cover_cyear_3 canopy_cover_class canopy_cover_class uint8 1 255 NaN {'woodland': {'bits': [0, 1, 2, 3, 4, 5, 6, 7]...

Loading data

Select and view your study area

If running the notebook for the first time, keep the default settings below. This will demonstrate how the analysis works and provide meaningful results. Zoom around the displayed map to understand the context of the analysis area. To select a new area, click on the map to reveal the Latitude (y) and Longitude (x) for diagonally opposite corners and place these values into the query

Replace the y and x coordinates to try the following locations:

  • Bowling Green Bay, Qld

    • “y”: (-19.50688750115376, -19.27501266742088)

    • “x”: (147.05183029174404, 147.47617721557216)

  • Pellew Islands, NT

    • “y”: (-15.6786, -16.0075)

    • “x”: (136.5360, 137.0682)

# Set up a region to load data
query = {
    "y": (-15.6806, -15.8193),
    "x": (136.5202, 136.6885),
    "time": ("1988", "2022"),
display_map(x=query["x"], y=query["y"])
Make this Notebook Trusted to load map: File -> Trust Notebook

Load and view DEA Mangroves

# Load data from the DEA datacube catalogue
mangroves = dc.load(product="ga_ls_mangrove_cover_cyear_3", **query)
Dimensions:             (time: 35, y: 531, x: 624)
  * time                (time) datetime64[ns] 1988-07-01T23:59:59.999999 ... ...
  * y                   (y) float64 -1.675e+06 -1.675e+06 ... -1.691e+06
  * x                   (x) float64 4.871e+05 4.872e+05 ... 5.058e+05 5.058e+05
    spatial_ref         int32 3577
Data variables:
    canopy_cover_class  (time, y, x) uint8 255 255 255 255 ... 255 255 255 255
    crs:           EPSG:3577
    grid_mapping:  spatial_ref

View the DEA Mangroves class values and definitions

You’ll see that four classes are identified in this dataset. The notobserved class was separated from nodata pixels in this workflow to identify locations where mangroves have been observed but there is poor observation density. This class is usually insignificant in size and has not been included in the remainder of this notebook analysis.

# Extract the flags information from the dataset
flags = masking.describe_variable_flags(mangroves)
flags["bits"] = flags["bits"].astype(str)
flags = flags.sort_values(by="bits")

# Append the class descriptions to each class
descriptors = {
    "closed_forest": "> 80 % canopy cover",
    "open_forest": "50 - 80 % canopy cover",
    "woodland": "20 - 50 % canopy cover",
    "notobserved": "Fewer than 3 clear observations",
flags = flags.rename(columns={"description": "class"})
flags["description"] = pd.Series(data=descriptors, index=flags.index)

# View the values in the dataset that are associated with each class
bits values class description
woodland [0, 1, 2, 3, 4, 5, 6, 7] {'1': True} Woodland 20 - 50 % canopy cover
notobserved [0, 1, 2, 3, 4, 5, 6, 7] {'0': True} Mangroves not observed Fewer than 3 clear observations
open_forest [0, 1, 2, 3, 4, 5, 6, 7] {'2': True} Open Forest 50 - 80 % canopy cover
closed_forest [0, 1, 2, 3, 4, 5, 6, 7] {'3': True} Closed Forest > 80 % canopy cover

Plotting data

Plot a single timestep

# Firstly, mask out the nodata values
mangroves["masked"] = mangroves.canopy_cover_class.where(mangroves.canopy_cover_class != 255)

# Plot the most recent timestep
<matplotlib.collections.QuadMesh at 0x7f25cde04100>

View all timesteps as an animation

# Produce a time series animation of mangrove canopy cover
    annotation_kwargs={"fontsize": 20, "color": "white"},
    imshow_kwargs={"cmap": "Greens"},

# Plot animation

# View and interact with the animation
Video("DEA_Mangroves.mp4", embed=True)
Exporting animation to DEA_Mangroves.mp4