dea_tools.mosaics.vrt

Tools for applying colour schemes and generating GDAL VRTs for mosaics of Digital Earth Australia (DEA) products, including single-band categorical visualisations and three-band composites (e.g., RGB for true or false colour imagery).

In case of categorical data, colour schemes are loaded from JSON files containing RGBA values and labels. The module supports DEA’s mosaic output structure and naming conventions and can operate on mosaic files stored locally or in the cloud (AWS’s S3).

License: The code in this module is licensed under the Apache License, Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0). Digital Earth Australia data is licensed under the Creative Commons by Attribution 4.0 license (https://creativecommons.org/licenses/by/4.0/).

Contact: If you need assistance, please post a question on the Open Data Cube Discord chat (https://discord.com/invite/4hhBQVas5U) or on the GIS Stack Exchange (https://gis.stackexchange.com/questions/ask?tags=open-data-cube) using the open-data-cube tag (you can view previously asked questions here: https://gis.stackexchange.com/questions/tagged/open-data-cube).

If you would like to report an issue with this script, you can file one on GitHub (GeoscienceAustralia/dea-notebooks#new).

Last modified: July 2025

Functions

make_styling_vrt(product, version, time, ...)

Create a virtual raster (VRT) for DEA products.

dea_tools.mosaics.vrt.make_styling_vrt(product, version, time, freq, cog_dir, output_dir, band=None, style_json_path=None, r_channel_band=None, g_channel_band=None, b_channel_band=None, vrt_name=None)[source]

Create a virtual raster (VRT) for DEA products.

If a single categorical band is specified, creates a categorical VRT with color scheme. If red, green, and blue bands are all provided, creates a three-band composite VRT. Raises error if input combinations are invalid.

Parameters:

productstr

DEA product name (e.g. ‘ga_ls_landcover_class_cyear_3’).

versionstr

Product version (e.g. ‘2-0-0’).

timeint or str

The target time of the mosaic, year if annual summaries (e.g. 2023), year-month for seasonal (e.g., water observations nov_mar –> ‘2024-11’)

freqstr

The frequency of the summary product (e.g. P1Y).

cog_dirstr

Path to directory with continental COG. E.g. ‘s3://dea-public-data/derivative/’

output_dirstr

Local directory or s3 directory where to save ouptut.

bandstr, optional

Band name (e.g. ‘level4’). Use None (default) if need a three-bands composite

style_json_pathstr, optional

Path to json file containing custom colour schemes. The json file should be structured as a dictionary with integer or string values as keys and [R,G,B,A,label] as values. E.g. {“1”:[255,255,255,0,”NA”]} for assigning a white colour and “NA” label to raster values equal to 1. Use None (default) for using the default schemes in dea-tools.

r_channel_bandstr, optional

Band to use in the RED channel for a three-bands composite. Use None (default) if need a single-band categorical view

g_channel_bandstr

Band to use in the GREEN channel for a three-bands composite. Use None (default) if need a single-band categorical view

b_channel_bandstr, optional

Band to use in the BLUE channel for a three-bands composite. Use None (default) if need a single-band categorical view

vrt_namestr, optional

An optional name used for the output VRT. If not provided, will default to {r_channel_band}-{g_channel_band}-{b_channel_band}.,