1

I have two arrays:

(A) One array contains observation values for each pixel (e.g., satellite band data). (B) The other array contains corresponding coordinates(lat/lon) for each pixel.

I want to combine these two arrays into a single GeoTIFF file. My proposed method involves using the coordinates in array (B) to calculate an affine transformation and then using rasterio to perform a simple transformation.

However, this approach may introduce significant errors since it only considers the top-left and bottom-right coordinates.

I would like to create a more accurate GeoTIFF by utilizing the coordinates for each pixel. Could you please explain how to achieve this? (Python, GDAL, Rasterio, etc)

4
  • It's impossible to answer without knowing what the data looks like, is it public data? Often it's already a regular grid and you can store it as it is. The geotransform from GDAL is essentially already a flattened affine matrix. If it's not regular you'll need some form of interpolation, but this again depends on the data. Often swath data (from scanning sensors) can use dedicated algorithms for example, because there's still logic to it's structure despite being irregular. Commented Sep 8, 2023 at 6:32
  • sorry about the details, I have three arrays, each with a size of (900, 900). One contains the DN (digital Number) values of satellite bands (A), and the other two arrays consist of longitude and latitude data for each pixel (B). These datasets are not public. My initial step was to generate transformation parameters using the upper-left and bottom-right coordinates from the longitude and latitude arrays (B). Commented Sep 8, 2023 at 7:42
  • The previous method used only two pixels (upper left and bottom right) for coordinate extraction. I'm looking for a solution that can utilize all the coordinates from the longitude and latitude data (B) to achieve higher accuracy. Is there a way to accomplish this? Thank you Commented Sep 8, 2023 at 7:45
  • Please remember to edit your post and put all the details there instead of in a comment. Also please show code you've already written, or attempted to write. Without that, the first step will be closing this post so you can read up on the rasterio docs and spend some time figuring out how to get started on this. Commented Sep 20, 2023 at 21:07

0

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.