Exporting satellite imagery animations 34a03a680645401aaffdc9cb5108e5ce

Background

Most of the case studies in this repository focus on quantitatively analysing satellite data to obtain insights into Australia’s changing environment. However, satellite imagery can also be used as a powerful tool for visualisation, particularly within dynamic environments that have changed significantly over the past ~30 years.

Animations produced from satellite images can help explain dynamic physical processes, highlight change over time, or provide valuable context to better understand the impacts of recent environmental events such as flooding or fire. Satellite animations can also be processed to create images of the landscape based on invisible wavelengths of light (e.g. false colour images), allowing us to obtain richer insights into features and processes that would otherwise be invisible to the human eye.

Digital Earth Australia use case

Digital Earth Australia provides over three decades of satellite imagery across the entire continent of Australia. Satellite data from the NASA/USGS Landsat program allow us to produce fortnightly images of Australia’s diverse natural and artificial landscapes at any time since 1986. More recently, the Copernicus Sentinel-2 mission has provided even higher resolution imagery as frequently as every 5 days since 2015.

Description

This notebook provides an interactive tool for selecting, loading, processing and exporting satellite imagery as a high quality animated MP4 and GIF files. This can be used in combination with the interactive Digital Earth Australia Maps platform to identify an image of interest, then download it using this notebook for use in other applications.

The tool requires no coding experience.


Getting started

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

Load packages

Import Python packages used for the analysis.

[1]:
import sys
sys.path.insert(1, '../Tools/')
from dea_tools.app import animations

Digital Earth Australia satellite imagery animation app

Run the animations.animation_app() cell below to launch the interactive application that is used to select the area to load and export satellite imagery animations.

Selecting parameters

On the left of the map, you will see a date selector, and a list of satellite imagery you can load:

  • Landsat: Data from the Landsat 5, 7, 8 and 9 satellites

  • Sentinel-2: Data from the Sentinel-2A and 2B satellites

  • Sentinel-2 and Landsat: Data from both Sentinel-2 and Landsat 5, 7, 8 and 9 satellites

Satellite imagery can be viewed and exported in two colour styles:

  • True colour: Creates a true colour image using the red, green and blue satellite bands

  • False colour: Creates a false colour image using short-wave infrared, infrared and green satellite bands

You can also modify the brightness and contrast of the output image by dragging the Colour percentile stretch slider, and select the output image format from .MP4 (smaller file sizes, higher quality, fast processing speeds) to .GIF (larger file sizes, lower quality, slower processing).

Tick the Apply rolling median box to produce a smooth animation that reduces the influence of cloud and noise. The larger the rolling median window, the smoother the output (at the expense of potentially removing short-lived events from the animation).

Selecting a location to export

Zoom into the map to a location you wish to animate. Select the Draw a rectangle tool on the left of the map, and draw a shape around the area you are interested in. When you are ready, press the green Generate animation button on the bottom left to start the animation generation.

To keep load times reasonable, the app is restricted to image exports smaller than 50000 hectares in size. This limit can be overuled in the Advanced settings.

[ ]:
animations.animation_app()

Advanced settings

The animation tool supports several advanced features. To access these, click on the Advanced tab in the menu to the left of the map to expand it:

  • Frame interval: The frame rate used to animate the satellite data. Values are in milliseconds - larger values will produce a longer, slower animation.

  • Resolution: The spatial resolution to load data (in metres). By default, the tool will automatically set the best possible resolution depending on the satellites selected (i.e. 30 m for Landsat, 10 m for Sentinel-2). Increasing this (e.g. to 100) can be useful for loading large spatial extents.

  • Width of output animation: The width of the animation MP4 or GIF file in pixels. This can be used to produce a HD video, but won’t increase the resolution of the input satellite imagery (setting a high value will produce a larger animation, but may introduce unwanted pixelation).

  • Apply temporal resampling: Whether to combine multiple satellite images into time period median composite images. Available options are None, monthly, quarterly and annually.

  • Mask out cloudy pixels: Whether to mask out cloudy pixels with nodata to remove them from the animation. This is best used in combination with a rolling median or temporal resampling, as otherwise it will introduce large areas of black nodata pixels in the animation.

  • Add DEA Coastlines overlay: Whether to add annual shoreline vectors from the Digital Earth Australia Coastlines product as an overlay on top of the animation.

  • Apply power transformation: Raises imagery by a power to reduce bright features and enhance dark features. This can add extra definition over areas with extremely bright features like snow, beaches or salt pans.

  • Apply unsharp masking Whether to apply unsharp masking to increase the sharpness of the output image. If activated, you can specify both the radius (in pixels) and the amount/strength of the sharpening.

  • Override maximum size limit: Whether to override the app’s default 500 square km area limit. This can be used to load larger areas of satellite imagery, but should be used with caution as it can lead to memory issues or crashes.

If running the notebook for the first time, keep the default settings above. This will demonstrate how the analysis works and provide meaningful results.

Downloading exported animation

The animation will be completed when Finished exporting animation appears above, and a preview of your animation is shown below the map.

The animation file (MP4 or GIF) will be saved to the same location you are running this notebook from (e.g. typically Real_world_examples). In JupyterLab, use the file browser to locate the image file with a name in the following format:

landsat_adelaidesouthaustralia_2017-06-21_2022-06-21_truecolour_30m.mp4

If you are using the DEA Sandbox, you can download the animation to your PC by right clicking on the image file and selecting Download.

Next steps

When you have exported your first animation, modify some parameters and rerun the analysis by clicking Generate animation. For example, you could try:

  • Applying a rolling median to produce a smooth animation that highlights long-term change over time.

  • Generate an animation for new dates using the date selectors.

  • Changing the satellite data to "Sentinel-2" to export a Sentinel-2 animation instead of Landsat.

  • Selecting the "False colour" style to export a false colour view of the landscape that highlights growing vegetation and water.

  • Specify a custom resolution in the Advanced tab, e.g. 100.

  • Experiment with different colour percentile stretches and the Advanced tab unsharp masking and power transformation functionality to alter the appearance of the resulting image.


Additional information

License: The code in this notebook is licensed under the Apache License, Version 2.0. Digital Earth Australia data is licensed under the Creative Commons by Attribution 4.0 license.

Contact: If you need assistance, please post a question on the Open Data Cube Discord chat or on the GIS Stack Exchange using the open-data-cube tag (you can view previously asked questions here). If you would like to report an issue with this notebook, you can file one on GitHub.

Last modified: December 2023

Compatible datacube version:

[3]:
import datacube
print(datacube.__version__)
1.8.6

Tags

Tags: NCI compatible, sandbox compatible, landsat 5, landsat 7, landsat 8, landsat 9, sentinel 2, animation, real world, plotting, widgets, interactive, no_testing