Create GSSHAPY Cross Section Objects Method

def _createCrossSection(self, linkResult, replaceParamFile):
        """
        Create GSSHAPY Cross Section Objects Method
        """
        # Extract header variables from link result object
        header = linkResult['header']

        # Initialize GSSHAPY StreamLink object
        link = StreamLink(linkNumber=int(header['link']),
                          type=header['xSecType'],
                          numElements=header['nodes'],
                          dx=vrp(header['dx'], replaceParamFile),
                          erode=header['erode'],
                          subsurface=header['subsurface'])

        # Associate StreamLink with ChannelInputFile
        link.channelInputFile = self

        # Initialize GSSHAPY TrapezoidalCS or BreakpointCS objects
        xSection = linkResult['xSection']

        # Cases
        if 'TRAPEZOID' in link.type or 'TRAP' in link.type:
            # Trapezoid cross section handler
            # Initialize GSSHPY TrapeziodalCS object
            trapezoidCS = TrapezoidalCS(mannings_n=vrp(xSection['mannings_n'], replaceParamFile),
                                        bottomWidth=vrp(xSection['bottom_width'], replaceParamFile),
                                        bankfullDepth=vrp(xSection['bankfull_depth'], replaceParamFile),
                                        sideSlope=vrp(xSection['side_slope'], replaceParamFile),
                                        mRiver=vrp(xSection['m_river'], replaceParamFile),
                                        kRiver=vrp(xSection['k_river'], replaceParamFile),
                                        erode=xSection['erode'],
                                        subsurface=xSection['subsurface'],
                                        maxErosion=vrp(xSection['max_erosion'], replaceParamFile))

            # Associate TrapezoidalCS with StreamLink
            trapezoidCS.streamLink = link

        elif 'BREAKPOINT' in link.type:
            # Breakpoint cross section handler
            # Initialize GSSHAPY BreakpointCS objects
            breakpointCS = BreakpointCS(mannings_n=vrp(xSection['mannings_n'], replaceParamFile),
                                        numPairs=xSection['npairs'],
                                        numInterp=vrp(xSection['num_interp'], replaceParamFile),
                                        mRiver=vrp(xSection['m_river'], replaceParamFile),
                                        kRiver=vrp(xSection['k_river'], replaceParamFile),
                                        erode=xSection['erode'],
                                        subsurface=xSection['subsurface'],
                                        maxErosion=vrp(xSection['max_erosion'], replaceParamFile))

            # Associate BreakpointCS with StreamLink
            breakpointCS.streamLink = link

            # Create GSSHAPY Breakpoint objects
            for b in xSection['breakpoints']:
                breakpoint = Breakpoint(x=b['x'],
                                        y=b['y'])

                # Associate Breakpoint with BreakpointCS
                breakpoint.crossSection = breakpointCS

        # Initialize GSSHAPY StreamNode objects
        for n in linkResult['nodes']:
            # Initialize GSSHAPY StreamNode object
            node = StreamNode(nodeNumber=int(n['node']),
                              x=n['x'],
                              y=n['y'],
                              elevation=n['elev'])

            # Associate StreamNode with StreamLink
            node.streamLink = link

        return link