Next / Previous / Contents / TCC Help System / NM Tech homepage

10.7. hist.cgi: findCircles: Pull the circle records from the database

hist.cgi
# - - -   f i n d C i r c l e s

def findCircles(db):
    '''Pull the circle records for the centers of interest.

      [ db is a pycbc.CBCDatabase instance ->
          if all the circle centers in HistArgs().latLonList
          correspond to circles in db ->
            return a list of CBCDatabase.Circle instances representing
            those circles, sorted by lat-lon
          else -> raise lib.ScriptError ]
    '''
    #-- 1
    try:
        circleList = sorted(
          [ db.getCircle(*center)
            for center in HistArgs().latLonList ])
    except KeyError, x:
        raise lib.ScriptError("Unknown circle center: %s" % str(x))

    #-- 2
    return circleList