2.2. moderate Interpolating point data

Next, we will be interpolating our data. There are many different algorithms for doing this, from simple algorithms that take the value of the closest point (Nearest Neighbour), to complex spline or Kriging <https://en.wikipedia.org/wiki/Kriging> interpolation techniques. We will be exploring the nearest neighbour, Inverse Distance Weighting and several splines in this chapter. Finally, we will obtain our rainfall value from the sagaThin Plate Spline algorithm. It is recommended to first read /docs/gentle_gis_introduction/spatial_analysis_interpolation.

2.2.1. Nearest Neighbour

  1. Find and open the gdalGrid (Nearest Neighbour) algorithm.

  2. Set Point Layer to pointLayerReprojected [EPSG:32637]

  3. Set Advanced Parameters ► Z value from field [optional] to fieldFloatPRCP.

  4. Run the algorithm. The output map should look like this:

    ../../_images/nearest_neighbour.png

    Fig. 2.1 Nearest neighbour interpolated precipitation

    hard Challenge

    It seems to be possible to Set cellsize and extent in a similar way, so that your grid is automatically clipped to Hadocha_dem.

2.2.2. Inverse Distance Weighting

Inverse distance weighting is an interpolation method in which the influence of a datapoint on the value of the interpolated raster decreases with distance.

  1. Find and open the logoIDW interpolation tool

  2. Set Vector layer to pointLayerReprojected

  3. As Interpolation attribute select fieldFloatPRCP

  4. Press the signPlus button to add the layer to the selection.

  5. For Extent, select … ► Calculate from layer ► Reprojected.

  6. As Pixel size X and Pixel size Y enter 1970. The Rows and Columns fields should adjust.

  7. Run the algorithm. Your map should look like this:

    ../../_images/idw.png

    Fig. 2.2 IDW interpolated precipitation.

  8. hard try to get similar results with algorithms from gdal GDAL and grassLogo GRASS

2.2.3. Spline interpolation

A spline is a piecewise defined polynomial. There are many different ways to generate a spline from a set of datapoints. We will be using a thin plate spline which creates a minimum curvature surface through all datapoints.

  1. find and open the sagaThin plate spline tool You may encounter the following warning that you can safely ignore:

    Warning

    SAGA version <version> is not officially supported - algorithms may encounter issues

  2. For Points select pointLayerReprojected [EPSG:32637].

  3. Set Attribute to fieldFloatPRCP

  4. Set search range to selectString[1] global

  5. Set Number of Points to selectString[1] All points within search distance

  6. Set Search direction to selectString[0] all directions

  7. for Cellsize enter 1970

  8. And finally, set Fit to selectString[1] cells

  9. Run the algorithm. Your output should look like this:

    ../../_images/thin_plate_spline.png

    Fig. 2.3 Thin plate spline interpolation

    notice that the raster value extremes exceed the values of the datapoints. This is a characteristic of (thin plate) spline interpolation.

2.2.4. basic Final interpolation

Now we have looked at different algorithms and compared their characteristics, it is time to select one and obtain a precipitation raster. Normally, to choose an interpolation method, you would randomly sample points, perform an interpolation on them and compare the error between interpolated and data values. Due to the amount of datapoints, this is not possible, and we choose thin plate spline by means of expert opinion.

  1. Open the logoZonal statistics tool.

  2. For Input layer select … ► Browse for Layer and select Hadocha_mask:

    ../../_images/browse_mask.png

    Note

    Note that the filepath becomes: path/00_raw_input.gpkg|layername=Hadocha_mask The last part after | tells the algorithm which layer to select from the GeoPackage. This may be useful if you want to manually enter a path to a GeoPackage layer!

  3. As Raster layer select rasterTarget Grid [EPSG:32637]

  4. We only want the checkbox Mean to be calculated. Run the algorithm. This creates a vector layer with the average precipitation value for our catchment.

  5. Open the attribute table and copy the precipitation value to your clipboard

  6. If not loaded yet, load the DEM into the map

  7. Run the logoRaster calculator tool with:

    • Expression: <your precipitation value>,

    • Reference layer(s) used for automated extent, cellsize and CRS: checkbox

      <DEM file>

  8. To save the raster layer in our 01_input.gpkg database, right-click Export ► Save as… with:

    • Format: selectStringGeoPackage

    • File name <path_to>/01_input.gpkg

    • Layer name P

    • the rest default