Skip to content

Sentinel-1 RTC: constant geolocation offset per relative orbit against Sentinel-2 (up to ~95 m), scaling with the GRD terrain height and stepping with IPF version #519

Open

Description

Summary

Over a river reach in Ibaraki, Japan, sentinel-1-rtc images are displaced against Sentinel-2 L2A by an amount that is constant for a relative orbit and differs between orbits: about 95 m for relative orbit 39, about 23 m for orbit 46 and about 16 m for orbit 141. For orbit 39 the displacement was smaller with older IPF versions (about 33 m with IPF 002.43, about 58 m with IPF 002.60). The size follows the terrain height at which the source GRD was projected to ground range, which for orbit 39 is about 1,100 m above the valley floor because the same azimuth lines cross the Japanese Alps at near range.

This looks related to #492 (offsets when slice boundaries change) and different from the October 2024 bug fixed in #404. I am reporting it separately because it is measured against an independent reference instead of as a change within the RTC time series, and because the GRD annotation suggests a mechanism.

What was measured

A 3.7 km x 3.8 km window (lon 140.4251 to 140.4657, lat 36.5131 to 36.5470, Kuji River), UTM 54N, 10 m. Reference: Sentinel-2 L2A NDWI from five cloud-free scenes (December 2020 to February 2021). For each RTC item, two independent estimates of the displacement of the image content:

  • ncc: sub-pixel peak of the normalised cross-correlation between VV (dB) and the Sentinel-2 land fraction, within 300 m of the river
  • iou: the integer-pixel shift that maximises the overlap of the water masks (VV, Gaussian sigma 1 px, below -15 dB, against NDWI > 0)

Positive values mean the RTC content sits to the east / north of Sentinel-2. The RTC files for these items are already on the 10 m grid used by Sentinel-2, so no resampling is involved.

Relative orbit Date IPF GRD projection height at site (m) Incidence (deg) Implied GRD ground-range displacement (m) ncc: east, north (m) iou: east, north (m) IoU at best shift / unshifted
39 (asc) 2021-01-22 003.31 1179 45.4 1105 +89.4, +29.9 +90, +30 0.19 / 0.00
39 (asc) 2021-02-03 003.31 1179 45.4 1104 +91.0, +29.8 +90, +30 0.21 / 0.00
46 (desc) 2021-01-16 003.31 121 36.1 84 -21.1, +8.9 -20, +10 0.25 / 0.18
46 (desc) 2021-01-28 003.31 121 36.1 84 -21.1, +8.4 -10, 0 0.28 / 0.21
141 (asc) 2021-01-17 003.31 180 34.8 172 -4.1, +15.2 -10, +20 0.26 / 0.19
141 (asc) 2021-01-29 003.31 177 34.8 167 -4.1, +16.6 -10, +20 0.24 / 0.17
39 (asc) 2016-01-19 002.60 1158 45.4 1082 +53.0, +23.5 +50, +30 0.24 / 0.01
39 (asc) 2015-04-30 002.43 1052 45.4 978 +29.3, +14.3 +20, +20 0.09 / 0.01

The two estimates agree to within one pixel, and two scenes of the same orbit agree to within 2 m (ncc). With orbit 39 the river in the RTC image does not overlap the Sentinel-2 river at all until the image is shifted (IoU 0.00). The correlation peaks are low (0.07 to 0.17) because the river is narrow and single scenes are speckled; the 2015 row is the weakest.

"GRD projection height" is the value of generalAnnotation/terrainHeightList in the GRD annotation, interpolated to the azimuth time of the site. "Implied displacement" is (projection height - 60 m) / tan(incidence), with 60 m the approximate ellipsoidal height of the valley floor. This is the ground-range displacement that the GRD itself carries at the site and that terrain correction has to remove.

Possible cause (not confirmed)

