-
Notifications
You must be signed in to change notification settings - Fork 86
Add color relief rendering for DEMs and continuous rasters #1154
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Motivation
GDAL's gdaldem color-relief applies a color ramp to a DEM or other continuous raster to produce an RGB image. This is a basic cartographic operation that comes up whenever you need to visualize elevation, temperature, precipitation, or any other continuous surface. The existing hillshade() function produces a grayscale shading layer, but there's no built-in way to map values to colors or to combine hillshade with a color ramp for publication-quality terrain maps.
Proposed API
color_relief(da, color_table)Scope
- Map continuous raster values to RGB using a color ramp with linear interpolation between entries.
- Color table format: list of
(value, r, g, b)tuples, matching the format used by GDAL's color text files. - Built-in color ramps for common use cases: terrain (green-brown-white), bathymetry (blue gradient), temperature (blue-red diverging).
- Optional combined shaded relief mode that blends color relief with hillshade in a single pass.
- Output: 3-band (RGB) or 4-band (RGBA) DataArray.
Implementation notes
This is a straightforward per-pixel operation (lookup + linear interpolation in the color table), so all four backends (numpy, cupy, dask+numpy, dask+cupy) should be easy to support. Combining with hillshade is just a per-pixel multiply/blend on top of that.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request