0

I would like to use scipy.interpolate.griddata to interpolate my Sentinel-1 products (see two sample images below) taken from different orbits resulting in having the uniform datapoint coordinates.

I would like to use a similar approach as describe in Smoothing/interpolating raster in Python using GDAL?

However, I am not able to figure it how to get points at which to interpolate data from a geotiff. So far, I have this for values and for basic geographic description:

from osgeo import gdal
# Loading terrain corrected image
master = gdal.Open("S1A_TC.tif")
# Data values of master image
master_array = master.ReadAsArray()
# Getting geographic data (e.g. pixelSizeX)    
gt = master.GetGeoTransform()

For getting array of data point coordinates or points at which to interpolate data, I found this topic: https://stackoverflow.com/questions/43370069/converting-xy-co-ords-of-geotiff-to-numpy-array-positions-in-python

The GDAL link is dead and I am not able to found something useful.

How can I read the data point coordinates as np.array?

enter image description here

enter image description here

5
  • broken link is now gdal.org/user/raster_data_model.html
    – nmtoken
    Commented Sep 7, 2021 at 16:36
  • @nmtoken I am still confused. I am not sure if it will solve my issue... What are Xpixel and Yline? Thx
    – Luckasino
    Commented Sep 7, 2021 at 17:57
  • 1
    Xpixel and Yline are the column and row positions, respectively, of a pixel in the grid. Notice the paragraph a bit further down about corners vs. pixel centers. Commented Sep 8, 2021 at 5:50
  • @TurePålsson Okay... I will go through it more thoroughly and try to understand it. Of course, if you would like to a write an answer, you are welcome! :-)
    – Luckasino
    Commented Sep 8, 2021 at 7:55
  • Hmm I think that my question could be a duplication of gis.stackexchange.com/questions/129847/… But not quite certain about it (Since I am working with Sentinel-1 satellite imagery). Strange that I didn't find it during the writing of the topic...
    – Luckasino
    Commented Sep 8, 2021 at 12:30

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.