Pixel Extraction help

I’m trying to run the function below but I’m getting a “no matching Java method overloads found” error. I’m not really sure what I’m doing wrong.

def pixelEx(stations):
    #source = "C:\\Users\\ammar\\Desktop\\MB_2016_sm\\RS2_OK80001_PK711420_DK639826_FQ8W_20161106_125310_HH_VV_HV_VH_SLC.tiff.tif"
    singleCoor = snappy.jpy.get_type('org.esa.snap.pixex.Coordinate')
    coords = jpy.array('org.esa.snap.pixex.Coordinate', len(stations))
    for i in range(len(stations)):
        coords[i] = singleCoor('MB' + str(i+1),stations[i][1],stations[i][0], None)
    
    params = HashMap()
    
    params.put('sourceProductPaths', "C:\\Users\\ammar\\Desktop\\MB_2016_sm\\*.tif")
    params.put('exportBands', True)
    params.put('exportTiePoints',False)
    params.put('exportMasks',False)
    params.put('coordinates', coords)
    params.put('outputDir', 'C:\\Users\\ammar\\Desktop\\pixEx')
    params.put('windowSize',3)
    params.put('aggregatorStrategyType','mean')
    
    x = GPF.createProduct('PixEx',params)
    ProductIO.writeProduct(x,'C:\\Users\\ammar\\Desktop\\pixEx')

The problem is that write ProductIO.writeProduct needs also a format name.
So you could write:

ProductIO.writeProduct(x, 'C:\\Users\\ammar\\Desktop\\pixEx', 'BEAM-DIMAP')

But actually, you don’t need to write the product. Probably it is null anyway. The PixExOp does all the work already when GPF.createProduct() is called. So you can delete the write line.

1 Like