I’m trying to unwrap a filtered interferogram using snappy, but I get the following error when trying to run SnaphuImport:
ValueError: cannot convert a Python 'str' to a Java 'org.esa.snap.core.datamodel.Product'
My code is:
def read_input_file(filename):
return ProductIO.readProduct(filename)
def unwrap(product):
parameters = HashMap()
parameters.put("doNoKeepWrapped", "false")
return GPF.createProduct("SnaphuImport", parameters, product)
def write_dim(product, filename):
ProductIO.writeProduct(product, filename, "BEAM-DIMAP")
return
in_file = "/xxx/*_filt_ifg.dim"
snaphu_file = "/xxx/UnwPhase_*.snaphu.hdr"
out_file = "/xxx/*_unw_ifg.dim"
filt_in = read_input_file(in_file)
snaphu_in = read_input_file(snaphu_file)
source_products = "{},{}".format(filt_in, snaphu_in)
unw = unwrap(source_products)
write_dim(unw, out_file)
The snaphu img file was created and is the same size as the other img files in the snaphu and filt ifg directories. I get the error when running:
unw = unwrap(source_products)
The source_products variable appears okay:
org.esa.snap.core.datamodel.Product[name=*_filt_ifg],org.esa.snap.core.datamodel.Product[name=UnwPhase_*]
Any ideas what might be causing this error?
Thanks