def _get_headwaters(self, per=0):
        upsegs = [self.segment_data[per].nseg[self.segment_data[per].outseg == s].tolist()
                  for s in self.segment_data[0].nseg]
        return self.segment_data[per].nseg[np.array([i for i, u in enumerate(upsegs) if len(u) == 0])]
List all segments that are not outsegs (that do not have any segments upstream).
dataset/ETHPy150Open modflowpy/flopy/flopy/modflow/mfsfr2.py/ModflowSfr2._get_headwaters