writePixels Error

Hi all,
I’m stuck with an ‘RuntimeError: no matching Java method overloads found’ and I don’t know how to deal with it.
Hope someone can help!

From an S1 GeoTIFF, I exctract a band, convert it into an array, run some FFT modification and rebuilt an image array I wanted to convert in GeoTIFF :

import sys
sys.path.append(‘C:\\Users\albeck\.snap\snap-python’)
import snappy
from snappy import ProductIO
from snappy import Product
from snappy import ProductData
from matplotlib import pyplot as plt
import matplotlib.image as mpimg
from matplotlib.colors import LogNorm
import numpy as np

import Read_Image as RI
import plot
import Fft2D as fft

p = ProductIO.readProduct(“C:\Users\albeck\Coastal Erosion\Anne\Data\Start bay\Pre-process\subset_0_of_S1B_IW_GRDH_1SDV_20190101T180458_20190101T180523_014304_01A9CD_6860_msk_Cal_RLeeSpk_anidif.tif”)
w,h = RI.RasterSize§

img = RI.Read_Band (p, “band_1”)

img_fft = fft.fourier2dT(img)

fftCut = fft.fft_cut (img_fft,0.2)

plot.fft_plot (fftCut)

img_fftcut_inv = np.float32(np.real(fft.Inv_fft (fftCut)))

plot.img_plot (np.abs(img_fftcut_inv))

plt.figure()
plt.hist(img_fftcut_inv)

test = Product(‘Test’,‘FFT test’,h,w)
new_band = test.addBand(‘band_1’, ProductData.TYPE_FLOAT32)
print new_band
writer = ProductIO.getProductWriter(‘GeoTIFF’)
test.setProductWriter(writer)
test.writeHeader(“C:\Users\albeck\Coastal Erosion\Anne\Data\Start bay\Pre-process\test.tif”)
new_band.writePixels (0,0,h,w,img_fftcut_inv)

Result

File “C:/Users/albeck/Coastal Erosion/Anne/SnapScript/FFt_test4.py”, line 76, in
new_band.writePixels (0,0,h,w,img_fftcut_inv)

RuntimeError: no matching Java method overloads found

For data type info,
img_fftcut_inv is an 349, 479 Numpy Array in float 32
h = 349
w = 479

I’m currently running into the same issue with writePixels. Were you able to find a solution?

Found a solution to my problem. When calling writePixels, the data I supplied was an array slice reference instead of a copy.