kml_?_interp2d_idx
Return the index of grid point (i, j). The index value is j × xsize + i.
Interface Definition
size_t kml_float_interp2d_idx(const kml_float_interp2d *interp, const size_t i, const size_t j)
size_t kml_double_interp2d_idx(const kml_double_interp2d *interp, const size_t i, const size_t j);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
interp |
const kml_float_interp2d* / const kml_double_interp2d* |
Pointer to an interpolation object. |
Input |
i |
size_t |
Index in the x direction. |
Input |
j |
size_t |
Index in the y direction. |
Input |
Dependencies
#include "kipl.h"
Examples
const size_t xSize = 4;
const size_t ySize = 4;
float xArr[4] = {1,1.33,1.67,2};
float yArr[4] = {1,1.33,1.67,2};
float* zArr = (float*)malloc(xSize * ySize * sizeof(float));
size_t x = 1;
size_t y = 1;
kml_float_interp2d *interp = kml_float_interp2d_alloc(kml_float_interp2d_bicubic, xSize, ySize);
kml_float_interp2d_init(interp, xArr, yArr, zArr, xSize, ySize);
size_t idx = kml_float_interp2d_idx(interp, x, y);
Parent topic: interp2d