Preprocessing of Sentinel-1 SAR data via Snappy Python module

Preprocessing of Sentinel-1 SAR data via Snappy Python module

m

August 1, 2016

This chapter demonstrates the Snappy Python module for the automatization of the ESA SNAP tool.

Code examples will be shown for an automated processing chain for the preprocessing of Sentinel-1 SAR data including Calibration, Subsetting and Terrain Correction of GRD (Ground Range Detected data).

A detailed installation tutorial for snappy can be found here: https://senbox.atlassian.net/wiki/display/SNAP/How+to+use+the+SNAP+API+from+Python

First, import the needed Python modules:

 

import snappy

from snappy import ProductIO
from snappy import HashMap

import os, gc   
from snappy import GPF

GPF.getDefaultInstance().getOperatorSpiRegistry().loadOperatorSpis()
HashMap = snappy.jpy.get_type('java.util.HashMap')

Now loop through all Sentinel-1 data sub folders that are located within a super folder (of course, make sure, that the data is already unzipped):

path = "D:SENTINEL"
 for folder in os.listdir(path):

   gc.enable()
   
   output = path + folder + ""  
   timestamp = folder.split("_")[4] 
   date = timestamp[:8]

Then, read in the Sentinel-1 data product:

   sentinel_1 = ProductIO.readProduct(output + "manifest.safe")    
   print sentinel_1

If polarization bands are available, spolit up your code to process VH and VV intensity data separately. The first step is the calibration procedure by transforming the DN values to Sigma Naught respectively. You can specify the parameters to output the Image in Decibels as well.

   pols = ['VH','VV'] 
   for p in pols:  
      polarization = p    
    
      ### CALIBRATION
  
      parameters = HashMap() 
      parameters.put('outputSigmaBand', True) 
      parameters.put('sourceBands', 'Intensity_' + polarization) 
      parameters.put('selectedPolarisations', polarization) 
      parameters.put('outputImageScaleInDb', False)  

      calib = output + date + "_calibrate_" + polarization 
      target_0 = GPF.createProduct("Calibration", parameters, sentinel_1) 
      ProductIO.writeProduct(target_0, calib, 'BEAM-DIMAP')

Next, specify a subset AOI to reduce the data amount and processing time. The AOI specified by its outer polygon corners and is formatted through a Well Known Text (WKT).

      ### SUBSET

      calibration = ProductIO.readProduct(calib + ".dim")    
      WKTReader = snappy.jpy.get_type('com.vividsolutions.jts.io.WKTReader')

      wkt = "POLYGON((12.76221 53.70951, 12.72085 54.07433, 13.58674 54.07981, 
                      13.59605 53.70875, 12.76221 53.70951))"

      geom = WKTReader().read(wkt)

      parameters = HashMap()
      parameters.put('geoRegion', geom)
      parameters.put('outputImageScaleInDb', False)

      subset = output + date + "_subset_" + polarization
      target_1 = GPF.createProduct("Subset", parameters, calibration)
      ProductIO.writeProduct(target_1, subset, 'BEAM-DIMAP')

Apply a Range Doppler Terrain Correction to correct for layover and foreshortening effects, by using the SRTM 3 arcsecond product (90m) that is downloaded automatically. You could also specify an own DEM product with a higher spatial resolution from a local path:

      ### TERRAIN CORRECTION
 
      parameters = HashMap()     
      parameters.put('demResamplingMethod', 'NEAREST_NEIGHBOUR') 
      parameters.put('imgResamplingMethod', 'NEAREST_NEIGHBOUR') 
      parameters.put('demName', 'SRTM 3Sec') 
      parameters.put('pixelSpacingInMeter', 10.0) 
      parameters.put('sourceBands', 'Sigma0_' + polarization)
 
      terrain = output + date + "_corrected_" + polarization 
      target_2 = GPF.createProduct("Terrain-Correction", parameters, subset) 
      ProductIO.writeProduct(target_2, terrain, 'GeoTIFF')

Fergana_Sentinel

follow us and share it on:

you may also like:

UAS analysis of fire and drought stress under controlled conditions

UAS analysis of fire and drought stress under controlled conditions

New update from the field work of our PhD researcher Luisa Pflumm in Kruger National Park! After weeks of fieldwork in the open savanna, Luisa's work now moves into a more controlled setting, a burn chamber experiment carried out together with our collaborators from...

Welcome, Prof. Dr. Stefan Dech!

Welcome, Prof. Dr. Stefan Dech!

Big news at the EORC: as of today, October 1st, 2026, Stefan Dech is officially a senior professor at the University of Würzburg, and he's staying right where he belongs, with us at the EORC. Stefan will keep working with us on a whole range of Earth Observation...

EO4CAM Meeting with LfU and StMUV at DLR

EO4CAM Meeting with LfU and StMUV at DLR

On 30 September 2026, representatives from the Bavarian State Ministry of the Environment and Consumer Protection (StMUV), the Bavarian Environment Agency (LfU), the EORC of the University Würzubrg (JMU), and the...

Field campaign for DFG Fire and Savanna project

Field campaign for DFG Fire and Savanna project

Our PhD candidate Luisa Pflumm is back in Kruger National Park for her third field campaign. Her PhD focuses on how savanna trees respond to combined fire and drought stress for which she is flying UAVs equipped with multispectral and LiDAR sensors. With this round of...

Successful MSc Defense by Henning Riecken

Successful MSc Defense by Henning Riecken

Congratulations to Henning Riecken, who successfully defended his MSc thesis on September 28, 2026: "Mapping and Structural Assessment of Woody Vegetation in Bavaria Using Digital Elevation Models and Multisource Geodata" Henning's thesis explores how newly available...

bzgl. Art. 50 Verordnung (EU) 2024/1689 (AI Act):

Überwiegend werden eigene originäre Texte und Bilder des EORC genutzt, jedoch sind einige Inhalte von blog post Texten teilweise mit Hilfe von KI überarbeitet worden und einige Bilder sind ganz mit KI erstellt, die jedoch deutlich keine photorealistische Darstellungen abbilden. Aussnahmen sind KI generierte fernerkundliche Datensätze, die explizit für Forschungszwecke mit KI erstellt wurden, hier wird aber durch den assoziierten Text der wissenschaftliche Grund der KI generierten Bilder erläutert.

Share This