code: def createLabels2D(self):
          
          logger.debug("  Creating 2D labels...")
          self.zmax = np.argmax(self.values,axis=1)
          self.vmax = self.values[np.arange(len(self.pixels),dtype=int),self.zmax]
  
          kwargs=dict(pixels=self.pixels,values=self.vmax,nside=self.nside,
                      threshold=self.threshold,xsize=self.xsize)
          labels,nlabels = CandidateSearch.labelHealpix(**kwargs)
          self.nlabels = nlabels
          self.labels = np.repeat(labels,len(self.distances)).reshape(len(labels),len(self.distances))
          return self.labels, self.nlabels
docs: 2D labeling at zmax