The GRD is projected to ground range at one terrain height per azimuth time, constant across range. Where the swath contains high mountains at one end and a lowland at the other, that height is far from the true height of the lowland: here about 1,100 m too high for orbit 39 and about 60 to 120 m for the other two orbits. The RTC product removes most of the resulting displacement but leaves about 9% of it for orbits 39 and 141 (95 of 1,105 m; 16 of 170 m) and about 27% for orbit 46 (23 of 84 m). The residual for orbit 39 points along the look direction (east-north-east for this ascending pass).

Two observations that may help:

  • In the 2015 and 2016 annotations (IPF 002.43, 002.60) every geolocation grid point on a line carries the same height (880 m and 955 m on the line nearest the site). In the 2021 annotations (IPF 003.31) the grid heights vary along the line (95 to 1,190 m for orbit 39) while terrainHeightList still gives about 1,179 m. If the RTC processing takes the height of the input geometry from the geolocation grid, its behaviour would change with the IPF version, which is what the table shows for orbit 39.
  • Because the projection height depends on which terrain falls inside each azimuth step of a slice, a change of slice boundaries changes it. That would fit the slice-boundary dependence reported in Sentinel-1 RTC - offsets between S1A and S1C platforms #492.

I have not seen the RTC processing code, so this is a reading of the inputs, not a diagnosis.

What was not checked

  • Other regions. In the same orbit-39 scenes, a lake about 30 km away showed an offset of a different size and sign in my own analysis, so the offset is not a constant per scene. That measurement is not part of the script below.
  • VH, and scenes after 2021.
  • Whether the Sentinel-2 reference itself is off. Its water outline agrees with a 5 m airborne lidar DEM of the same reach to within about 6 m in my own analysis (not in the script).
  • Radiometry. A geometric residual of this size also means the terrain flattening is applied at the wrong place on slopes; I did not measure that.

To reproduce

Public data only, anonymous signing, about 2 to 3 minutes, small windowed reads.

pip install pystac-client planetary-computer rasterio numpy scipy
python repro_s1rtc_offset.py
#!/usr/bin/env python3
"""Minimal reproduction: geolocation offset of Planetary Computer `sentinel-1-rtc` against Sentinel-2,
by relative orbit, over a 4 km reach of the Kuji River (Ibaraki, Japan).

Public data only (anonymous Planetary Computer signing). Reads small windows of 8 Sentinel-1 RTC items and
5 Sentinel-2 L2A items, plus the annotation XML of the matching Sentinel-1 GRD items.

    pip install pystac-client planetary-computer rasterio numpy scipy
    python repro_s1rtc_offset.py

For every RTC item it prints two independent estimates of where the image content sits relative to
Sentinel-2 (positive = RTC content is displaced to the east / north):
  ncc: sub-pixel peak of the normalised cross-correlation between VV (dB) and the Sentinel-2 land fraction
       (1 - share of scenes with NDWI > 0), within 300 m of the river
  iou: the integer shift that maximises the overlap (IoU) of the two water masks
and, from the GRD item's annotation, the processor version, the terrain height the GRD was projected at for
the site's azimuth time, and the heights stored in the geolocation grid.
"""
import re, sys, time, urllib.request, xml.etree.ElementTree as ET
from datetime import datetime
import numpy as np, rasterio, pystac_client, planetary_computer
from scipy.interpolate import griddata
from rasterio.enums import Resampling
from rasterio.vrt import WarpedVRT
from rasterio.transform import from_origin
from rasterio.warp import transform as warp_xy
from rasterio.windows import from_bounds
from scipy import ndimage

