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)withcolumnsa dict of the interpolated fields (as returned byinterpolate()),pointsa dict holdinglon,lat,time(for a series) and the extra arguments,aandbthe hybrid coefficients (or None); it returns an array of shape (block,) or (block, n_out). Or a native kernel: an object with anabiattribute equal to"pyinterp.reduced_gaussian.column_kernel/1"and anaddressattribute pointing to a C functionint 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;pointholds 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_outis 1, else (n, n_out). A point that cannot be interpolated, or for which the kernel returns a non-zero code, is NaN.