Load.reshape_cartesian#
- TransformManager.reshape_cartesian(var1: ndarray, var2: ndarray | None = None, var3: ndarray | None = None, **kwargs: Unpack[ReshapeKwargs]) tuple[ndarray, ...][source]
Reshape a variable into a cartesian grid.
Zones not covered by the original domain (e.g. the very inner radial regions) are also interpolated. At the current stage, the transformation is only in 2D.
- Parameters:
- - nx1: int, default len(x1)
The number of grid points in the first direction.
- - nx2: int, default len(x2)
The number of grid points in the second direction.
- - 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).
- - var1 (not optional): np.ndarray
The first variable to convert.
- - var2: np.ndarray | None, default None
The second variable to convert.
- - var3: np.ndarray | None, default None
The third variable to convert.
- - x1: np.ndarray, default self.x1
The first grid coordinate.
- - x2: np.ndarray, default self.x2
The second grid coordinate.
- Returns:
- newvar: tuple(np.ndarray)
The converted variable.
Examples
Example #1: Reshape a single variable into a cartesian grid
>>> xc, yc, rho = reshape_cartesian(D.rho)
Example #2: Reshape two variables into a cartesian grid
>>> xc, yc, Bx, Bz = reshape_cartesian(Bx, Bz, nx1=500)