xarray_curvigrad3D

PlasmaCalcs.tools.xarray_tools.xarray_sci.xarray_curvigrad3D(array, x=None, xyz=('x', 'y', 'z'))

return d(array)/dx, for curvilinear coordinates in 3D,

i.e. where x, y, z might each be up to 3D arrays instead of 1D.
For example, might have x varying across underlying dimensions i, j, k,
while y varies across only i, j and z varies across only j, k.
Or, maybe all three of them vary across i, j, and k.
array: xarray.DataArray or Dataset
array to be differentiated.
Must contain x, y, z coords, each of which can be up to 3D,
and which together share some set of up to 3 underlying dimensions.
x: None, str, or iterable of str.
tells which coord(s) to differentiate with respect to.
str –> result will be d(array)/dx.
None –> equivalent to using x=xyz
iterable of str –> result is a Dataset with data_vars dd{x[0]}, dd{x[1]}, dd{x[2]}.
(e.g., x=(‘x’, ‘y’) –> result has data_vars ‘ddx’ and ‘ddy’.)
If array was already a Dataset, result is a dict with those keys instead.
xyz: iterable of 3 strings, default (‘x’, ‘y’, ‘z’)
tells which 3 coords form a basis for the curvilinear coordinates.
Even if only getting ‘x’ derivative, the result can depend on ‘y’ and ‘z’
due to the Jacobian. Really, it is because, what does “d/dx” really mean?
It means “derivative when moving along x BUT not moving along y and z”.
With that framing, it is clear that d/dx depends, in general, on how
the underlying grid varies with all three variables.