pencil.math.transform ===================== .. py:module:: pencil.math.transform .. autoapi-nested-parse:: Routines to transform coordinates and fields. Functions --------- .. autoapisummary:: pencil.math.transform.coordinate_transformation pencil.math.transform.vector_field_transformation pencil.math.transform.pospolar2cart pencil.math.transform.velpolar2cart Module Contents --------------- .. py:function:: coordinate_transformation(x, y, z, xyz_from='', xyz_to='') coordinate_transformation(x, y, z, xyz_from='', xyz_to='') Tranform coordinates between coordinate systems. Returns a tuple (x, y, z). :param x: Input coordinates. :type x: 1d ndarray :param y: Input coordinates. :type y: 1d ndarray :param z: Input coordinates. :type z: 1d ndarray :param xyz_from: Origin coordinate system: 'cartesian', 'cylindrical' and 'spherical'. :type xyz_from: string :param xyz_to: Destination coordinate system: 'cartesian', 'cylindrical' and 'spherical'. :type xyz_to: string :rtype: Tuple of 3 ndarrays containing the transformed coordinates. .. py:function:: vector_field_transformation(field, x, y, z, xyz_from='', xyz_to='') vector_field_transformation(field, x, y, z, xyz_from='', xyz_to='') Transform a vector field from one coordinate system to another. :param field: Vector field. :type field: 4d ndarray :param x: Input coordinates of the 'from' system. :type x: 1d ndarrays :param y: Input coordinates of the 'from' system. :type y: 1d ndarrays :param z: Input coordinates of the 'from' system. :type z: 1d ndarrays :param xyz_from: Origin coordinate system: 'cartesian', 'cylindrical' and 'spherical'. :type xyz_from: string :param xyz_to: Destination coordinate system: 'cartesian', 'cylindrical' and 'spherical'. :type xyz_to: string :rtype: ndarray with the transformed vector field. .. py:function:: pospolar2cart(r, th) Transform from polar to cartesian coordinates .. py:function:: velpolar2cart(vr, vth, r, th, zcoord=0) Transform from polar velocities to cartesian velocities call signature: velpolar2cart(vr, vth, r, th, zcoord=0) Keyword arguments: *vr*: 3D array of velocities in radial direction *vth*: 3D array of velocities in theta direction *r* coordinates in radial direction *th* coordinates in theta direction *zcoord* plane in z-dir