BBOX = (140.4251, 36.5131, 140.4657, 36.5470)            # lon/lat, Kuji River near Hitachi-Omiya
EPSG = 32654                                             # UTM 54N, the native grid of all items below
S1_RTC = [                                               # (item id, relative orbit)
    ("S1B_IW_GRDH_1SDV_20210122T084139_20210122T084204_025265_030226_rtc", 39),
    ("S1B_IW_GRDH_1SDV_20210203T084139_20210203T084204_025440_0307C1_rtc", 39),
    ("S1A_IW_GRDH_1SDV_20210116T204303_20210116T204328_036168_043DA0_rtc", 46),
    ("S1A_IW_GRDH_1SDV_20210128T204303_20210128T204328_036343_0443B7_rtc", 46),
    ("S1B_IW_GRDH_1SDV_20210117T083319_20210117T083348_025192_02FFD9_rtc", 141),
    ("S1B_IW_GRDH_1SDV_20210129T083319_20210129T083348_025367_03056F_rtc", 141),
    ("S1A_IW_GRDH_1SSV_20160119T084147_20160119T084212_009561_00DE67_rtc", 39),   # older processor version
    ("S1A_IW_GRDH_1SDV_20150430T084142_20150430T084207_005711_007548_rtc", 39),   # older processor version
]
S2_L2A = [
    "S2A_MSIL2A_20201215T012041_R031_T54SVF_20201220T103341",
    "S2B_MSIL2A_20210109T012029_R031_T54SVF_20210109T111751",
    "S2A_MSIL2A_20210114T012011_R031_T54SVF_20210115T085341",
    "S2B_MSIL2A_20210122T012949_R074_T54SVF_20210122T151222",
    "S2A_MSIL2A_20210206T012831_R074_T54SVF_20210522T193400",
]
SEARCH = 15                                              # search radius, pixels (10 m)
GDAL = dict(GDAL_DISABLE_READDIR_ON_OPEN="EMPTY_DIR", CPL_VSIL_CURL_ALLOWED_EXTENSIONS=".tif,.tiff",
            GDAL_HTTP_MAX_RETRY="5", GDAL_HTTP_RETRY_DELAY="3")

T0 = time.time()
cat = pystac_client.Client.open("https://planetarycomputer.microsoft.com/api/stac/v1")
def item(coll, iid):
    return planetary_computer.sign(cat.get_collection(coll).get_item(iid))

# target grid: 10 m, snapped to multiples of 10 m (the grid Sentinel-2 uses)
xs, ys = warp_xy("EPSG:4326", f"EPSG:{EPSG}", [BBOX[0], BBOX[2]], [BBOX[1], BBOX[3]])
x0, x1 = np.floor(min(xs) / 10) * 10, np.ceil(max(xs) / 10) * 10
y0, y1 = np.floor(min(ys) / 10) * 10, np.ceil(max(ys) / 10) * 10
W, H = int((x1 - x0) / 10), int((y1 - y0) / 10)
T = from_origin(x0, y1, 10, 10)

def read(href):
    """Read the target window; reports the sub-pixel misfit between the file grid and the target grid."""
    with rasterio.Env(**GDAL), rasterio.open(href) as src:
        assert src.crs.to_epsg() == EPSG, src.crs
        frac = ((src.transform.c - x0) / 10 % 1, (src.transform.f - y1) / 10 % 1)
        if abs(src.transform.a) == 10 and frac == (0, 0):          # same grid: plain window, no resampling
            a = src.read(1, window=from_bounds(x0, y0, x1, y1, src.transform), boundless=True, fill_value=0)
        else:
            with WarpedVRT(src, crs=f"EPSG:{EPSG}", transform=T, width=W, height=H, resampling=Resampling.bilinear) as v: a = v.read(1)
    return a.astype("float32"), frac

# --- Sentinel-2 reference: median NDWI of five cloud-free winter scenes
nd = []
for iid in S2_L2A:
    it = item("sentinel-2-l2a", iid)
    g, _ = read(it.assets["B03"].href); n, _ = read(it.assets["B08"].href)
    nd.append(np.where(g + n > 0, (g - n) / (g + n), np.nan)); print(f"  read Sentinel-2 {iid[11:19]} ({time.time() - T0:.0f} s)", file=sys.stderr, flush=True)
nd = np.array(nd); ndwi = np.nanmedian(nd, axis=0)
water2 = ndwi > 0.0
near = ndimage.binary_dilation(water2, iterations=30)       # within 300 m of Sentinel-2 water
near[:SEARCH] = near[-SEARCH:] = False; near[:, :SEARCH] = near[:, -SEARCH:] = False
ref = 1.0 - np.nanmean(np.where(np.isfinite(nd), nd > 0.0, np.nan), axis=0)   # land fraction, 0 = always water
print(f"grid {W} x {H} px at 10 m, EPSG:{EPSG}, origin ({x0:.0f}, {y1:.0f}); Sentinel-2 water pixels: {int(water2.sum())}")

