1

I'm hoping to add Sentinel 1 data to a tool I'm building. Preferably I would like to use GDAL to load the image, and extract the pixel values from the image. I realize that the pixel values are complex values, representing IQ, and have only selected the real part to display. I would use GRD data for this task, but I think including phase information would be interesting. I'm hoping to implement this in python, and move it into cpp in the future, so that's why I'm hoping to implement my own software in this task.

So far I have had no luck.

Here's my code.

datasetVertical = gdal.Open(str(measurementFilesVertical[0]))
datasetHorizontal = gdal.Open(str(measurementFilesHorizontal[0]))

band1 = datasetVertical.GetRasterBand(1).ReadAsArray()
band1Real = datasetVertical.GetRasterBand(1).ReadAsArray().real.astype(np.float32)

print(np.max(band1Real))
print(np.min(band1Real))
#band1VMin, band1VMax = np.nanpercentile(band1Real, (1, 99))

#band1Complex = datasetVertical.GetRasterBand(1).ReadAsArray().imag
#band1Amplitude = np.sqrt(band1Real**2 + band1Complex**2)
#band1Phase = np.arctan(band1Complex/band1Real)

band2 = datasetHorizontal.GetRasterBand(1).ReadAsArray()
band2Real = datasetHorizontal.GetRasterBand(1).ReadAsArray().real.astype(np.float32)
#band2Complex = datasetHorizontal.GetRasterBand(1).ReadAsArray().imag
#band2Amplitude = np.sqrt(band2Real**2 + band2Complex**2)
#band2Phase = np.arctan(band1Real/band1Complex)

band3Real = band2Real/band1Real


stackedImage = np.dstack(( (band1Real), (band2Real), (band3Real) ))
rows, columns = 2, 2

fig = plt.figure()
fig.add_subplot(2, 2, 1)
plt.imshow(stackedImage, cmap = 'jet', interpolation = None)
fig.add_subplot(rows, columns, 2)
fig.add_subplot(2, 2, 2)
plt.imshow(band1Real, cmap = 'gray', interpolation = None)
fig.add_subplot(2, 2, 3)
plt.imshow(band2Real, cmap = 'gray', interpolation = None)
fig.add_subplot(2, 2, 4)
plt.imshow(band3Real, cmap = 'gray', interpolation = None)
plt.show()

Output enter image description here I'm only using one swath currently to try to "false-color" the image. I've tried scaling the contrast, etc. I've had lots of luck with Sentinel 2, and other satellites, but am struggling with putting images together for Sentinel 1.

In the first image, I'm getting a hint of water bodies, so I believe I'm on the right track. Any suggestions on improving this view?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.