3

I'm trying to work with satellite data for the first time and running into problems. I find the documentation about using Sentinel-1 data in Python lacking, but maybe I'm searching for the wrong things.

I have downloaded a Sentinel-1 granule from the copernicus.eu website, and now I'm trying to get some usable visualization going in Python.

I started with the following small script which I've adapted from rasterio's documentation:

import rasterio
from matplotlib import pyplot as plt

path = '/x.SAFE/measurement/y-00n.tiff
src = rasterio.open(path)
array = src.read(1)
pyplot.imshow(array, cmap='pink')
plt.show()

However, I get the following error message:

TypeError: Image data of dtype complex128 cannot be converted to float

which stems from the fact that the values in array are complex.

How do I go about visualizing this data? Feel free to point me to it should I have missed some obvious documentation, but I couldn't find anything that helped me after googling this for several hours.

PS: I'm not set on using rasterio, but it seemed to be made for this purpose.

0

1 Answer 1

2

Pay attention that by default Sentinel-1 data are not orthorectified, and there are some additional pre-processes to do if you downloaded SLC (complex) data.

Using higher level libraries such as EOReader could help you to go directly to the interesting part (but you will need top download ESA SNAP software):

from eoreader.reader import Reader
from eoreader.bands import VV

# Open the Sentinel-1 product
prod = Reader().open("S1A_IW_GRDH_1SDV_20191215T060906_20191215T060931_030355_0378F7_3696.zip")

# Load VV band
vv_band = prod.load(VV)[VV]

# Use xarray backend to plot (or hvplot if you want)
vv_band.plot()

s1_viz

Disclaimer: I am the maintainer of EOReader.

2

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.