Load.cartesian_vector#

TransformManager.cartesian_vector(var: str | None = None, **kwargs: Unpack[CartesianVectorKwargs]) tuple[ndarray, ...][source]

Convert a vector from spherical or polar components to cartesian.

Parameters:
- fullout: bool, default False

If True, all vector components are returned.

- transpose: True/False, default False

Transposes the variable matrix. Use is not recommended if not really necessary (e.g. in case of highly customized variables and plots).

- var: np.ndarray

The variable to convert.

- var1: np.ndarray

The first variable to convert if var is not used.

- var2: np.ndarray

The second variable to convert if var is not used.

- var3: np.ndarray

The third variable to convert if var is not used.

- x1: int

The first index of the variable.

- x2: int

The second index of the variable.

Returns:
  • newvar: tuple(np.ndarray)

    The converted vector components.

Examples

  • Example #1: Convert the vector from spherical to cartesian components

    >>> Bx, By, Bz = cartesian_vector(var="B")
    
  • Example #2: Convert the vector from polar to cartesian components

    >>> Bx, By = cartesian_vector(var1=D.Bx1, var2=D.Bx2)