Skip to content

RTC issues #85

@priit111

Description

@priit111

As a short introduction, I tried running the top of sarsen main branch to generate RTC images, however I got poor results discussed further in the post:

Commits and test datasets

xarray-sentinel - 368df813c16ebf4483fdd4859cf79ca8f4f7a046
sarsen - a94b10c

s1 dataset - S1A_IW_GRDH_1SDV_20250925T052658_20250925T052723_061140_079F46_115A.SAFE
dem - Copernicus_DSM_COG_10_N47_00_E011_00_DEM.tif

The code used to run tests

import sarsen
import xarray_sentinel.version


print("sarsen version = {}".format(sarsen.__version__))
print("xarray-sentinel version = {}".format(xarray_sentinel.__version__))



path_grd = "/home/priit/SAR/s1/S1A_IW_GRDH_1SDV_20250925T052658_20250925T052723_061140_079F46_115A.SAFE"
ds = sarsen.Sentinel1SarProduct(path_grd, measurement_group="IW/VV")

dem = "/home/priit/.snap/auxdata/dem/Copernicus 30m Global DEM/Copernicus_DSM_COG_10_N47_00_E011_00_DEM.tif"

sarsen.terrain_correction(ds, dem, interp_method="linear", output_urlpath="sarsen_s1_rtc.tif" , correct_radiometry="gamma_bilinear", simulated_urlpath="sarsen_s1_sim.tif")

Running the code produces a warning like this:

/home/priit/anaconda3/envs/SARSEN_MAIN/lib/python3.12/site-packages/dask/_task_spec.py:759: RuntimeWarning: divide by zero encountered in divide
  return self.func(*new_argspec)

This is due to division by the simulated data points, I provided here a small picture of the simulated imaged I generated and I marked all 0 points with color RED, to the best of my knowledge the simulated image should not have any 0 data points at all.

Image

Visual comparsion to SNAP 12.01

SNAP operators: calibration -> RTF -> TC. I used Cop Dem 30m, but otherwise all settings we left to default:

sarsen generated image
Image

snap generated image
Image

Sarsen image is also defective due the zero divison described above as some pixels are infinity values, but otherwise it is looking at the same area with the same pixel color scaling. And clearly the SNAP image looks better.

Potential causes/issues/discussion points:

  1. DEM issue? For ease of use I just used the same Cop Dem 30m downloaded by SNAP for running sarsen. But this should generated the 0 pixel value problem in the simulated image.
  2. Some software setting issue_
  3. Some sort of bug/issue with my installation? For reference, I will put my conda installation list here:
# packages in environment at /home/priit/anaconda3/envs/SARSEN_MAIN:
#
# Name                     Version                    Build            Channel
_libgcc_mutex              0.1                        main
_openmp_mutex              5.1                        1_gnu
affine                     2.4.0                      pypi_0           pypi
annotated-types            0.7.0                      pypi_0           pypi
attrs                      25.4.0                     pypi_0           pypi
bzip2                      1.0.8                      h5eee18b_6
ca-certificates            2025.9.9                   h06a4308_0
certifi                    2025.10.5                  pypi_0           pypi
click                      8.3.0                      pypi_0           pypi
click-plugins              1.1.1.2                    pypi_0           pypi
cligj                      0.7.2                      pypi_0           pypi
cloudpickle                3.1.1                      pypi_0           pypi
dask                       2025.9.1                   pypi_0           pypi
elementpath                5.0.4                      pypi_0           pypi
expat                      2.7.1                      h6a678d5_0
flox                       0.10.7                     pypi_0           pypi
fsspec                     2025.9.0                   pypi_0           pypi
ld_impl_linux-64           2.44                       h153f514_2
libffi                     3.4.4                      h6a678d5_1
libgcc-ng                  11.2.0                     h1234567_1
libgomp                    11.2.0                     h1234567_1
libstdcxx-ng               11.2.0                     h1234567_1
libuuid                    1.41.5                     h5eee18b_0
libxcb                     1.17.0                     h9b100fa_0
libzlib                    1.3.1                      hb25bd0a_0
locket                     1.0.0                      pypi_0           pypi
markdown-it-py             4.0.0                      pypi_0           pypi
mdurl                      0.1.2                      pypi_0           pypi
ncurses                    6.5                        h7934f7d_0
numpy                      2.3.3                      pypi_0           pypi
numpy-groupies             0.11.3                     pypi_0           pypi
openssl                    3.0.18                     hd6dcaed_0
packaging                  25.0                       pypi_0           pypi
pandas                     2.3.3                      pypi_0           pypi
partd                      1.4.2                      pypi_0           pypi
pip                        25.2                       pyhc872135_0
pthread-stubs              0.3                        h0ce48e5_1
pydantic                   2.12.1                     pypi_0           pypi
pydantic-core              2.41.3                     pypi_0           pypi
pygments                   2.19.2                     pypi_0           pypi
pyparsing                  3.2.5                      pypi_0           pypi
pyproj                     3.7.2                      pypi_0           pypi
python                     3.12.11                    h22baa00_0
python-dateutil            2.9.0.post0                pypi_0           pypi
pytz                       2025.2                     pypi_0           pypi
pyyaml                     6.0.3                      pypi_0           pypi
rasterio                   1.4.3                      pypi_0           pypi
readline                   8.3                        hc2a1206_0
rich                       14.2.0                     pypi_0           pypi
rioxarray                  0.19.0                     pypi_0           pypi
sarsen                     0.9.6.dev4+ga94b10c68      pypi_0           pypi
scipy                      1.16.2                     pypi_0           pypi
setuptools                 80.9.0                     py312h06a4308_0
shellingham                1.5.4                      pypi_0           pypi
six                        1.17.0                     pypi_0           pypi
sqlite                     3.50.2                     hb25bd0a_1
tk                         8.6.15                     h54e0aa7_0
toolz                      1.0.0                      pypi_0           pypi
typer                      0.19.2                     pypi_0           pypi
typing-extensions          4.15.0                     pypi_0           pypi
typing-inspection          0.4.2                      pypi_0           pypi
tzdata                     2025.2                     pypi_0           pypi
wheel                      0.45.1                     py312h06a4308_0
xarray                     2025.10.1                  pypi_0           pypi
xarray-sentinel            0.9.6rc2.dev23+g368df813c  pypi_0           pypi
xmlschema                  4.2.0                      pypi_0           pypi
xorg-libx11                1.8.12                     h9b100fa_1
xorg-libxau                1.0.12                     h9b100fa_0
xorg-libxdmcp              1.1.5                      h9b100fa_0
xorg-xorgproto             2024.1                     h5eee18b_1
xz                         5.6.4                      h5eee18b_1
zlib                       1.3.1                      hb25bd0a_0

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