resample

sunpy.image.resample.resample(orig, dimensions, method='linear', center=False, minusone=False)[source] [edit on github]

Returns a new numpy.ndarray that has been resampled up or down.

Arbitrary resampling of source array to new dimension sizes. Currently only supports maintaining the same number of dimensions. To use 1-D arrays, first promote them to shape (x,1).

Uses the same parameters and creates the same co-ordinate lookup points as IDL’s congrid routine (which apparently originally came from a VAX/VMS routine of the same name.)

Parameters
  • orig (numpy.ndarray) – Original input array.

  • dimensions (tuple) – Dimensions that new numpy.ndarray should have.

  • method ({'neighbor' | 'nearest' | 'linear' | 'spline'}, optional) –

    Method to use for resampling interpolation.

  • center (bool, optional) – If False (default) the interpolation points are at the front edge of the bin. If True, interpolation points are at the centers of the bins

  • minusone (bool, optional) – For orig.shape = (i,j) & new dimensions = (x,y), if set to False (default) orig is resampled by factors of (i/x) * (j/y), otherwise orig is resampled by (i-1)/(x-1) * (j-1)/(y-1). This prevents extrapolation one element beyond bounds of input array.

Returns

out (numpy.ndarray) – A new numpy.ndarray which has been resampled to the desired dimensions.

References

https://scipy-cookbook.readthedocs.io/items/Rebinning.html