Poloidal regridding according to prescribed Jacobian dependence
    J ~ x^mx /(|grad psi|^npsi B^kb).
   
    This a convenience routine typically used to remap the equilibrium onto
    a grid with a different Jacobian dependence in x, |grad psi| and
    the magnetic field B. Some codes will require a specific dependence,
    among which
   
    mx npsi kb
    2 0 0 PEST1 coordinates
    1 1 0 Equal Arc
    0 0 0 Hamada
    0 0 2 Boozer
   
    are popular choices. For accuracy, the optimal choice may be equal-arc
    as it prevents excessive bending of the poloidal rays on the outer board.
   
    *NOTE* This routine does not rely on a XPLASMA/I2MEX representation.
    It should typically be used BEFORE initializing the i2mex object.
integer, parameter :: r8 = selected_real_kind(12,100)
integer, intent(in) :: mx, npsi, kb     the exponents entering the Jacobian
integer, intent(in) :: nt1, ns     the poloidal/radial grid sizes
real(r8), intent(in) :: the(nt1), psi(ns)     the poloidal [rad] and radial [Wb/rad] grids
real(r8), intent(in) :: g(ns)     the covariant toroidal B function (Btor*X)
real(r8), intent(inout) :: x(nt1, ns), z(nt1,ns)     old and new grid arrays
integer, intent(out) :: ier     error flag