def transform(dataset, axis1, axis2):
    """Swap two axes in a dataset"""

    data_py = dataset.active_scalars
    dataset.active_scalars = data_py.swapaxes(axis1, axis2)

def transform(dataset, axis1, axis2):
    """Swap two axes in a dataset"""

    import numpy as np

    data_py = dataset.active_scalars
    swapped = data_py.swapaxes(axis1, axis2)
    dataset.active_scalars = np.asfortranarray(swapped)

Convert array back to fortran before setting
Convert array back to fortran before setting

Unfortunately, it looks like numpy.ndarray.swapaxes converts
the ordering from Fortran to C. When this happens, a warning
message will be printed to the console later that a conversion to
Fortran ordering is required.

Instead of printing the warning, just convert it back to Fortran
ordering ourselves. We already know that this operator unfortunately
converts the ordering to C.

Signed-off-by: Patrick Avery <743342299f279e7a8c3ff5eb40671fce3e95f13a@kitware.com>

  def transform(dataset, axis1, axis2):
      """Swap two axes in a dataset"""
  
+     import numpy as np
+ 
      data_py = dataset.active_scalars
-     dataset.active_scalars = data_py.swapaxes(axis1, axis2)
+     swapped = data_py.swapaxes(axis1, axis2)
+     dataset.active_scalars = np.asfortranarray(swapped)
  
Convert array back to fortran before setting
## Code Before:
def transform(dataset, axis1, axis2):
    """Swap two axes in a dataset"""

    data_py = dataset.active_scalars
    dataset.active_scalars = data_py.swapaxes(axis1, axis2)

## Instruction:
Convert array back to fortran before setting
## Code After:
def transform(dataset, axis1, axis2):
    """Swap two axes in a dataset"""

    import numpy as np

    data_py = dataset.active_scalars
    swapped = data_py.swapaxes(axis1, axis2)
    dataset.active_scalars = np.asfortranarray(swapped)
