pyinterp.core.reduced_gaussian.apply

Contents

pyinterp.core.reduced_gaussian.apply#

pyinterp.core.reduced_gaussian.apply(source: object, callback: object, lon: numpy.ndarray[dtype=float64, shape=(*), writable=False], lat: numpy.ndarray[dtype=float64, shape=(*), writable=False], time: numpy.ndarray[dtype=int64, shape=(*), writable=False] | None = None, args: dict | None = None, fields: collections.abc.Sequence[str] | None = None, n_out: int = 1, config: pyinterp.core.config.reduced_gaussian.ReducedGaussian) → object#

Compute values per point from the interpolated columns of the fields.

Parameters:
  • source – A Grid, or a Series of grids in time.

  • callback – Either a Python callable, called on blocks of points as callback(columns, points, a, b) with columns a dict of the interpolated fields (as returned by interpolate()), points a dict holding lon, lat, time (for a series) and the extra arguments, a and b the hybrid coefficients (or None); it returns an array of shape (block,) or (block, n_out). Or a native kernel: an object with an abi attribute equal to "pyinterp.reduced_gaussian.column_kernel/1" and an address attribute pointing to a C function int kernel(const double* columns, int64 n_fields, const int64* widths, const double* a, const double* b, int64 n_half_levels, const double* point, int64 n_point, double* out, int64 n_out), called once per point from several threads without the GIL; point holds lon, lat, time (for a series) and the extra arguments.

  • lon – Longitudes of the points, in degrees.

  • lat – Latitudes of the points, in degrees.

  • time – Dates of the points, for a Series.

  • args – Extra values per point, passed to the callback by name.

  • fields – Names of the fields to interpolate; all by default.

  • n_out – Number of values computed per point.

  • config – Configuration of the interpolation.

Returns:

The values, shape (n,) if n_out is 1, else (n, n_out). A point that cannot be interpolated, or for which the kernel returns a non-zero code, is NaN.