coregister Sentinel-1 with SNAP Python api

Set your master and slave product

Step 1: install the python snappy library

cd /home/user/snap/bin

./snappy-conf /usr/bin/python /home/user/snappy/

Step 2: run the python code below

import os, datetime, glob
import gc
import snappy
from sentinelsat import SentinelAPI, geojson_to_wkt, read_geojson
from snappy import ProductIO

# Get snappy Operators
snappy.GPF.getDefaultInstance().getOperatorSpiRegistry().loadOperatorSpis()
# HashMap Key-Value pairs
HashMap = snappy.jpy.get_type('java.util.HashMap')
gc.enable()

master_prod = ProductIO.readProduct("/home/user/../terr_20181020T225310.dim")
slave_prod = ProductIO.readProduct("/home/user/../terr_20181121T111129.dim")

# set products
sourceProducts = HashMap()
sourceProducts.put('masterProduct', master_prod)
sourceProducts.put('slaveProduct', slave_prod)

parameters = HashMap()

outFile = "/home/users/../output.dim"
param = snappy.GPF.createProduct("DEM-Assisted-Coregistration", parameters, sourceProducts)
ProductIO.writeProduct(param, outFile, 'BEAM-DIMAP')

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s