xoa.core.regrid.cellave1d

Contents

xoa.core.regrid.cellave1d#

xoa.core.regrid.cellave1d(vari, yib, yob, axis=-1, extrap='no', conserv=False, na_thres=0.0)[source]#

Cell averaging or conservative regridding of nD data along an axis with varying coordinates

The arrays are broadcasted against each other except along axis, like with numpy, so the coordinates may vary along the other axes, or not, without a copy. See xoa.core.num.broadcast_along_axis(). The coordinates may increase or decrease, and their direction may change from a column to another, the extrapolations to the bottom and top referring to the smallest and largest values.

Parameters:
  • vari (array_like) – Input data

  • yib (array_like) – Input cell edges, monotonic along axis, with one more element than vari

  • yob (array_like) – Output cell edges, monotonic along axis

  • axis (int) – Working axis, which is kept in place, relative to the array of greatest number of dimensions

  • extrap ({"no", "bottom", "top", "both"}) – Extrapolation mode

  • conserv (bool) – Conservative regridding: the integral is preserved instead of the average

  • na_thres (float) – Minimal fraction, from 0 to 1, of an output cell that must be covered by valid input cells, else the output is NaN. Zero means that any valid input is enough.

Returns:

numpy.ndarray – Output data with the broadcasted shape of the arrays, and the size of yo along axis