9

I want to create wind maps. There is an introduction for ArcGIS and for QGIS. As I don't have access to the Spatial Analyst, I gave the QGIS-version a try. However, I don't know how to interpolate degree data.

For example wind direction could be 359° at one point and 1° at the second point. Values between this point should probably be 359°, 0°, or 1°.

As the interpolation doesn't know that it is degree data it looks like interpolated values are around 180°.

How I can interpolate degree data using QGIS?

1 Answer 1

7

Interpolate the sine and cosine of the angle, and then convert back to an angle with the atan function. These functions are available in QGIS' expression engine. There is an atan2(dy,dx) function like the one in R I use below...

Here's an R function to illustrate. I've used mean here to give the interpolation:

 dinterp = function(d){
             r=d*pi/180
             (180/pi)*atan2(mean(sin(r)),mean(cos(r)))
           }

which gives:

> dinterp(c(10,20))
[1] 15                *as expected*
> dinterp(c(340,20))
[1] 3.384676e-15      *approximately zero*
> dinterp(c(0,180))   
[1] 90                *could be +/- 90
> dinterp(c(359,180))
[1] -90.5             *small adjustment makes it go to ~-90

In QGIS, assuming you are creating a raster interpolated from a point data set, your workflow will be as follows:

  • Create two new attributes at each point, sinwind and coswind, from your wind direction in degrees. Make sure you convert to radians if necessary.
  • Create two interpolated rasters, one from sinwind and one from coswind.
  • Use raster calculator to convert back to direction by computing atan2 of the interpolated sine and cosine rasters.
  • Convert to degrees if required.

You could create a processing workflow for this - there may also already be a plugin. Note that although this gives you an interpolation of the wind direction, any assessment of the uncertainty of that interpolation is a bit tricky, and requires some circular statistics methods.

2
  • Thanks for that answer Spacedman. Works fine. You don't happen to have some references for that? It would be great to be able to say, ...was adjusted according to someone et al. (2000)...
    – Alex
    Commented Jan 9, 2017 at 10:08
  • This paper mentions the technique, as well as others: pphmj.com/abstract/7133.htm and cites references - I suspect the Mardia and Cressie books will be useful, but I don't have them to hand right now.
    – Spacedman
    Commented Jan 9, 2017 at 11:07

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.