postgkyl.average

postgkyl.average(data, dims, *, weight=None, inplace=False, tag=None, label=None)

int f w dx^dims / int w dx^dims over the directions in dims.

Parameters:
  • data – gkyl-backed (native modal) dataset in the modal value_form.

  • dims – iterable of 0-based direction indices to average over (repeat --dims at the CLI, e.g. --dims 0 --dims 1).

  • weight – optional gkyl-backed dataset in the modal value_form, same num_dims/basis_type/poly_order as data and exactly one field (gkyl_array_average takes no field-index argument) – the plain average (dividing by volume) is computed when omitted.

  • inplace – Mutate and return data for partial averaging only.

  • tag – Optional tag for a partial-average dataset.

  • label – Optional label for a partial-average dataset.

Returns:

A float (one field) or NumPy array (multiple fields) containing the physical mean when every direction is averaged out. Otherwise a native modal dataset over the surviving dimensions. Dataset-only options inplace, tag, and label apply only to partial averaging.

Raises:

ValueError – data (or weight) is NumPy-backed or non-modal, is missing basis metadata, or weight’s grid/basis doesn’t match data’s, or dataset-only options are used for a full average.

CLI: average