PYME.contrib.congrid module¶

PYME.contrib.congrid.
congrid
(a, newdims, method='linear', centre=False, minusone=False)¶ Arbitrary resampling of source array to new dimension sizes. Currently only supports maintaining the same number of dimensions. To use 1D 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.
method: neighbour  closest value from original data nearest and linear  uses n x 1D interpolations using
scipy.interpolate.interp1d(see Numerical Recipes for validity of use of n 1D interpolations) spline  uses ndimage.map_coordinates
centre: True  interpolation points are at the centres of the bins False  points are at the front edge of the bin
minusone: For example inarray.shape = (i,j) & new dimensions = (x,y) False  inarray is resampled by factors of (i/x) * (j/y) True  inarray is resampled by(i1)/(x1) * (j1)/(y1) This prevents extrapolation one element beyond bounds of input array.