def shifted(a, dy, dx):                                     # content moved dy rows down, dx columns right
    return np.roll(np.roll(a, dy, 0), dx, 1)

def ncc_offset(db):
    c = np.full((2 * SEARCH + 1, 2 * SEARCH + 1), -9.0); y = ref[near]
    for dy in range(-SEARCH, SEARCH + 1):
        for dx in range(-SEARCH, SEARCH + 1):
            c[dy + SEARCH, dx + SEARCH] = np.corrcoef(shifted(db, dy, dx)[near], y)[0, 1]
    j, i = np.unravel_index(np.argmax(c), c.shape); sub = [0.0, 0.0]
    if 0 < j < 2 * SEARCH and 0 < i < 2 * SEARCH:           # parabola through the peak and its neighbours
        for k, (m, p) in enumerate(((c[j - 1, i], c[j + 1, i]), (c[j, i - 1], c[j, i + 1]))):
            d = m - 2 * c[j, i] + p; sub[k] = 0.5 * (m - p) / d if d != 0 else 0.0
    dy, dx = j - SEARCH + sub[0], i - SEARCH + sub[1]
    return -dx * 10, dy * 10, float(c[j, i])                # the shift that aligns is minus the displacement

def iou_offset(db):
    w1 = ndimage.gaussian_filter(db, 1) < -15.0; best = (0, 0, -1.0)
    for dy in range(-SEARCH, SEARCH + 1):
        for dx in range(-SEARCH, SEARCH + 1):
            s = shifted(w1, dy, dx); u = (s | water2)[near].sum()
            v = (s & water2)[near].sum() / u if u else 0.0
            if v > best[2]: best = (dy, dx, float(v))
    s0 = w1; u0 = (s0 | water2)[near].sum()
    return -best[1] * 10, best[0] * 10, best[2], float((s0 & water2)[near].sum() / u0)

def grd_info(rtc_id):
    """From the GRD annotation: processor version, the terrain height used for the ground-range projection at the
    site's azimuth time (terrainHeightList), the geolocation-grid height at the site and its range across one line."""
    it = item("sentinel-1-grd", rtc_id[:-4]); lon, lat = (BBOX[0] + BBOX[2]) / 2, (BBOX[1] + BBOX[3]) / 2
    root = ET.fromstring(urllib.request.urlopen(it.assets["schema-product-vv"].href).read())
    sec = lambda t: datetime.fromisoformat(t).timestamp()
    G = np.array([(float(e.findtext("longitude")), float(e.findtext("latitude")), sec(e.findtext("azimuthTime")),
                   float(e.findtext("height")), float(e.findtext("incidenceAngle")), int(e.findtext("line")))
                  for e in root.iter("geolocationGridPoint")])
    t_az, h_grid, inc = (float(griddata(G[:, :2], G[:, k], (lon, lat), method="linear")) for k in (2, 3, 4))
    TH = np.array([(sec(e.findtext("azimuthTime")), float(e.findtext("value"))) for e in root.iter("terrainHeight") if e.findtext("azimuthTime")])
    h_proj = float(np.interp(t_az, TH[:, 0], TH[:, 1]))
    line = G[G[:, 5] == G[np.argmin(np.abs(G[:, 2] - t_az)), 5]]            # the grid line nearest the site
    ipf = re.search(r'software name="Sentinel-1 IPF" version="([^"]+)"', urllib.request.urlopen(it.assets["safe-manifest"].href).read().decode())
    return (ipf.group(1) if ipf else "?"), h_proj, h_grid, float(line[:, 3].min()), float(line[:, 3].max()), inc

