Hello everyone. I’m working on a Python code using snappy to automatically perform all the SNAP operators to obtain a 2D displacement map. Before performing the “Horizontal/Vertical Motion” operator, the products must be collocated. So I tried to perform the operator following what is indicated in SNAP-Command line by calling “gpt -h Collocate”:
path_ascending = Path.joinpath(path_products_ascending, “terraincorrection_ascending.dim”)
terrain_correction_ascending = ProductIO.readProduct(str(path_ascending))
path_descending = Path.joinpath(path_products_descending, “terraincorrection_descending.dim”)
terrain_correction_descending = ProductIO.readProduct(str(path_descending))
products_paths = [str(path_ascending), str(path_descending)]
parameters_collocate = HashMap()
coll_prod = GPF.createProduct(“Collocate”, parameters_collocate, terrain_correction_ascending)
At this point, I got a error on the last line:
RuntimeError: org.esa.snap.core.gpf.OperatorException: Operator ‘CollocateOp’: Value for ‘Master product name’ must be of type ‘String’.
But if I change the product with a str(terrain_correction_ascending), the error is:
ValueError: cannot conert a Python ‘str’ to a Java ‘org.esa.snap.core.datamodel.Product’
this last error occurs even if I put as product the array of ascending and descending products, in both forms str(products_paths) or simply products_paths
Can someone help me on understanding where I am wrong?
Thank you in advance!