Co-registration in snappy doesn't work



Recently, I’ve been working with snappy for co-registration of two images (Sentinel-1).
Although, I can run Calibration, TOPO Deburst, and Apply Orbit File in my python script.

I cannot run co-register the images.
I use the following sequence.

  • CreateStack
  • Cross-correlation
  • Warp

In the cross-correlation step, I get this massages: “no matching Java method overloads found”
However, when I run the “get_snap_info” function I get:

Your help will be very much appreciated.

SPI name: org.esa.s1tbx.insar.gpf.coregistration.CrossCorrelationOp
SPI alias: Cross-Correlation
- params name=numGCPtoGenerate; alias=None
- params name=coarseRegistrationWindowWidth; alias=None
- params name=coarseRegistrationWindowHeight; alias=None
- params name=rowInterpFactor; alias=None
- params name=columnInterpFactor; alias=None
- params name=maxIteration; alias=None
- params name=gcpTolerance; alias=None
- params name=applyFineRegistration; alias=None
- params name=inSAROptimized; alias=None
- params name=fineRegistrationWindowWidth; alias=None
- params name=fineRegistrationWindowHeight; alias=None
- params name=fineRegistrationWindowAccAzimuth; alias=None
- params name=fineRegistrationWindowAccRange; alias=None
- params name=fineRegistrationOversampling; alias=None
- params name=coherenceWindowSize; alias=None
- params name=coherenceThreshold; alias=None
- params name=useSlidingWindow; alias=None
- params name=computeOffset; alias=None
- params name=onlyGCPsOnLand; alias=None

Python script

from snappy import GPF
from snappy import ProductIO
from snappy import HashMap

def read_sar(filename):
    return ProductIO.readProduct(filename)

def write_dim(product, filename):
    ProductIO.writeProduct(product, filename, "BEAM-DIMAP")

def calibration(product):
    parameters = HashMap()
    parameters.put('outputSigmaBand', True)
    return GPF.createProduct("Calibration",parameters,product)

def topsar_deburst(product):
    parameters = HashMap()
    return GPF.createProduct("TOPSAR-Deburst",parameters,product)

def apply_orbit_file(product):
    parameters = HashMap()
    parameters.put("Orbit State Vectors", "Sentinel Precise (Auto Download)")
    parameters.put("Polynomial Degree", 3)    
    return GPF.createProduct("Apply-Orbit-File",parameters,product)

def get_snap_info(operator):
    Returns information about SNAP operators and their parameters
    SPI = GPF.getDefaultInstance().getOperatorSpiRegistry().getOperatorSpi(operator)
    if SPI == None:
        print(" *** %s not found ***"%(operator))
        print('SPI name:', SPI.getOperatorDescriptor().getName())
        print('SPI alias:', SPI.getOperatorDescriptor().getAlias()) 
        for param in SPI.getOperatorDescriptor().getParameterDescriptors():
            print(' - params name=%s; alias=%s'%(param.getName(),param.getAlias()))

HashMap = jpy.get_type('java.util.HashMap')

# Loading SAR data
sar_t1 = read_sar(products[0])
sar_t0 = read_sar(products[1])

# Calibration
sar_t1_cal = calibration(sar_t1)
sar_t0_cal = calibration(sar_t0)

# TOPOSAR Deburst
sar_t1_cal_deb = topsar_deburst(sar_t1_cal)
sar_t0_cal_deb = topsar_deburst(sar_t0_cal)

# Orbit file
sar_t1_cal_deb_orb = apply_orbit_file(sar_t1_cal_deb)
sar_t0_cal_deb_orb = apply_orbit_file(sar_t0_cal_deb)

# Terrain correction
sar_t1_cal_deb_orb_TC = terrain_correction(sar_t1_cal_deb_orb)
sar_t0_cal_deb_orb_TC = terrain_correction(sar_t0_cal_deb_orb)

# Stack creation
parameters = HashMap()
sarlist = [sar_t0_cal_deb_orb_TC,sar_t1_cal_deb_orb_TC]
stack = GPF.createProduct("CreateStack",parameters,sarlist)

# Cross-correlation
parameters = HashMap()
gcp = GPF.createProduct("Cross-Correlation",stack)


The second parameter is missing. The parameters map. This should do it.

gcp = GPF.createProduct("Cross-Correlation", parameters, stack)


Many thanks for your quick help.

Yes, I successfully the cross-correlation.
However, now I can not find a solution to the Warp step shows an error, which I cannot solve.

Again, your help will be very much appreciated.

This is my python script (continuation)

parameters = HashMap()
parameters.put('interpolationMethod','Cubic convolution (6 points)')
wrap = GPF.createProduct("Warp",parameters,gcp)

This is the error message

RuntimeError                              Traceback (most recent call last)
<ipython-input-24-54ad69ee13c5> in <module>()
      6 parameters.put('warpPolynomialOrder',1)
      7 parameters.put('interpolationMethod','Cubic convolution (6 points)')
----> 8 wrap = GPF.createProduct("Warp",parameters,gcp)
      9 print('- Wrap image created: %f sec'%(time.time()-start))

RuntimeError: org.esa.snap.core.gpf.OperatorException: Operator 'WarpOp': Value for 'Significance Level for Outlier Removal' must be of type 'float'.


The problem is that the python value ‘0.05’ is a double-precision data type.
The Warp expects a single precision float value.
You can either remove the parameter rmsThreshold, because ‘0.05’ is the default, or you do the following:

Float = jpy.get_type('java.lang.Float')
parameters.put('rmsThreshold', Float(0.05))

I haven’t tried it, but I think this will work.

Undersample error using snappy


Thank for your help.
Yes, the issue was in setting the parameter for “rmsThreshold”
I have tried your advice but changing from 0.05 to ‘0.05f’ seems to work fine.



Ah, good that this works too. I didn’t know.


A post was split to a new topic: Error ‘0’ when using coregistration


thanks Marco Peters