def trim_internal(x, axes):
 olist = []
 for (i, bd) in enumerate(x.chunks):
  ilist = []
  for d in bd:
   ilist.append((d - (axes.get(i, 0) * 2)))
  olist.append(tuple(ilist))
 chunks = tuple(olist)
 return map_blocks(partial(chunk.trim, axes=axes), x, chunks=chunks, dtype=x.dtype)

def trim_internal ( x , axes ) : olist = [ ] for ( i , bd ) in enumerate ( x . chunks ) : ilist = [ ] for d in bd : ilist . append ( ( d - ( axes . get ( i , 0 ) * 2 ) ) ) olist . append ( tuple ( ilist ) ) chunks = tuple ( olist ) return map_blocks ( partial ( chunk . trim , axes = axes ) , x , chunks = chunks , dtype = x . dtype )
trim sides from each block this couples well with the ghost operation .