Subset Sentinel-1 filtered interferogram from a given AOI

Hello everyone,
I’m working on an authomatic script to reproduce all the operators of SNAP to perform DInSAR. The only part in which the user directly interacts with the code is the insertion of the products to process and the geographic coordinates of the Area Of Interest (AOI) (same Reference System of Google Earth). Then, starting from the AOI, the script recognizes on the input product where the AOI is and automatically selects the bursts and the swaths that contains the AOI, and then it reproduces all the operators to perform DInSAR (so, TOPSAR split, Apply orbit file etc…). Until this point, everything is ok, since the product I obtain after the filtering satisfies the conditions put by the user, but then I would like to subset the data in order to contain only the AOI and not the entire sequence of selected bursts. Just to understand, I show the image I want to cut

I would like to automatically recognize, starting from my AOI, the coordinates to insert in “Subset”, since the filtered image obviously doesn’t have the same reference system of Google Earth. Is there any way to correlate the two types of coordinates?
Moreover, I encountered an issue: just to test the Subset operator, I’ve done a “manual” attempt selecting the coordinates of my AOI in SNAP software directly on the image and inserting them on the script, but it doesn’t work:

(these are the imported modules:

import snappy
from snappy import Product, ProductIO, ProductUtils, GPF, HashMap, jpy
from asyncore import read
import gdal
import glob
from zipfile import ZipFile
from os.path import join
from glob import iglob
from pathlib import Path
import numpy as np
import subprocess
import sys
import os, gc
)

in this way, what I obtain is:

I read some suggestions on the forum, and I found that I should edit the code like this

adding, so, these lines:

WKTReader = snappy.jpy.get_type(‘com.vividsolutions.jts.io.WKTReader’)
geom = WKTReader().read(wkt)

but I get the error:

ValueError: Java class ‘com.vividsolutions.jts.io.WKTReader’ not found

I ensured that all the necessary libraries and modules are imported, and they actually are…
Can anyone give me some suggestions on how to solve this issue and in general how to approach on the relation between geographic coordinates - BEAM DIMAP product coordinates on SNAP?
Thanks in advance!

EDIT:
I solved this issue, since I changed the coordinates for the AOI for a test, but the obtained product cannot be exported with SnaPhu, even though it has no errors and it can be normally opened on SNAP software. Someone knows why?

1 Like