I said I would examine universal Kriging in this post, but there has been a change of plans. After some consultation with my geostatistics guru on the matter of variograms and trend surfaces, we’ve come to the conclusion that a simpler approach might be appropriate. However, I’ll explain the last part of the exploration of Kriging first.

After preparing a variogram cloud, I determined, with the help of O’Sullivan and Unwin, that it would be necessary to compute a trend surface and examine the residuals before choosing a model. I computed the trend surface using Java and Apache’s Commons Math matrix libraries. The program  produced the coefficients for the trend plane and a CSV file containing the geolocated observations. These, I plotted using GNUplot.

Surface of Best Fit

Surface of Best Fit

This is the trend surface that tracks the change in mean (drift) across the field.

Semivariogram - Residuals

Semivariogram – Residuals

This is the semivariogram of the residuals. As you can see, not much has changed. At this point we decided that I could continue down this path or try a simpler strategy, such as Voronoi polygons.

Voronoi Diagram

Voronoi polygons for schools in Victoria

In short, a Voronoi diagram is a partitioning of space (in this case, the plane) wherein any point in a given cell is closest to the observation enclosed by that cell. To the left is an image for the Voronoi diagram of schools in Victoria. (Note that where more than one school appears in a cell, it’s just an illusion created by similar colours.)

Over most of the study area, the school network is fairly dense, which obviates the need for an interpolation of the wind values. Besides, Kriging was never expected to be accurate because of the terrain considerations. Using a Voronoi partitioning has several advantages over Kriging:

  • Initially, I had expected to produce a raster for every minute during a ride (as that is the temporal resolution of the weather data.) Of course, the goal of Kriging is to produce a function which can estimate a value based on observations, so it would not, in fact, have been necessary to produce an entire raster. Still, using Voronoi polygons will offload the work of finding the estimate onto the spatial database — for a given node in the GPS track, the value associated with the containing polygon is the estimate.
  • The estimate for any node will have the same value as the observed value. Naturally, given the spatial displacement between the estimate and the observation, this implies some error, but the interpolated estimate would have contained error, too. At least the observed value is true, somewhere.
  • Fitting a model to the semivariogram is a bit of a black art. This strategy bypasses it entirely.
  • It’s time to move on from this phase of the project and build a Web application. The Voronoi solution is quick and easy to implement.

I installed a PostGIS Voronoi function from someone named “GeoGeek” (PostGIS does not yet have a native Voronoi function) and ran it against the list of schools, producing the geometries pictured above. So far, so good.

For the sake of fun, here’s snapshot of wind changes in Victoria over a 15-minute period in July, 2014 (missing or intermittent arrow are stations not reporting.)

Wind Animation

Wind Animation (Click to  View)

 

 

One Thought on “To Krige or Not to Krige…

  1. Trisalyn on October 29, 2014 at 2:38 pm said:

    Fun post. I love having my my name hyperlinked to guru. I think Voronoi is the way to go. I like the wind vectors on there.

Post Navigation