divergence

PlasmaCalcs.quantities.patterns.vector_derivatives.divergence(array, components=[Component('x', 0), Component('y', 1), Component('z', 2)], *, _post_slices=None)

return divergence of array.

The result will not have ‘components’ dimension.
components: iterable of str or Component objects
which components to include in the calculation.
E.g., if components=[Component(‘x’, 0), Component(‘y’, 1)],
then result = d(array)/dx + d(array)/dy.
The derivative is taken along the corresponding dimension,
e.g. d(array)/dy is xarray_differentiate(array, dim=’y’).
_post_slices: None or dict of indexers
[EFF] if provided, apply these indexers to results after taking each derivative,
but before merging into the final array.
Equivalently, could just result.isel(**_post_slices).
But, indexing before merging can help avoid ever creating a large array.