SAR geocoding and radiometric terrain correction
Design · range-Doppler geocoding, terrain flattening and layover and shadow masks for Sentinel-1, in radiomax, geoops, geoproducts and pipekit-array
5 Dec 2026 · proposed
Status: proposed. Decisions SG-D1 to SG-D9 (§11) are recommendations awaiting the owner; open questions SG-O1 to SG-O6 (§12) are unanswered. No issue is filed yet.
Repositories: radiomax (the geometry and the radiometry), geotoolz (geoops for the read-out and the masks’ application, geoproducts for the reader, geoarray for the vertical datum), pipekit-array (one helper); functax and integrix are untouched.
Prototype: every number on this page comes from
prototypes/sar_geocoding.py(NumPy, float64, about a second), on a synthetic circular orbit seen from a rotating WGS84 Earth and a Gaussian hill. It downloads nothing. §5 lists what it measured, and thesar_geocoding_prototypestage ofdvc.yamlwrites the same numbers toresults/metrics/sar_geocoding.json.Starting point: a blog post that terrain-corrects one Sentinel-1 GRD scene from scratch in NumPy, rasterio and pyproj raphi-web, 2026. It covers the geometry only: its output is uncalibrated digital numbers on the DEM grid, with no terrain flattening, no layover or shadow handling and no numerical comparison against SNAP. This page takes its pipeline as the skeleton and adds what it leaves out, from the literature and from the processors named in §6.
Related: the radiomax design and its details, whose
radiomax.sarmodule this page extends; the geophysix design for the ellipsoid; Missing operators, whose layout this page follows.
TL;DR¶
radiomax already calibrates SAR but cannot locate it.
radiomax.sarconverts digital numbers to σ⁰, β⁰ and γ⁰ and between them, with the incidence angle of the ellipsoid. Nothing in the stack finds where a SAR pixel lies on the ground, and nothing removes the terrain from its radiometry.The geometry belongs in radiomax (SG-D1): the orbit read-out, the zero-Doppler time, the slant and ground ranges, radar coordinates, the local incidence angle, facet areas and the layover and shadow rules. Each is a function of positions, times and a few annotation coefficients, which is radiomax’s placement test, and each runs on any array library.
The read-out belongs in geoops (SG-D4). Geocoding is a warp whose source coordinates come from radiomax instead of pyproj. geoops’
Reproject(engine="interp")already builds that warp as a functax plan, but only from a CRS; it needs a public entry that takes a coordinate field.Terrain flattening is the adjoint of geocoding (SG-D6). Small’s terrain flattening Small, 2011 spreads each DEM facet’s area into the radar pixels that see it, which is the transpose of the read-out that geocodes. So the same functax plan that geocodes the image also flattens it, through
Plan.adjoint, with no second projection code.Newton, not bisection (SG-D3). From the middle of the orbit table, Newton with the exact derivative converged in 1 to 4 iterations to 10⁻⁹ s; bisection needed 38. The answers agreed to 2.9 × 10⁻¹⁰ s. A fixed count of 6 iterations has no data-dependent loop, so it runs the same on NumPy and under
jax.jit.The vertical datum is worth 4 to 7 pixels. Treating Copernicus DEM heights (above the geoid) as ellipsoidal heights with a 47 m undulation shifts a target by 44 m on the ground at 47° incidence and 74 m at 33°, which is 4.4 to 7.4 GRD pixels (SG-D5).
Terrain flattening is not optional on slopes. On a 1,500 m hill, the ellipsoid γ⁰ radiomax gives today was −8.1 to +2.9 dB off the truth on slopes, and +10.2 to +15.2 dB in layover; on flat ground it was within 0.05 dB.
Other gaps found on the way: a Sentinel-1 annotation reader in geoproducts (SG-D8), a geoid-height conversion in geotoolz (SG-D5), a
cumulative_maxhelper in pipekit-array for the shadow rule (SG-D7), thermal-noise removal in radiomax’s calibration (SG-O3) and, as a candidate, the CMOD5.N ocean-wind model as a radiomax retrieval (SG-O6).
1 Motivation¶
A Sentinel-1 GRD image is not a map. Its rows are azimuth times and its columns ground-range samples on the ellipsoid, so every mountain is displaced towards the sensor, foreslopes are compressed and bright, backslopes stretched and dark, and the steepest foreslopes fold over (layover) or vanish (shadow). Two corrections fix this, and the stack has neither:
Geometric terrain correction (geocoding). For each cell of an output grid with a DEM height, find the radar pixel that saw it, by solving the range-Doppler equations, and read the image there.
Radiometric terrain correction (terrain flattening). A radar pixel’s power comes from all the ground it illuminates, which depends on the terrain. Dividing by the illuminated area, computed from the DEM, gives γ⁰ that is comparable between foreslopes, backslopes and flat ground.
The blog post raphi-web, 2026 shows that the first one is a few hundred lines of NumPy: parse the annotation XML, interpolate 17 orbit state vectors, solve the zero-Doppler condition per DEM pixel, turn slant range into a GRD column with the annotation’s polynomial, and resample. It also shows the traps: it needed the geoid correction to make the image line up, it uses 60 bisection steps per pixel, and it stops before calibration and terrain flattening.
The stack already holds most of the ingredients, spread across packages that do not know about each other:
| Ingredient | Where it is today |
|---|---|
| geodetic to Earth-centred coordinates and back | geophysix geodetic_to_ecef, ecef_to_geodetic |
| the speed of light, the WGS84 ellipsoid | geophysix Constants.speed_of_light, WGS84 |
| the line of sight, the local east–north–up frame, the view zenith | radiomax view_angles |
| a ray meeting the ellipsoid | radiomax earth_intersection |
| DN to σ⁰, β⁰, γ⁰, and conversions with an incidence angle | radiomax dn_to_backscatter, sigma0_to_gamma0 and the rest of radiomax.sar |
| a warp as a functax plan with an adjoint | geoops Reproject(engine="interp"), built on functax.interp plans |
| reading a grid at arbitrary points, differentiable in the points | geoops interp_at |
| DEM slope, gradients | geoops slope_degrees, gradient_2d |
| speckle filters | geoops despeckle_lee, despeckle_refined_lee, despeckle_frost |
| a vertical datum label on a height axis | geoarray’s height coordinate, datum ("EGM2008") |
What is missing is the range-Doppler geometry that connects them, a reader that gets the annotation into arrays, and the radiometric step that needs the DEM.
Why not wrap SNAP or ISCE3. Both do all of this and more (§6). Wrapping them gives a file-to-file black box: no gradients through the geometry, no JAX, and no reuse of the pieces (the zero-Doppler time is also what a SAR forward model in a data-assimilation system needs). They stay the oracles that the stack’s version is checked against.
2 User stories¶
A flood or wetland analyst wants γ⁰ on a UTM grid from a Sentinel-1 GRD scene and a Copernicus DEM, with layover and shadow masked, so a threshold on water does not fire on every backslope. They need the whole chain, SG-D1 to SG-D8.
A data-assimilation developer in vardax wants the observation operator from a model state on a map grid to SAR backscatter in radar geometry, with its adjoint, so σ⁰ can enter a variational cost. The geocoding read-out H and its adjoint Hᵀ are that operator (SG-D4).
A geolocation researcher wants derivatives of a target’s radar coordinates with respect to its height and the orbit, to estimate a DEM bias or an orbit offset from corner reflectors. The zero-Doppler solve has closed-form derivatives (§4.5), and a fixed-iteration Newton differentiates under JAX (SG-D3).
A sea-ice or ocean-wind modeller in sesmax wants σ⁰ geocoded onto the model grid with the incidence angle of every pixel, because ocean backscatter falls steeply with incidence. They need G3 and G6; for wind they also need a geophysical model function (SG-O6).
A reader developer in geoproducts wants one parser of the Sentinel-1 SAFE annotation that returns the orbit, timing, range polynomials, geolocation grid, calibration and noise tables as arrays, so no algorithm parses XML (SG-D8).
A student wants to see why a mountain leans towards the satellite, by computing the radar coordinates of a few DEM cells by hand with the same functions the pipeline uses.
3 Scope¶
In scope
| Code | Addition | Package |
|---|---|---|
| G1 | Orbit read-out from state vectors: cubic Hermite (positions and velocities) and 8-point Lagrange | radiomax.sar |
| G2 | Zero-Doppler time, slant range, two-way delay, ground range from the annotation polynomial and back | radiomax.sar |
| G3 | Radar coordinates (line, column) of Earth-centred points, for GRD and SLC timing | radiomax.sar |
| G4 | Local incidence angle, projection angle, facet areas A_γ and A_β, and γ⁰ from areas | radiomax.sar |
| G5 | Layover and shadow rules: the slope rule (elementwise) and the profile rules (monotone range, running maximum of the look angle) | radiomax.sar, with G9 |
| G6 | Geocoding from a coordinate field: a public warp whose source coordinates are given, returning the functax plan, so its adjoint is reachable | geoops |
| G7 | Vertical datum: orthometric to ellipsoidal heights with a geoid grid, honouring geoarray’s datum | geotoolz (geoops, geoarray) |
| G8 | Sentinel-1 SAFE annotation reader: orbit, timing, range polynomials, geolocation grid, calibration and noise tables | geoproducts |
| G9 | cumulative_max on any array library | pipekit-array |
| G10 | A TerrainCorrect recipe composing G1 to G9 with radiomax’s calibration, and a geostack notebook on one subsampled scene | geoops; geostack |
Out of scope
SLC bursts and TOPS deramping, interferometry, polarimetric decompositions. G3 accepts SLC timing, but assembling bursts and the phase are a later design.
Corrections below a GRD pixel. The ESA and UZH geocoding guide lists the atmospheric path delay as the largest (3 to 4 m of one-way range), then the residual timing effects (about 2 m along track), intra-pulse motion and topography-dependent Doppler in IW (up to about 1 m) and solid Earth tides (centimetres, up to about 50 cm near the equator) Small & Schubert, 2022. The IPF already applies the bulk bistatic correction to GRD, and the residual one applies to Stripmap GRD but not to TOPS GRD Small & Schubert, 2022. Against a 10 m pixel these are a third of a pixel at most; corner-reflector studies need them Gisinger et al., 2021, and SG-O5 records when they would enter.
Downloading data. Finding scenes, DEM tiles and precise orbit files is geocatalog’s and geocloud’s; this page assumes they arrive as files.
Despeckling. geoops already owns it (radiomax decision of 23 Nov 2026).
First release: steps S1 to S5 of §13 (G1 to G4, G6, G7 and G8). The masks (S6 with S8) and the recipe (S7) follow.
4 Background maths¶
4.1 Frames and the target¶
Everything is in Earth-centred, Earth-fixed coordinates (ECEF, m). A target at longitude λ, geodetic latitude φ and ellipsoidal height h is
with a the semi-major axis and e² the squared eccentricity of WGS84; this is geophysix’s geodetic_to_ecef. The Copernicus DEM gives orthometric heights H above the EGM2008 geoid (EPSG:3855) on WGS84 longitudes and latitudes, and it is a surface model, so buildings and canopy are in it Airbus Defence and Space, 2022Pavlis et al., 2012. So the ellipsoidal height is h = H + N_g(λ, φ), with N_g the geoid undulation, tens of metres and varying over a scene. §4.5 shows what forgetting it costs.
4.2 The orbit¶
The annotation gives state vectors (tₖ, Sₖ, Vₖ), positions and velocities in ECEF, every 10 s. On the interval [tₖ, tₖ₊₁] of length Δ, at s = (t − tₖ)/Δ, the cubic Hermite read-out uses both:
with h₀₀ = 2s³ − 3s² + 1, h₁₀ = s³ − 2s² + s, h₀₁ = −2s³ + 3s², h₁₁ = s³ − s². Its derivatives give the velocity V(t) = Ṡ(t) and the acceleration A(t) = S̈(t), both needed below. SNAP reads the orbit with an 8-point Lagrange polynomial; ISCE3 defaults to a cubic Hermite and offers an 8th-order Legendre option; sarsen fits a degree-5 polynomial to the positions and differentiates it (§6). Because the velocities are in the Earth-fixed frame, the Earth’s rotation is already in them, and the geometry below needs no inertial frame.
4.3 The zero-Doppler condition¶
A SAR image is focused to zero Doppler: the target P is imaged at the azimuth time t at which the sensor is closest to it, where the range rate vanishes:
Its derivative is
The first term dominates: the second is the orbit’s curvature, a few percent of it. Newton’s step is t ← t − D(t)/D′(t). D is close to linear over a scene, so Newton converges in a few steps from any start inside the orbit table (§5).
4.4 Ranges and radar coordinates¶
At the zero-Doppler time t, the slant range and the two-way delay are
with c the speed of light. The radar coordinates follow from the image timing, with t₀ the first line’s time, Δt the azimuth time interval, τ₀ the first sample’s two-way delay and Δτ the range sampling interval:
A GRD image is resampled to ground range on the ellipsoid, so its column is the ground range g over the ground pixel spacing Δg, and g comes from the annotation’s slant-to-ground polynomial (coefficients cᵢ about the reference slant range r₀), one set per azimuth time. The blog post takes the set nearest in time rather than interpolating the coefficients raphi-web, 2026; SG-O2 asks which to do.
4.5 Derivatives at zero Doppler¶
Two identities make the geometry cheap to differentiate. The range rate is zero at the solution, ∂r/∂t = D/r = 0, so the slant range’s derivative with respect to the target does not depend on how t moves (an envelope theorem):
The azimuth time moves by the implicit function theorem, from ∂D/∂P = −Vᵀ:
For a height error Δh along the ellipsoid normal n̂, the first gives Δr ≈ −Δh cos θᵢ, and on a GRD image a ground-range shift of about Δh / tan θᵢ, with θᵢ the incidence angle. The geoid undulation of §4.1 is such an error.
4.6 Local incidence and the projection angle¶
With the line of sight ℓ̂ = (S − P)/r and n̂_T the unit normal of the terrain from the DEM, the local incidence angle θ_loc and the projection angle ψ, the angle between n̂_T and the normal of the slant-range image plane (spanned by ℓ̂ and the along-track direction v̂ = V/‖V‖), are
up to the sign fixed by the look side. On flat ground θ_loc is the ellipsoid incidence θ and ψ = 90° − θ. Ulander’s slope correction is σ⁰_T = β⁰ cos ψ and γ⁰_T = β⁰ cos ψ / cos θ_loc Ulander, 1996, as the OPERA RTC-S1 algorithm document restates them Shiroma & Fattahi, 2024; on flat ground they reduce to radiomax’s β⁰ sin θ and β⁰ tan θ.
4.7 Terrain flattening by area projection¶
β⁰ is the backscatter per unit area in the slant-range image plane, A_β = δ_az δ_r per pixel. Small’s terrain-flattened γ⁰ divides the same power by the area the terrain presents to the radar, projected onto the plane normal to the look direction Small, 2011:
where the sum runs over the DEM facets k imaged into radar pixel j, aₖ is a facet’s area, and facets in shadow or facing away (cos θ_loc ≤ 0) contribute nothing. On flat ground a radar pixel sees a ground area A_β / sin θ, so A_γ = A_β cot θ and γ⁰_T = β⁰ tan θ, radiomax’s sigma0_to_gamma0 composed with beta0_to_sigma0. In layover, several facets far apart on the ground fall into one radar pixel; the sum adds their areas, so their pooled power is shared out rather than counted once per facet, which a per-pixel cos ψ correction cannot do.
The area sum is the adjoint of geocoding. Write the geocoding read-out as a matrix H (N_Ω × N_r), from the N_r radar pixels to the N_Ω DEM cells, so that geocoded β⁰ is H β⁰. Spreading each facet’s projected area into the radar pixels it falls in, with the same weights, is its transpose:
with a and θ_loc the per-cell vectors. The terrain-flattened, geocoded image is then H(β⁰ ⊙ A_β ⊘ A_γ): one plan, applied once forward and once adjoint. Small spreads each facet’s area with bilinear weights, which is the transpose of a bilinear read-out, and needs the DEM upsampled well beyond the radar grid to avoid gaps Small, 2011Shiroma & Fattahi, 2024. ISCE3’s area projection, used by OPERA RTC-S1, instead splits each cell into four triangles, maps their vertices to radar geometry and rasterises the projected polygon into weights, which is a different H with the same adjoint structure Shiroma et al., 2022Shiroma & Fattahi, 2024. The facet area is half the norm of the cross product of two edges.
4.8 Layover and shadow¶
Along one range line (fixed azimuth time), let x be the ground distance from the sensor’s nadir, z(x) the terrain, r(x) the slant range and α(x) the look angle from the sensor’s vertical. Then:
Active layover where r decreases as x increases, ∂r/∂x ≤ 0. Locally this is the slope rule: the terrain’s slope towards the sensor is at least the look angle. It needs no neighbours.
Passive layover at points whose slant range falls inside the range interval of an active-layover point: they are imaged on top of it. This needs the whole line.
Shadow where the look angle is below the running maximum of the look angles nearer the sensor, α(x) < max_{x′ < x} α(x′): something nearer hides the point. This needs a cumulative maximum along the line, which the array API does not have (G9).
ISCE3 computes its mask this way: it samples each range line on a grid twice as wide as the image, flags shadow by the running maximum of the elevation angle, and flags layover by checking that the cross-track coordinate stays monotone when the points are sorted by slant range, in a near-to-far and a far-to-near pass. Its bitmask is 1 for shadow, 2 for layover and 3 for both.
5 Background numerics¶
The prototype measures the choices the design makes. Its orbit is circular, at 693 km and 98.18° inclination, seen from WGS84 rotating at 7.292115 × 10⁻⁵ rad s⁻¹, sampled every 10 s over 160 s as the annotation’s 17 state vectors are. Its targets are nine points on the ellipsoid at incidence angles from 32.5° to 46.7°, near Sentinel-1 IW’s range. Its terrain is a Gaussian hill on one range line in the zero-Doppler plane, on locally flat ground.
| Quantity | Measured |
|---|---|
| Orbit read-out, maximum position error over the inner 100 s: straight chord between state vectors | 102 m |
| the same, cubic Hermite with velocities | 0.25 mm |
| the same, 8-point Lagrange | below 10 nm (float64 round-off) |
| Velocity error: Hermite; 8-point Lagrange | 7.7 × 10⁻⁵ m s⁻¹; below 10⁻¹⁰ m s⁻¹ (round-off) |
| Zero-Doppler iterations to 10⁻⁹ s from the table’s middle: Newton with D′ exact | 1 to 4 |
| the same, Newton with D′ ≈ ‖V‖² | 1 to 12 |
| the same, bisection over the table | 38 |
| Largest difference between the Newton and bisection times | 2.9 × 10⁻¹⁰ s |
| ∂r/∂h at 35° look: closed form (§4.5) against a central difference | −0.771896 both; relative gap 3 × 10⁻⁸ |
| ∂t/∂h: closed form against a central difference | 3.161 × 10⁻⁷ s m⁻¹ both |
| A 47 m height error at 32.5° incidence: slant range; ground range | 39.6 m; 73.8 m = 7.4 GRD pixels |
| the same at 46.7° incidence | 32.3 m; 44.4 m = 4.4 GRD pixels |
| the same, along track | 0.015 ms of azimuth time, about 0.1 m |
| Hill 1,500 m high, σ = 1 km, 35° incidence: active, passive layover, shadow (share of hill cells) | 13.2 %, 14.8 %, 0 % |
| the same hill at 41° | 5.6 %, 5.6 %, 0 % |
| Hill 800 m, σ = 1.5 km, 35° | 0 %, 0 %, 0 % |
| Hill 2,500 m, σ = 1 km, 41° | 18.3 %, 24.3 %, 21.8 % |
| Agreement of the elementwise slope rule with ∂r/∂x ≤ 0, every case | 100 % |
| Ellipsoid γ⁰ (radiomax today) on flat bins, true γ⁰ = 1 under the area model | within 0.05 dB |
| the same on slope bins outside layover | −8.1 to +2.9 dB |
| the same on layover bins | +10.2 to +15.2 dB |
What follows from it.
Either interpolant is far below the orbit’s own accuracy. The precise orbit product (POEORB) is specified to 5 cm 3-D RMS after 20 days, and the restituted one (RESORB) to 10 cm after about 3 hours; the geocoding guide finds them within 3 cm of each other Small & Schubert, 2022. The accuracy of the annotation’s own state vectors is not stated in the sources read for this page. The chord is not usable: 102 m is ten GRD pixels. The blog post’s figure for it, ⅛ a Δt² ≈ 102 m, matches the prototype raphi-web, 2026. Lagrange’s advantage here comes from a perfectly smooth synthetic orbit; on real, noisy state vectors an 8-point polynomial may amplify the noise more than a local Hermite does, which S2’s test against the geolocation grid will show. Hermite needs two state vectors per point, Lagrange eight (SG-D2).
Newton costs a tenth of bisection and needs a derivative the Hermite read-out already gives. A fixed 6 steps covers the worst case measured with room to spare; starting from the geolocation grid’s azimuth times (SG-D3) would cut it further.
The derivatives are exact and cheap, so a JAX path does not need to differentiate through the loop: a
custom_jvpon the solve can use §4.5 directly.The vertical datum is not a refinement. A 47 m undulation moves targets by 4 to 7 pixels, more at steep incidence, which is why the blog post’s image only lined up after adding it.
Active layover needs no neighbours. The slope rule matched the profile rule on every cell, so the commonest mask is elementwise and runs anywhere. Passive layover and shadow need a whole range line (G5, G9), and both can be large: on the steep hill, a fifth of the cells.
The ellipsoid γ⁰ is wrong by up to 15 dB on a hill, while being right on flat ground: terrain flattening is the step that makes mountain scenes usable.
The prototype does not measure the area projection’s own accuracy, because its synthetic β⁰ is generated by the same area model it would invert. S5 tests it against a published terrain-flattened product instead (§13).
6 Prior art¶
| Processor | What it has | What to take | What to avoid |
|---|---|---|---|
ESA SNAP (s1tbx, now the microwave-toolbox; GPL-3.0, Java), RangeDopplerGeocodingOp, TerrainFlatteningOp | the reference processor for Sentinel-1: zero-Doppler time by bisection by default (a Newton variant exists), 8-point Lagrange orbits, terrain flattening after Small on an oversampled DEM, a layover and shadow band from SARSimulationOp; for Sentinel-1 it skips the residual bistatic correction | the processing order; its outputs as an oracle for S7 | Java, file to file; no gradients |
ISCE3 (Apache-2.0, C++ with Python bindings): geo2rdr, rdr2geo, RTC, Topo | NASA-JPL’s SAR library: geo2rdr by Newton with a finite-difference Doppler derivative and a bracketing variant; Hermite (default) or Legendre orbits; RTC by area projection or Small’s bilinear distribution; the layover and shadow mask of §4.8; the processor behind OPERA RTC-S1, which starts from SLC and applies the bistatic and static-troposphere corrections Shiroma & Fattahi, 2024 | Newton; the area projection Shiroma et al., 2022; the mask convention; OPERA’s products as an oracle for S5 | no JAX, no array-API backends |
| sarsen with xarray-sentinel (B-Open; Apache-2.0, Python) | backward geocoding and gamma flattening of Sentinel-1 on xarray and dask: zero-Doppler by secant or Newton with an analytic derivative, a degree-5 polynomial orbit, gamma areas from cross products spread with bilinear or nearest weights; xarray-sentinel reads the orbit, ground control points and srgr and grsr tables | that a Python and xarray version is practical; the reader’s field set | NumPy only, no adjoint; no layover or shadow mask was found in its source |
| pyroSAR (MIT), OST (MIT) | workflows that drive SNAP (and, for pyroSAR, GAMMA) for Sentinel-1, with layover and shadow mask options | the recipes and defaults | they wrap other processors |
| The blog post raphi-web, 2026 | geometric terrain correction of GRD in NumPy, with a test against the geolocation grid | the annotation fields used, the half-pixel convention, the geolocation grid as a test oracle | bisection; uncalibrated output; no masks or flattening |
No JAX or otherwise differentiable implementation of SAR geocoding or terrain flattening was found. The gap common to all of them is the geometry as differentiable array functions that compose with the rest of a JAX stack, and the area projection as the adjoint of the read-out rather than a second code path.
7 What it builds on¶
Each name below was read on main of its repository on 5 Dec 2026: radiomax v0.0.17, geophysix at 5837c8d, functax at 10b76c9, geotoolz at 6b4443a5, pipekit at 638267d.
| Need | Upstream name | State |
|---|---|---|
| geodetic to Earth-centred coordinates and back | geophysix.earth.geodetic_to_ecef, ecef_to_geodetic, WGS84 | today (geophysix) |
| the speed of light | geophysix.constants.STANDARD.speed_of_light | today (geophysix) |
| line of sight in the local east–north–up frame | radiomax.geometry.view_angles | today (radiomax) |
| a ray meeting the ellipsoid | radiomax.geometry.earth_intersection | today (radiomax) |
| DN to backscatter; β⁰, σ⁰, γ⁰ conversions with an incidence | radiomax.sar.dn_to_backscatter, beta0_to_sigma0, sigma0_to_gamma0 and their inverses | today (radiomax) |
| the array backend, elementwise kernels | pipekit_array.arrays.floating_inputs, pipekit_array.kernels.elementwise | today (pipekit-array) |
| a warp as a functax plan; the plan’s adjoint | geoops Reproject(engine="interp") with the private warp(gt, target, scheme, boundary, coordinates); functax.interp.Plan.adjoint | today (geoops, functax); the coordinate entry is private |
| reading a grid at points, differentiable in the points | geoops.geom.interp_at | today (geoops) |
| DEM gradients | geoops.geom.gradient_2d, geoops.mask slope_degrees | today (geoops) |
| a vertical datum label on heights | geoarray’s height coordinate, field datum | today (geoarray), a label only |
| a carrier for data in sensor geometry | geoarray.GeoSwath (data with per-pixel lat and lon on row col) | today (geoarray) |
| speckle filters | geoops.restore despeckle_lee, despeckle_refined_lee, despeckle_frost | today (geoops) |
| a cubic Hermite read-out, as a test oracle | functax.interp.HermiteFit, HermiteGeometry | today (functax), JAX only, slopes computed from the values |
| testing helpers | pipekit_array.testing.assert_matches_oracle, assert_grad_matches_fd, assert_adjoint, assert_backends_agree | today (pipekit-array) |
Gaps, each sent to the package that owns the concept.
| Gap | Owner | Why there |
|---|---|---|
| G1 to G5: orbit read-out, zero-Doppler, ranges, radar coordinates, local incidence, facet areas, layover and shadow rules | radiomax | sensor geometry and radiometry pixel by pixel, with no state to retrieve: radiomax’s placement test |
| G6: geocoding from a coordinate field, with the plan’s adjoint public | geoops | the warp already lives there, on functax plans |
| G7: geoid undulation and the datum conversion | geotoolz (geoops operator, geoarray datum) | it reads a geoid grid file and changes a carrier’s coordinate; geoarray already names the datum |
| G8: the SAFE annotation reader | geoproducts | readers and file formats are geoproducts’; algorithms take arrays |
G9: cumulative_max | pipekit-array | a helper over NumPy’s maximum.accumulate and JAX’s lax.cummax, the kind of helper the owner reserves pipekit-array for |
functax HermiteFit from given slopes | functax, optional | HermiteFit computes slopes from values; an orbit has its slopes (the velocities). Only needed if functax is to be the oracle for G1 |
What stays local. Nothing: geostack holds the prototype and, after S7, one notebook.
New dependency edges. None. radiomax keeps NumPy, geophysix and pipekit-array; geoops already imports radiomax and functax; geoproducts already imports geoarray. functax stays a test reference for radiomax, as the owner decided for integrix and functax on 23 Nov 2026.
8 Architecture¶
The chain, from files to a terrain-corrected map, with the package of each step:
Two geometries, one plan. The radar image lives on a (line, column) grid; the DEM and the output on a map grid. radiomax maps each DEM cell to fractional (line, column); geoops turns those coordinates into a functax plan H on the radar grid. H geocodes (forward), and Hᵀ carries DEM-cell quantities into radar geometry (adjoint). Everything radiometric that needs the terrain is computed per DEM cell, elementwise, and moved with Hᵀ.
The radar grid as a carrier. A GRD image in radar geometry is a GeoSwath: rows along track, columns across, with lat and lon per pixel. The reader fills lat and lon from the geolocation grid, which places the pixels on the ellipsoid, not on the terrain; the geometry records travel beside the carrier, not inside it (SG-O1).
Backends. radiomax’s functions take any array-API array and return the same kind; the Newton solve has a fixed iteration count and no data-dependent branch. The plan runs on NumPy or JAX as geoops’ Reproject(engine="interp") does today. The profile rules of G5 need cumulative_max (G9).
9 API proposal¶
Every name is proposed unless marked today. Shapes: N_v = 17 state vectors; N_Ω DEM cells (a map grid, flattened when it reads better); N_ℓ × N_j radar pixels (lines × columns); K + 1 polynomial coefficients; N_c coefficient sets in azimuth time.
Records from the reader (geoproducts, G8). A frozen record per annotation, arrays in its fields:
from dataclasses import dataclass
from jaxtyping import Array, Float
# proposed (G8)
@dataclass(frozen=True)
class S1Annotation:
# tₖ, s since the first line's UTC day start; Sₖ, Vₖ in ECEF m, m s⁻¹
orbit_time: Float[Array, " vector"]
orbit_position: Float[Array, "vector 3"]
orbit_velocity: Float[Array, "vector 3"]
# t₀, Δt (s); τ₀ (s, two-way); Δg (m)
first_line_time: float
azimuth_interval: float
slant_range_time: float
ground_spacing: float
# srgr sets: azimuth time, r₀ and cᵢ of g(r) = Σ cᵢ (r − r₀)ⁱ
srgr_time: Float[Array, " set"]
srgr_origin: Float[Array, " set"]
srgr_coefficients: Float[Array, "set coefficient"]
# geolocation grid: line, column, lat, lon, h, incidence at tie points
tie_points: dict[str, Float[Array, " point"]]The calibration and noise tables follow the same pattern and feed radiomax.sar.dn_to_backscatter (today).
Geometry (radiomax.sar, G1 to G5). Each is a free function in radiomax’s style, any array library in, the same out, ECEF components as separate arguments where radiomax does so today (view_angles):
# Shapes: N_v state vectors; N_Ω DEM cells; N_c coefficient sets; K + 1 coefficients
# proposed (G1)
# S(t), V(t), A(t) by cubic Hermite (method="hermite") or 8-point Lagrange
# (N_Ω,), (N_v,), (N_v, 3), (N_v, 3) → (N_Ω, 3), (N_Ω, 3), (N_Ω, 3)
position, velocity, acceleration = rmx.sar.orbit_state(
time, orbit_time, orbit_position, orbit_velocity, method="hermite"
)
# proposed (G2)
# t: D(t) = (S(t) − P) · V(t) = 0, Newton t ← t − D / D′, a fixed 6 steps
# (N_Ω, 3), (N_v,), (N_v, 3), (N_v, 3) → (N_Ω,)
azimuth_time = rmx.sar.zero_doppler_time(
target, orbit_time, orbit_position, orbit_velocity,
initial=None, iterations=6,
)
# proposed (G2)
# r = ‖S(t) − P‖
# (N_Ω, 3), (N_Ω, 3) → (N_Ω,)
slant = rmx.sar.slant_range(target, position)
# proposed (G2)
# g(r) = Σᵢ cᵢ (r − r₀)ⁱ with the set nearest in azimuth time
# (N_Ω,), (N_Ω,), (N_c,), (N_c,), (N_c, K + 1) → (N_Ω,)
ground = rmx.sar.ground_range(
slant, azimuth_time, srgr_time, srgr_origin, srgr_coefficients
)
# proposed (G3)
# ℓ = (t − t₀) / Δt; j = g / Δg (GRD) or (2r / c − τ₀) / Δτ (SLC)
# (N_Ω, 3), S1Annotation → (N_Ω,), (N_Ω,)
line, column = rmx.sar.radar_coordinates(target, annotation_arrays)
# proposed (G4)
# cos θ_loc = n̂_T · ℓ̂; cos ψ = n̂_T · (ℓ̂ × v̂) / ‖ℓ̂ × v̂‖
# (N_Ω, 3) ×3 → (N_Ω,), (N_Ω,)
local_incidence, projection = rmx.sar.local_angles(
target, position, velocity, terrain_normal
)
# proposed (G4)
# a_k cos θ_loc,k, zero where cos θ_loc ≤ 0
# (N_Ω,), (N_Ω,) → (N_Ω,)
projected_area = rmx.sar.gamma_area(facet_area, local_incidence)
# proposed (G5)
# active layover: slope towards the sensor ≥ look angle (elementwise)
# (N_Ω,), (N_Ω,) → (N_Ω,) bool
active_layover = rmx.sar.active_layover(local_incidence, look_angle)
# proposed (G5, needs G9)
# shadow: α < cummax α along each range line; passive layover from r's intervals
# (N_ℓ, N_x), (N_ℓ, N_x) → (N_ℓ, N_x) bool, (N_ℓ, N_x) bool
shadow, passive_layover = rmx.sar.profile_masks(look_angle_profile, range_profile)annotation_arrays is the reader’s record (or any object with its fields); radiomax does not import geoproducts.
Geocoding plan (geoops, G6). The private warp becomes public with given coordinates and returns the plan:
# Shapes: N_Ω DEM cells; N_ℓ × N_j radar pixels
# proposed (G6)
# H: (N_ℓ N_j) → N_Ω, a functax plan on the radar grid read at (ℓ, j)
# (N_Ω,), (N_Ω,) → plan
plan = geoops.geom.coordinate_plan(
radar_shape, line, column, scheme="linear", boundary="edge"
)
# today (functax)
# Hᵀ a: DEM-cell quantities into radar geometry
# (N_Ω,) → (N_ℓ N_j,)
area_gamma = plan.adjoint(projected_area)The recipe (geoops, G10). TerrainCorrect(dem, annotation, scheme="linear", flatten=True, masks=True), an Operator from a GeoSwath of DN in radar geometry to a GeoArray on the DEM grid with bands γ⁰_T (or σ⁰ without flattening), the local incidence angle and a layover and shadow bitmask.
10 Usage examples¶
From a GRD scene and a DEM tile to γ⁰ on the DEM grid. Every name is marked; today names were checked on the repositories’ main. In the block, dem is a one-band GeoArray of orthometric heights H; λ, φ and h are each DEM cell’s longitude, latitude and ellipsoidal height, flattened to N_Ω; P stacks the cells’ ECEF coordinates; aₖ and θ_loc are the facet areas and local incidence angles of §4.6 and §4.7, from the S5 functions of §9; A_β is the radar pixel area of §4.7; and the other symbols are those of §4.
import geoops
import geophysix as gpx
import geoproducts
import radiomax as rmx
from einx import id as rearrange
# Shapes: N_Ω DEM cells; N_ℓ × N_j radar pixels
# proposed (G8)
annotation, dn_swath, calibration = geoproducts.sentinel1.read_grd(safe_path, pol="VV")
# proposed (G7)
# h = H + N_g(λ, φ)
dem_ellipsoidal = geoops.geom.ToEllipsoidal(geoid="egm2008")(dem)
# today (geophysix)
# P = ((N + h) cos φ cos λ, (N + h) cos φ sin λ, (N(1 − e²) + h) sin φ)
# (N_Ω,) ×3 → (N_Ω,) ×3
target_x, target_y, target_z = gpx.earth.geodetic_to_ecef(lon, lat, height)
# P, one row per cell
# (N_Ω,) ×3 → (N_Ω, 3)
target = rearrange("cell, cell, cell -> cell (1 + 1 + 1)", target_x, target_y, target_z)
# proposed (G3)
# (ℓ, j) of every DEM cell
# (N_Ω, 3) → (N_Ω,), (N_Ω,)
line, column = rmx.sar.radar_coordinates(target, annotation)
# today (radiomax)
# β⁰ = (DN / A_β)²
# (N_ℓ, N_j) → (N_ℓ, N_j)
beta0 = rmx.sar.dn_to_backscatter(dn_swath.data, calibration.beta)
# proposed (G6)
# H: radar grid → DEM cells
plan = geoops.geom.coordinate_plan(beta0.shape, line, column, scheme="linear")
# proposed (G4)
# a_k cos θ_loc,k
# → (N_Ω,)
projected_area = rmx.sar.gamma_area(facet_area, local_incidence)
# today (functax)
# A_γ = Hᵀ (a ⊙ cos θ_loc)
# (N_Ω,) → (N_ℓ N_j,)
area_gamma = plan.adjoint(projected_area)
# user
# γ⁰_T = H (β⁰ A_β / A_γ)
# (N_ℓ N_j,) → (N_Ω,)
gamma0_terrain = plan(beta0.ravel() * pixel_area_beta / area_gamma)11 Decisions¶
Proposed; each awaits the owner.
SG-D1, the geometry is radiomax’s. The orbit read-out, zero-Doppler solve, ranges, radar coordinates, local angles, facet areas and layover and shadow rules go into radiomax.sar, beside the calibration. They pass radiomax’s placement test (geometry and unit conversion, no radiative transfer, no state), and radtrax, geoops and vardax can all reach radiomax.
SG-D2, Hermite by default, Lagrange as an option. Both are far below the orbit’s accuracy (§5); Hermite uses two state vectors and the velocities the annotation gives; Lagrange matches SNAP for oracle tests. The read-out is written in radiomax with its own four-tap stencil, because functax’s HermiteFit needs JAX and radiomax must run without it; functax checks it in the tests.
SG-D3, Newton with a fixed count. Six Newton steps with the exact D′, starting from the geolocation grid’s azimuth time interpolated to the target when given, otherwise from the middle of the orbit table, and clipped to the table. Under JAX, a custom_jvp uses §4.5 so the gradient does not unroll the loop.
SG-D4, geocoding is a functax plan made by geoops. geoops exposes coordinate_plan, the existing warp’s construction with the source coordinates given, and returns the plan, so both H and Hᵀ are public. No new interpolation code.
SG-D5, the datum is converted before geometry. radiomax takes ellipsoidal heights only and says so; geoops gains ToEllipsoidal, which reads the geoid grid through pyproj and honours geoarray’s datum label, refusing a DEM without one.
SG-D6, flattening by area projection through the adjoint. γ⁰_T = H(β⁰ A_β ⊘ Hᵀ(a ⊙ cos θ_loc)), with Ulander’s cos ψ (§4.6) as the cheap option for scenes without layover. Facet areas and normals come from the ellipsoidal DEM in ECEF, per cell.
SG-D7, the masks. Active layover by the elementwise slope rule; passive layover and shadow by the profile rules on range lines, with cumulative_max from pipekit-array. The output is one bitmask band in ISCE3’s convention (1 shadow, 2 layover, 3 both), so it compares directly with OPERA’s mask layer.
SG-D8, the reader returns arrays. geoproducts parses the SAFE annotation, calibration and noise XML into records of arrays and a GeoSwath of DN; no algorithm parses XML.
SG-D9, no SAR state in the carrier. The geometry records travel beside the GeoSwath, not in its attrs, so the carrier stays generic (see SG-O1).
12 Open questions¶
| ID | Question | Recommendation |
|---|---|---|
| SG-O1 | Should a radar-geometry carrier (GeoRadar, a GeoSwath with the timing and orbit) exist in geoarray? | Not yet: records beside a GeoSwath until a second SAR sensor needs the same shape. |
| SG-O2 | The range polynomial: nearest set in azimuth time, or interpolate the coefficients? | Nearest, as the blog post and SNAP’s GRD path do, then measure the difference against the geolocation grid in S2. |
| SG-O3 | Thermal-noise removal (subtracting the noise table’s η in intensity before calibration): radiomax or the reader? | radiomax, as an optional noise= argument to dn_to_backscatter; it is arithmetic on tables, and dn_to_backscatter’s docstring now leaves it to the reader. |
| SG-O4 | Precise orbit files (POEORB, RESORB): a geoproducts reader now, or annotation orbits only? | Annotation orbits first, measuring them against the geolocation grid in S2; a POEORB reader in geoproducts if that test shows an error near a pixel. |
| SG-O5 | When do the sub-pixel corrections (troposphere, residual timing, tides) enter? | The static troposphere first if S7 shows a range bias against SNAP or OPERA, since it is the largest at 3 to 4 m; the rest with SLC and interferometry (§3). |
| SG-O6 | Should radiomax.retrievals gain the CMOD5.N geophysical model function, σ⁰ to ocean wind speed Hersbach, 2010? | Yes if sesmax or an ocean user asks; it is an empirical formula with fitted coefficients applied per pixel, radiomax’s other placement case. |
13 Steps¶
Each step is one issue in the repository whose code changes, linked as a sub-issue of one epic in jejjohnson/geostack. S1, S2 and S8 can start in parallel.
| Step | Repo | Work | Oracle | Gate |
|---|---|---|---|---|
| S1 | geoproducts | sentinel1 reader: S1Annotation, calibration and noise tables, DN as a GeoSwath | a small synthetic SAFE fixture; field-by-field against the XML | SG-D8 |
| S2 | radiomax | G1 to G3: orbit_state, zero_doppler_time, slant_range, ground_range, radar_coordinates | §5’s numbers; the geolocation grid’s (line, column) from its (lat, lon, h) to a tenth of a pixel; the delay c τ / 2 against the range; assert_backends_agree, assert_grad_matches_fd | SG-D1, SG-D2, SG-D3, SG-O2 |
| S3 | geoops | G6: coordinate_plan, public; Reproject(engine="interp") built on it | the existing warp tests unchanged; assert_adjoint on the plan | SG-D4 |
| S4 | geoops, geoarray | G7: ToEllipsoidal with pyproj’s geoid grids | known undulations at a few points from the geoid model’s own tables | SG-D5 |
| S5 | radiomax | G4: local_angles, facet_area, gamma_area; flat-ground identity γ⁰_T = β⁰ tan θ | flat terrain to rounding; Ulander’s and Small’s normalisations agree outside layover on a synthetic hill; an OPERA RTC-S1 tile over relief, as a notebook in geostack | SG-D6, S2, S3 |
| S6 | radiomax | G5: active_layover, profile_masks | §5’s hill fractions; the slope rule against the profile rule | SG-D7, S8 |
| S7 | geoops, geostack | G10: TerrainCorrect; a notebook on one subsampled scene | SNAP’s terrain-corrected output on the same scene, by eye and by a histogram of differences | S1 to S6 |
| S8 | pipekit-array | G9: cumulative_max | NumPy maximum.accumulate; JAX lax.cummax | none |
Later, not filed now: POEORB reader (SG-O4), thermal-noise removal (SG-O3), CMOD5.N (SG-O6), SLC and bursts.
14 What it does not do¶
| Not here | Where instead |
|---|---|
| scene, DEM and orbit search and download | geocatalog and geocloud |
| speckle filtering, multilooking | geoops (restore, Resize) |
| interferometry, polarimetric decompositions, SLC burst assembly | a later design |
| water, flood or change detection thresholds | geoops masks, or a user’s recipe |
| radiative transfer of microwaves through a medium | radtrax, if ever |
15 References¶
The stack repositories were read on 5 Dec 2026 at the commits in §7. The papers and documents are cited from references.bib and listed by MyST at the end of the page; each DOI was resolved on 5 Dec 2026. Small (2011) and Ulander (1996) were not read in full: their formulas here are as the OPERA RTC-S1 algorithm document restates them.
Processors, read on their default branches on 5 Dec 2026:
SNAP microwave-toolbox, senbox
-org /microwave -toolbox (s1tbx, senbox-org/s1tbx, is archived). ISCE3, isce
-framework /isce3. sarsen, bopen/sarsen, and xarray-sentinel, bopen
/xarray -sentinel. pyroSAR, johntruckenbrodt
/pyroSAR; OST, ESA -PhiLab /OpenSarToolkit. Sentinel-1 documents, including the Level-1 Product Specification (S1-RS-MDA-52-7441, whose annotation fields §9 uses), on SentiWiki.
- raphi-web. (2026). I am scared of SAR: terrain correcting Sentinel-1 GRD. Blog post. https://raphi-web.github.io/sar_terrain_correction/
- Small, D. (2011). Flattening Gamma: Radiometric Terrain Correction for SAR Imagery. IEEE Transactions on Geoscience and Remote Sensing, 49(8), 3081–3093. 10.1109/TGRS.2011.2120616
- Small, D., & Schubert, A. (2022). Guide to Sentinel-1 Geocoding (Techreport UZH-S1-GC-AD, issue 1.12). University of Zurich, Remote Sensing Laboratories. https://sentinels.copernicus.eu/documents/247904/1653442/Guide-to-Sentinel-1-Geocoding.pdf
- Gisinger, C., Schubert, A., Breit, H., Garthwaite, M., Balss, U., Willberg, M., Small, D., Eineder, M., & Miranda, N. (2021). In-Depth Verification of Sentinel-1 and TerraSAR-X Geolocation Accuracy Using the Australian Corner Reflector Array. IEEE Transactions on Geoscience and Remote Sensing, 59(2), 1154–1181. 10.1109/TGRS.2019.2961248
- Airbus Defence and Space. (2022). Copernicus DEM Product Handbook (Techreport GEO.2018-1988-2, version 5.0). Airbus Defence. https://dataspace.copernicus.eu/sites/default/files/media/files/2024-06/geo1988-copernicusdem-spe-002_producthandbook_i5.0.pdf
- Pavlis, N. K., Holmes, S. A., Kenyon, S. C., & Factor, J. K. (2012). The development and evaluation of the Earth Gravitational Model 2008 (EGM2008). Journal of Geophysical Research: Solid Earth, 117(B4). 10.1029/2011JB008916
- Ulander, L. M. H. (1996). Radiometric slope correction of synthetic-aperture radar images. IEEE Transactions on Geoscience and Remote Sensing, 34(5), 1115–1122. 10.1109/36.536527
- Shiroma, G. H. X., & Fattahi, H. (2024). OPERA Radiometric Terrain-Corrected SAR Backscatter from Sentinel-1 (RTC-S1): Algorithm Theoretical Basis Document (Techreport JPL D-107393, version 1.0). Jet Propulsion Laboratory, California Institute of Technology. https://cumulus.asf.earthdatacloud.nasa.gov/PUBLIC/DATA/OPERA/D-107393_OPERA_RTC-S1_ATBD_Initial_2024-06-25_wsigs.pdf
- Shiroma, G. H. X., Lavalle, M., & Buckley, S. M. (2022). An Area-Based Projection Algorithm for SAR Radiometric Terrain Correction and Geocoding. IEEE Transactions on Geoscience and Remote Sensing, 60, 1–23. 10.1109/TGRS.2022.3147472
- Hersbach, H. (2010). Comparison of C-Band Scatterometer CMOD5.N Equivalent Neutral Winds with ECMWF. Journal of Atmospheric and Oceanic Technology, 27(4), 721–736. 10.1175/2009JTECHO698.1