Hello step-forum community,
I’m want to replicate the RUS webinar: Rapid Landslide Detection with Sentinel-1 - HAZA07 using snappy. With the script below I’m trying to apply the S-1 TOPS ESD Coregistration step (22:17 - 27:46). When I run the script, python gets stuck on writing the output. There are no error messages returned. Instead, I’m forced to close/reset the console after waiting an hour. In contrast, the snap GUI completes coregistration in a few seconds.
I’m new to snappy, so I could be using incorrect parameters for the snappy objects or that the order of my workflow is wrong.
What do you think is happening?
Thanks for your help!
import os
import snappy
from glob import iglob
from os.path import join
# Read
product_path = '/home/huw/Documents/insar/iceland/original/'
input_S1_files = sorted(list(iglob(join(product_path, '**', '*S1*.zip'),
recursive=True)))
pre_landslide_s1 = snappy.ProductIO.readProduct(input_S1_files[0])
post_landslide_s1 = snappy.ProductIO.readProduct(input_S1_files[1])
def topsar_split(product_s1):
parameters = snappy.HashMap()
parameters.put('subswath', 'IW2')
parameters.put('selectedPolarisations', 'VV')
parameters.put('firstBurstIndex', 6)
parameters.put('lastBurstIndex', 7)
topsar = snappy.GPF.createProduct('TOPSAR-Split',
parameters,
product_s1)
return topsar
pre_landslide_topsar = topsar_split(pre_landslide_s1)
post_landslide_topsar = topsar_split(post_landslide_s1)
def apply_orbital_file(product_topsar):
parameters = snappy.HashMap()
parameters.put('orbitType', 'Sentinel Precise (Auto Download)')
parameters.put('polyDegree', 3)
orbital = snappy.GPF.createProduct('Apply-Orbit-File',
parameters,
product_topsar)
return orbital
pre_landslide_orbital = apply_orbital_file(pre_landslide_topsar)
post_landslide_orbital = apply_orbital_file(post_landslide_topsar)
# Back-Geocoding
parameters = snappy.HashMap()
parameters.put('demName', 'GETASSE30 (Auto Download)')
parameters.put('demResamplingMethod', 'BILINEAR_INTERPOLATION')
parameters.put('resamplingType', 'BILINEAR_INTERPOLATION')
parameters.put('maskOutAreaWithoutElevation', True)
parameters.put('outputDerampDemodPhase', True)
landslide_geocoding = snappy.GPF.createProduct('Back-Geocoding',
parameters,
[pre_landslide_orbital,
post_landslide_orbital])
# Enhanced-Spectral-Diversity
parameters = snappy.HashMap()
landslide_esd = snappy.GPF.createProduct('Enhanced-Spectral-Diversity',
parameters,
landslide_geocoding)
# Write
os.chdir(r'/home/huw/Documents/insar_test/Processing')
snappy.ProductIO.writeProduct(landslide_geocoding,
'S1A_IW2_SLC__1SDV_20180623_20180717_Orb_Stack.dim',
'BEAM-DIMAP')