def shave ( self, ch, entityid, resolution, locations ):
    """Label the voxel locations or add as exceptions is the are already labeled."""

    [ xcubedim, ycubedim, zcubedim ] = cubedim = self.datasetcfg.cubedim [ resolution ] 

    # dictionary with the index
    cubeidx = defaultdict(set)

    # convert voxels z coordinate
    cubelocs = ocplib.locate_ctype ( np.array(locations, dtype=np.uint32), cubedim )

    # sort the arrary, by cubeloc
    cubelocs = ocplib.quicksort ( cubelocs )
    #cubelocs.view('u4,u4,u4,u4').sort(order=['f0'], axis=0)

    # get the nonzero element offsets 
    nzdiff = np.r_[np.nonzero(np.diff(cubelocs[:,0]))]
    # then turn into a set of ranges of the same element
    listoffsets = np.r_[0, nzdiff + 1, len(cubelocs)]

    self.kvio.startTxn()

    try:

      for i in range(len(listoffsets)-1):

        # grab the list of voxels for the first cube
        voxlist = cubelocs[listoffsets[i]:listoffsets[i+1],:][:,1:4]
        #  and the morton key
        key = cubelocs[listoffsets[i],0]

        cube = self.getCube (ch, key, resolution, True)

        # get a voxel offset for the cube
        cubeoff = ocplib.MortonXYZ(key)
        #cubeoff2 = zindex.MortonXYZ(key)
        offset = np.asarray( [cubeoff[0]+cubedim[0],cubeoff[1]*cubedim[1],cubeoff[2]*cubedim[2]], dtype=np.uint32 )

        # remove the items
        exlist, zeroed = cube.shave (entityid, offset, voxlist)
        # make sure that exceptions are stored as 8 bits
        exceptions = np.array(exlist, dtype=np.uint8)

        # update the sparse list of exceptions
        if ch.getExceptions == EXCEPTION_TRUE:
          if len(exceptions) != 0:
            self.removeExceptions ( ch, key, resolution, entityid, exceptions )

        self.putCube (ch, key, resolution, cube)

        # For now do no index processing when shaving.  Assume there are still some
        #  voxels in the cube???

    except:
      self.kvio.rollback()
      raise

    self.kvio.commit()


  #
  # annotateDense
  #
  #  Process a cube of data that has been labelled with annotations.
  #
dataset/ETHPy150Open neurodata/ndstore/ocpca/ocpcadb.py/OCPCADB.shave/operator `*` -> `+`