@support_nddata
def block_replicate(data, block_size, conserve_sum=True):
 data = np.asanyarray(data)
 block_size = np.atleast_1d(block_size)
 if ((data.ndim > 1) and (len(block_size) == 1)):
  block_size = np.repeat(block_size, data.ndim)
 if (len(block_size) != data.ndim):
  raise ValueError(u'`block_size` must be a scalar or have the same length as `data.shape`')
 for i in range(data.ndim):
  data = np.repeat(data, block_size[i], axis=i)
 if conserve_sum:
  data = (data / float(np.prod(block_size)))
 return data

@ support_nddata def block_replicate ( data , block_size , conserve_sum = True ) : data = np . asanyarray ( data ) block_size = np . atleast_1d ( block_size ) if ( ( data . ndim > 1 ) and ( len ( block_size ) == 1 ) ) : block_size = np . repeat ( block_size , data . ndim ) if ( len ( block_size ) != data . ndim ) : raise ValueError ( u'`block_size` must be a scalar or have the same length as `data.shape`' ) for i in range ( data . ndim ) : data = np . repeat ( data , block_size [ i ] , axis = i ) if conserve_sum : data = ( data / float ( np . prod ( block_size ) ) ) return data
upsample a data array by block replication .