2

I feel like this should be easy but I'm struggling. I have a raster data set of Topographic Wetness Index (TWI) and a point data set of crop yield. I want to see how TWI and yield are correlated by point sampling the raster, but I have holes of missing yield monitor data because the field flooded and the crops died in these spots. So, these missing areas are important and should be filled as zeroes, and not interpolated from surrounding point data. Here are some screenshots using QGIS to give a better view of the problem.

My yield monitor data with missing areas from flooding. crop yield monitor points

My topographic wetness index. Topographic wetness index

And the yield overlaid on TWI. enter image description here

How should I fill these missing areas with zeroes so I can point sample and calculate correlation?

1 Answer 1

2

you have several ways to calculate the correlation between a raster and points, or between two aligned rasters.

You can use Grass or SAGA tools, or do it by programming.

Areas with no yield value should not be a problem, since the correlation is done with point-to-pixel matching. I recommend SAGA, it is very easy, direct and you can evaluate several adjustment equations.

Procedure:

SAGA is installed together with QGIS, run it.

enter image description here

On File > Open search and load your layers enter image description here

In the data tab you will see both the raster and the point layer. Select the Raster (TWI in your case) and right click, in the drop down menu select scatterplot.

enter image description here

In the options, in compare with... change to points. At the bottom, in points select the layer of points and finally in attributes the field with the yield value. Click Ok

enter image description here

It shows you a result like the one in the image, the graph, the r2 value and the adjustment equation

enter image description here

At the top you can see some buttons, the first one allows you to alter the properties, including the adjustment equation. Remember, you can have a different fit than linear, for example exponential, logarithmic.

enter image description here

The second is to update if any of the layers have changed.

The THIRD converts the graph to a table, note in the image as it shows only the points from which I extracted the pixel values, I can take this table to a spreadsheet.

enter image description here

1
  • Thank you! This was extremely helpful. I had trouble getting the extents to match after clipping, and ended up rasterizing the point data which then let me fill gaps with 0s, too. Worked like a charm otherwise!! Commented Sep 16, 2020 at 16:51

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.