H_TRUE = 60.0                                               # valley floor: about 20 m above sea level, geoid about +39 m
print("\norbit | date     | IPF    | GRD projection height at site [m] | geolocation-grid height at site (range along the line) [m] | "
      "incidence | implied GRD ground-range displacement [m] | RTC vs Sentinel-2, ncc: east, north [m] (peak r) | iou: east, north [m] (IoU best / unshifted)")
for iid, orb in S1_RTC:
    it = item("sentinel-1-rtc", iid); a, frac = read(it.assets["vv"].href)
    db = 10 * np.log10(np.where(a > 0, a, np.nan)); db = np.where(np.isfinite(db), db, np.nanmean(db)).astype("float32")
    e1, n1, r = ncc_offset(db); e2, n2, v, v0 = iou_offset(db); ipf, hp, hg, gmin, gmax, inc = grd_info(iid)
    print(f"{orb:>5} | {iid[17:25]} | {ipf} | {hp:6.0f} | {hg:5.0f} ({gmin:.0f} to {gmax:.0f}) | {inc:4.1f} | {(hp - H_TRUE) / np.tan(np.radians(inc)):6.0f} | "
          f"{e1:+6.1f}, {n1:+6.1f} ({r:.2f}) | {e2:+4.0f}, {n2:+4.0f} ({v:.2f} / {v0:.2f})" + ("" if frac == (0, 0) else f" | resampled, grid misfit {frac[0]:.2f},{frac[1]:.2f} px"), flush=True)
print(f"\nelapsed {time.time() - T0:.0f} s")

Output on 2026-11-21 (identical on two runs):

grid 366 x 375 px at 10 m, EPSG:32654, origin (448520, 4044760); Sentinel-2 water pixels: 1167

orbit | date     | IPF    | GRD projection height at site [m] | geolocation-grid height at site (range along the line) [m] | incidence | implied GRD ground-range displacement [m] | RTC vs Sentinel-2, ncc: east, north [m] (peak r) | iou: east, north [m] (IoU best / unshifted)
   39 | 20210122 | 003.31 |   1179 |   157 (95 to 1190) | 45.4 |   1105 |  +89.4,  +29.9 (0.12) |  +90,  +30 (0.19 / 0.00)
   39 | 20210203 | 003.31 |   1179 |   157 (95 to 1190) | 45.4 |   1104 |  +91.0,  +29.8 (0.12) |  +90,  +30 (0.21 / 0.00)
   46 | 20210116 | 003.31 |    121 |   117 (0 to 1610) | 36.1 |     84 |  -21.1,   +8.9 (0.14) |  -20,  +10 (0.25 / 0.18)
   46 | 20210128 | 003.31 |    121 |   117 (0 to 1610) | 36.1 |     84 |  -21.1,   +8.4 (0.17) |  -10,   +0 (0.28 / 0.21)
  141 | 20210117 | 003.31 |    180 |   122 (0 to 230) | 34.8 |    172 |   -4.1,  +15.2 (0.14) |  -10,  +20 (0.26 / 0.19)
  141 | 20210129 | 003.31 |    177 |   122 (0 to 230) | 34.8 |    167 |   -4.1,  +16.6 (0.15) |  -10,  +20 (0.24 / 0.17)
   39 | 20160119 | 002.60 |   1158 |   972 (955 to 955) | 45.4 |   1082 |  +53.0,  +23.5 (0.16) |  +50,  +30 (0.24 / 0.01)
   39 | 20150430 | 002.43 |   1052 |   934 (880 to 880) | 45.4 |    978 |  +29.3,  +14.3 (0.07) |  +20,  +20 (0.09 / 0.01)

elapsed 155 s

Environment: Python 3.12.10, pystac-client 0.9.1, planetary-computer 1.0.0, rasterio 1.5.2, numpy 2.5.5, scipy 1.18.1, macOS.

Questions

  1. Is a residual of this kind a known limitation where the GRD projection height is far from the local terrain height?
  2. Which height does the RTC processing take for the input GRD geometry: terrainHeightList, or the heights of the geolocation grid points?
  3. Is there a recommended way to flag or correct affected scenes? Co-registering each scene to an optical reference works for my use, but it needs a reference with enough contrast.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions