Adding a new rotation method

It is possible to select from a number of rotation methods when using sunpy.image.transform.affine_transform() and You can add a custom rotation method using the decorator sunpy.image.transform.add_rotation_function():

from sunpy.image.transform import add_rotation_function

@add_rotation_function("my_rotate", allowed_orders={0, 1, 3},
                       handles_clipping=False, handles_image_nans=False, handles_nan_missing=False)
def _rotation_mine(image, matrix, shift, order, missing, clip):
    # Rotation code goes here
    return rotated_image

See the docstring for add_rotation_function() for a detailed explanation of each of the decorator parameters and each of the required input parameters to the rotation function

Then you can do:

from import Map
from import sample

hmi_map =

rot_map = hmi_map.rotate(order=3, recenter=True, method="my_rotate")

The available rotation methods are all implemented using the add_rotation_function() decorator, so you can look in sunpy/image/ for examples of how to use this decorator.