Reinhard Tonemapped RGB Ratio (RTRGBR)

//VERSION=3
// Reinhard Tonemapped RGB Ratio visualization for Sentinel-1 (IW, dual-pol VV+VH).
// R = VV, G = VH, B = VH/VV ratio. A Reinhard tone-mapping curve lifts the
// mid-range and compresses the highlights, so dense cities keep their internal
// structure instead of clipping to white and vegetation reads clearly green.
// Adapted from the standard Sentinel-1 RGB-ratio composite; tone mapping after
// sentinel-2/tonemapped_natural_color.
// by András Zlinszky, Copernicus Data Space Ecosystem, @azlinszky.bsky.social and Google Gemini
// License: CC BY-SA 4.0

// ---- USER-TUNABLE PARAMETERS -------------------------------------------
// Per-channel gain: higher = brighter that channel. Sets both the colour
// balance and where each channel lands on the tone curve.
var vvGain = 2.9;  // VV     -> Red
var vhGain = 16.0; // VH     -> Green  (raise for greener vegetation)
var ratGain = 1.6; // VH/VV  -> Blue

// Tone curve:
var white = 3; // white point: higher -> more highlight headroom
// (keeps bright cities from blowing out to white)
var gamma = 1; // <1 lifts the mid-range; 1 = no change

var saturation = 1.1; // >1 boosts colour separation

function setup() {
  return {
    input: [{ bands: ["VV", "VH", "dataMask"] }],
    output: { bands: 4 },
  };
}

// extended Reinhard tone map: compresses highlights, maps `white` to 1.0
function reinhard(x) {
  return (x / (1 + x)) * (1 + 1 / white);
}

// push each channel away from its luma by `saturation`, clamped at 0
function saturate(rgb, s) {
  var L = rgb[0] * 0.2126 + rgb[1] * 0.7152 + rgb[2] * 0.0722;
  return [
    Math.max(L + (rgb[0] - L) * s, 0),
    Math.max(L + (rgb[1] - L) * s, 0),
    Math.max(L + (rgb[2] - L) * s, 0),
  ];
}

function evaluatePixel(s) {
  if (s.dataMask === 0) {
    return [0, 0, 0, 0];
  }

  var col = [s.VV * vvGain, s.VH * vhGain, (s.VH / s.VV) * ratGain];

  col = saturate(col, saturation);

  // Sentinel Hub clamps the final output to [0, 1]
  for (var i = 0; i < 3; i++) {
    col[i] = Math.pow(reinhard(col[i]), gamma);
  }

  return [col[0], col[1], col[2], s.dataMask];
}
//VERSION=3
// Reinhard Tonemapped RGB Ratio visualization for the Sentinel-1 DH monthly
// mosaic (dual-pol HH+HV).
// R = HH, G = HV, B = HV/HH ratio. A Reinhard tone-mapping curve lifts the
// mid-range and compresses the highlights, so dense cities keep their internal
// structure instead of clipping to white and vegetation reads clearly green.
// Adapted from the standard Sentinel-1 RGB-ratio composite; tone mapping after
// sentinel-2/tonemapped_natural_color.
// by András Zlinszky, Copernicus Data Space Ecosystem, @azlinszky.bsky.social and Google Gemini
// License: CC BY-SA 4.0

// ---- USER-TUNABLE PARAMETERS -------------------------------------------
// Per-channel gain: higher = brighter that channel. Sets both the colour
// balance and where each channel lands on the tone curve.
var vvGain = 2.9; // HH     -> Red
var vhGain = 16.0; // HV     -> Green  (raise for greener vegetation)
var ratGain = 1.6; // HV/HH  -> Blue

// Tone curve:
var white = 3.0; // white point: higher -> more highlight headroom
// (keeps bright cities from blowing out to white)
var gamma = 0.8; // <1 lifts the mid-range; 1 = no change

var saturation = 1.2; // >1 boosts colour separation

function setup() {
  return {
    input: [{ bands: ["HH", "HV", "dataMask"] }],
    output: { bands: 4 },
  };
}

// extended Reinhard tone map: compresses highlights, maps `white` to 1.0
function reinhard(x) {
  return (x / (1 + x)) * (1 + 1 / white);
}

