Next / Previous / Contents / NM Tech homepage

6.21. CBCData.getRegionCircle()

pycbc.py
# - - -   C B C D a t a . g e t R e g i o n C i r c l e

    def getRegionCircle(self, regionCode, cirName):
        '''Get the circle in the given region with the given name.
        '''
        circleList = [ circle
                       for circle in self.genCirclesByName(cirName) ]
        for circle in circleList:
            regionList = [ region
                           for region in circle.regions ]
            for region in regionList:
                if region.reg_code == regionCode:
                    return circle
        raise KeyError("No circle named '%s' in region '%s'." %
                       (cirName, regionCode))