1

I would like to batch process Sentinel-1 images in Python.

Previously I have used SNAP (Sentinel-1 Toolbox) to apply Calibration, Multilooks, Speckle Filters, Terrain Correction and then export as a GeoTiff, using 'Batch Processing'. This is reasonably good, but quite clunky, and can take a long time if there are a large amount of images.

To speed the process up, I have started using the sentinelsat API to batch download Sentinel-1, as opposed to individually downloading imagery from the Sci-hub. Therefore, it would be helpful if i was able to batch process these images without having to load them all into SNAP .

My question is: Is there a pythonic way to read the manifest.safe files from the zipped Sentinel-1 folders and apply pre-processing parameters (I.e. Calibration, Multilooking, Terrain Correction etc etc) and exporting as a Geotiff using Open Sourced Python libraries?

  • Has my answer solved your problem? – Ali Jun 21 at 15:44
  • Partly. The GPT command line interface is useful, though i cannot terrain correct my Sentinel-1 products due to a time-out error. Has this ever occurred for you? Initially i thought it was a proxy issue, but this is not the case. It may be worth me posting another question for this particular issue – Rhodri_22 Jun 24 at 7:34
  • When using the Terrain-Correction tool it will attempt to download the corresponding SRTM 3Sec DEM tile for your product. If it's timing out during this download you can manually download the DEM tile zip file and put it in your snap user folder /.snap/auxdata/dem/SRTM 3Sec. Tiles can be downloaded from dwtkns.com/srtm – Ali Jun 24 at 8:44
2

ESA's SNAP software does have a Python API which you can set up by following these instructions.

Additionally, in your SNAP bin directory you'll find the Graph Processing Tool executable. This provides a command line interface to the operators available in the SNAP GUI. Further, you can create your own graphs depending on your workflow and specify your parameters.

You can then run the GPT from python via the subprocess module:

import subprocess as sp

gpt = r'your_gpt_path' # If it is in your PATH environment variable you can just use 'gpt'
graph_path = r'your_graph.xml'

cmd_pts = [gpt,
            graph_path,
            '-PyourParameter1="{}"'.format(yourVal1),
            '-PyourParameter2="{}"'.format(yourVal2)]

sp.check_call(cmd_pts)

This tutorial gives an intro to using GPT. For a demonstration of usage including creating your own graphs and bash scripts for batch processing see this recorded webinar.

  • Partly. The GPT command line interface is useful, though i cannot terrain correct my Sentinel-1 products due to a time-out error. Has this ever occurred for you? Initially i thought it was a proxy issue, but this is not the case. It may be worth me posting another question for this particular issue – Rhodri_22 Jun 24 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.