diff --git a/docs/examples.md b/docs/examples.md index 8c47a0b..599d791 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -75,6 +75,7 @@ for i in range(band1.shape[0]): x = t[2] + (j * t[0]) + (t[0] / 2) y = t[5] + (i * t[4]) + (t[4] / 2) z = band1[i][j] + #-- skip no_data + select randomly only 1% of the points if (z != d.nodatavals) and (random.randint(0, 100) == 5): pts.append([x, y, z]) dt = startinpy.DT() @@ -193,6 +194,8 @@ def main(): centres = np.asarray(centres) print("Interpolating at {} locations".format(centres.shape[0])) zhat = dt.interpolate({"method": "TIN"}, centres) + # zhat = dt.interpolate({"method": "Laplace"}, centres) + # zhat = dt.interpolate({"method": "IDW", "radius": 20, "power": 2.0}, centres, strict=True) #-- save to a GeoTIFF with rasterio write_rasterio('grid.tiff', zhat.reshape((deltay, deltax)), (bbox[0], bbox[1]), cellsize) diff --git a/src/lib.rs b/src/lib.rs index b36ffd6..9f1da9a 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -919,7 +919,7 @@ impl DT { } } - /// Interpolate with 5 different methods: + /// Estimate the z-value with 5 different spatial interpolation methods: /// /// 1. **IDW**: inverse distance weighing /// 2. **Laplace**: a faster NNI with almost the same results @@ -927,6 +927,9 @@ impl DT { /// 4. **NNI**: natural neighbour interpolation /// 5. **TIN**: linear interpolation in TIN /// + /// The interpolation does not modify the triangulation, it only returns an estimation for + /// the z-values at the xy-location provided as argument. + /// /// :param interpolant: a JSON/dict Python object with a `"method": "IDW"` (or others). IDW has 2 more params: "power" and "radius" /// :param locations: an array of [x, y] locations where the function should interpolate /// :param strict: (default=False) if the interpolation cannot find a value (because outside convex hull or search radius too small) then strict==True will stop at the first error and return that error. If strict==False then numpy.nan is returned.