resample#
- sunpy.image.resample.resample(orig, dimensions, method='linear', center=False, minusone=False)[source]#
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 coordinate 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 newnumpy.ndarray
should have.method ({
"nearest"
,"linear"
,"spline"
}, optional) –- Method to use for resampling interpolation.
nearest and linear - Uses “n x 1D” interpolations calculated by
scipy.interpolate.interp1d
.spline - Uses
scipy.ndimage.map_coordinates
center (
bool
, optional) – IfFalse
(default) the interpolation points are at the front edge of the bin. IfTrue
, interpolation points are at the centers of the binsminusone (
bool
, optional) – Fororig.shape = (i,j)
& new dimensions= (x,y)
, if set toFalse
(default)orig
is resampled by factors of(i/x) * (j/y)
, otherwiseorig
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 newnumpy.ndarray
which has been resampled to the desired dimensions.
References