@classmethod
    def readUBC(TreeMesh, meshFile):

        ## Read the file lines
        fileLines = np.genfromtxt(meshFile,dtype=str,delimiter='\n')
        # Extract the data
        nCunderMesh = np.array(fileLines[0].split(),dtype=float)
        # I think this is the case?
        if np.unique(nCunderMesh).size >1:
            raise Exception('SimPEG TreeMeshes have the same number of cell in all directions')
        tswCorn = np.array(fileLines[1].split(),dtype=float)
        smallCell = np.array(fileLines[2].split(),dtype=float)
        nrCells = np.array(fileLines[3].split(),dtype=float)
        # Read the index array
        indArr = np.genfromtxt(fileLines[4::],dtype=np.int)

        ## Calculate simpeg parameters
        h1,h2,h3 = [np.ones(nr)*sz for nr,sz in zip(nCunderMesh,smallCell)]
        x0 = tswCorn - np.array([0,0,np.sum(h3)])
        # Need to convert the index array to a points list that complies with SimPEG TreeMesh.
        # Shift to start at 0
        simpegCellPt = indArr[:,0:-1].copy()
        simpegCellPt[:,2] = ( nCunderMesh[-1] + 2) - (simpegCellPt[:,2] + indArr[:,3])
        # Need reindex the z index to be from the bottom-left-close corner and to be from the global bottom.
        simpegCellPt = simpegCellPt - np.array([1.,1.,1.])

        # Calculate the cell level
        simpegLevel = np.log2(np.min(nCunderMesh)) - np.log2(indArr[:,3])
        # Make a pointer matrix
        simpegPointers = np.concatenate((simpegCellPt,simpegLevel.reshape((-1,1))),axis=1)

        ## Make the tree mesh
        mesh = TreeMesh([h1,h2,h3],x0)
        mesh._cells = set([mesh._index(p) for p in simpegPointers.tolist()])

        # Figure out the reordering
        mesh._simpegReorderUBC = np.argsort(np.array([mesh._index(i) for i in simpegPointers.tolist()]))
        # mesh._simpegReorderUBC = np.argsort((np.array([[1,1,1,-1]])*simpegPointers).view(','.join(4*['float'])),axis=0,order=['f3','f2','f1','f0'])[:,0]

        return mesh
Read UBC 3D OcTree mesh and/or modelFiles
dataset/ETHPy150Open simpeg/simpeg/SimPEG/Mesh/MeshIO.py/TreeMeshIO.readUBC