// push each channel away from its luma by `saturation`, clamped at 0
function saturate(rgb, s) {
  var L = rgb[0] * 0.2126 + rgb[1] * 0.7152 + rgb[2] * 0.0722;
  return [
    Math.max(L + (rgb[0] - L) * s, 0),
    Math.max(L + (rgb[1] - L) * s, 0),
    Math.max(L + (rgb[2] - L) * s, 0),
  ];
}

function clamp01(x) {
  return x < 0 ? 0 : x > 1 ? 1 : x;
}

function evaluatePixel(s) {
  // no-data, non-positive, or NaN -> transparent. !(x > 0) also catches NaN,
  // so Sentinel-1 monthly-mosaic gaps stay clean.
  if (s.dataMask === 0 || !(s.HH > 0) || !(s.HV > 0)) {
    return [0, 0, 0, s.dataMask];
  }

  var col = [s.HH * vvGain, s.HV * vhGain, (s.HV / s.HH) * ratGain];

  col = saturate(col, saturation);

  for (var i = 0; i < 3; i++) {
    col[i] = clamp01(Math.pow(reinhard(col[i]), gamma));
  }

  return [col[0], col[1], col[2], s.dataMask];
}

Evaluate and Visualize

General description

Reinhard Tonemapped RGB Ratio (RTRGBR) is an adjustment of the default RGB ratio visualisation of Sentinel-1 Synthetic Aperture Radar data. It replaces the linear transfer function with a Reinhard tone-mapping curve, the approach used in the popular Tonemapped Natural Colour script for Sentinel-2.

As a result, the extremely high and low values are somewhat compressed and the mid-range is lifted. The image is brighter overall: dark areas such as water and bare soil show more pattern, and bright areas such as cities do not wash out to white. The aim is a visually appealing image that is easy to interpret, while the link between the colours and the data stays easy to understand. In that sense it is the radar analogue of Highlight Optimized Natural Colour for Sentinel-2.

The channel assignment follows the standard RGB ratio composite:

  • Red: VV backscatter (HH in the DH version)
  • Green: VH backscatter (HV in the DH version)
  • Blue: the VH/VV ratio (HV/HH in the DH version)

Each channel is multiplied by a gain, with high values applied to green for green vegetation, the colour saturation is boosted slightly, and then each channel passes through the extended Reinhard curve x / (1 + x) * (1 + 1 / white) and an optional gamma. Water appears dark, vegetation green, bare ground purple-blue and urban areas yellow-orange, with their internal structure kept.

Three versions are provided:

  • script.js for Sentinel-1 data with VV+VH polarisation (IW mode GRD and the Sentinel-1 IW monthly mosaic).
  • dh_monthly_mosaic.js for the Sentinel-1 DH monthly mosaic (HH+HV, polar regions). It uses a slightly stronger mid-tone lift (gamma = 0.8) and saturation (1.2), and also masks NaN and non-positive pixels so that gaps in the mosaic stay transparent.
  • script_min.js, a minified copy of script.js with the same parameters and output. Copernicus Browser passes custom scripts through the URL of share links, which limits their length; this version is about a fifth of the size.

Tunable parameters

The top of each script exposes:

  • vvGain, vhGain, ratGain: per-channel gains, which set the colour balance and where each channel sits on the tone curve. Raise vhGain for greener vegetation.
  • white: the white point of the Reinhard curve. Higher values leave more headroom for bright targets such as cities.
  • gamma: values below 1 lift the mid-range further; 1 means no change.
  • saturation: values above 1 increase colour separation.

Description of representative images

The Southern Alps of New Zealand west of Wanaka in the Sentinel-1 IW monthly mosaic of September 2026. Left: the standard RGB ratio visualisation; right: RTRGBR. Open this comparison in Copernicus Browser. Split comparison of the standard RGB ratio (left) and RTRGBR (right) over the Southern Alps west of Wanaka, New Zealand

Glasgow and Edinburgh, Scotland, UK, visualised with RTRGBR in a single Sentinel-1 IW acquisition from 18 November 2026. Open this scene in Copernicus Browser. RTRGBR visualisation of Glasgow and Edinburgh, Scotland

References