docs: def map_coordinates(data, coordinates, interpolation="linear",
                      mode='constant'):
      """
      Map data to new coordinates by interpolation.
      The array of coordinates is used to find, for each point in the output,
      the corresponding coordinates in the input.
  
      should correspond to scipy.ndimage.map_coordinates
      
      Parameters
      ----------
      data
      coordinates
      output
      interpolation
      mode
      cval
      prefilter
  
      Returns
      -------
      """
      if not (isinstance(data, np.ndarray) and data.ndim in (2, 3)):
          raise ValueError("input data has to be a 2d or 3d array!")
  
      coordinates = np.asarray(coordinates, np.int32)
      if not (coordinates.shape[0] == data.ndim):
          raise ValueError("coordinate has to be of shape (data.ndim,m) ")
  
      interpolation_defines = {"linear": ["-D", "SAMPLER_FILTER=CLK_FILTER_LINEAR"],
                               "nearest": ["-D", "SAMPLER_FILTER=CLK_FILTER_NEAREST"]}
  
      mode_defines = {"constant": ["-D", "SAMPLER_ADDRESS=CLK_ADDRESS_CLAMP"],
                      "wrap": ["-D", "SAMPLER_ADDRESS=CLK_ADDRESS_REPEAT"],
                      "edge": ["-D", "SAMPLER_ADDRESS=CLK_ADDRESS_CLAMP_TO_EDGE"]
                      }
  
      if not interpolation in interpolation_defines:
          raise KeyError(
              "interpolation = '%s' not defined ,valid: %s" % (interpolation, list(interpolation_defines.keys())))
  
      if not mode in mode_defines:
          raise KeyError("mode = '%s' not defined ,valid: %s" % (mode, list(mode_defines.keys())))
  
      if not data.dtype.type in cl_buffer_datatype_dict:
          raise KeyError("dtype %s not supported yet (%s)" % (data.dtype.type, tuple(cl_buffer_datatype_dict.keys())))
  
      dtype_defines = ["-D", "DTYPE=%s" % cl_buffer_datatype_dict[data.dtype.type]]
  
      d_im = OCLImage.from_array(data)
      coordinates_g = OCLArray.from_array(coordinates.astype(np.float32, copy=False))
      res_g = OCLArray.empty(coordinates.shape[1], data.dtype)
  
      prog = OCLProgram(abspath("kernels/map_coordinates.cl")
                        , build_options=interpolation_defines[interpolation] +
                                        mode_defines[mode] + dtype_defines)
  
      kernel = "map_coordinates{ndim}".format(ndim=data.ndim)
  
      prog.run_kernel(kernel,
                      (coordinates.shape[-1],), None,
                      d_im, res_g.data, coordinates_g.data)
  
      return res_g.get()