def block_average_above(x, y, new_x):
 bad_index = None
 x = atleast_1d_and_contiguous(x, np.float64)
 y = atleast_1d_and_contiguous(y, np.float64)
 new_x = atleast_1d_and_contiguous(new_x, np.float64)
 if (y.ndim > 2):
  raise ValueError('`linear` only works with 1-D or 2-D arrays.')
 if (len(y.shape) == 2):
  new_y = np.zeros((y.shape[0], len(new_x)), np.float64)
  for i in range(len(new_y)):
   bad_index = _interpolate.block_averave_above_dddd(x, y[i], new_x, new_y[i])
   if (bad_index is not None):
    break
 else:
  new_y = np.zeros(len(new_x), np.float64)
  bad_index = _interpolate.block_average_above_dddd(x, y, new_x, new_y)
 if (bad_index is not None):
  msg = ('block_average_above cannot extrapolate and new_x[%d]=%f is out of the x range (%f, %f)' % (bad_index, new_x[bad_index], x[0], x[(-1)]))
  raise ValueError(msg)
 return new_y

def block_average_above ( x , y , new_x ) : bad_index = None x = atleast_1d_and_contiguous ( x , np . float64 ) y = atleast_1d_and_contiguous ( y , np . float64 ) new_x = atleast_1d_and_contiguous ( new_x , np . float64 ) if ( y . ndim > 2 ) : raise ValueError ( '`linear` only works with 1-D or 2-D arrays.' ) if ( len ( y . shape ) == 2 ) : new_y = np . zeros ( ( y . shape [ 0 ] , len ( new_x ) ) , np . float64 ) for i in range ( len ( new_y ) ) : bad_index = _interpolate . block_averave_above_dddd ( x , y [ i ] , new_x , new_y [ i ] ) if ( bad_index is not None ) : break else : new_y = np . zeros ( len ( new_x ) , np . float64 ) bad_index = _interpolate . block_average_above_dddd ( x , y , new_x , new_y ) if ( bad_index is not None ) : msg = ( 'block_average_above cannot extrapolate and new_x[%d]=%f is out of the x range (%f, %f)' % ( bad_index , new_x [ bad_index ] , x [ 0 ] , x [ ( - 1 ) ] ) ) raise ValueError ( msg ) return new_y
linearly interpolates values in new_x based on the values in x and y .