IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33184 for trunk


Ignore:
Timestamp:
Jan 31, 2012, 4:22:51 PM (14 years ago)
Author:
rhenders
Message:

more measures to make safer when switching DVO databases; some convenience methods to to define region as a box (ra/dec center and side length)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/jython/dvo.py

    r33183 r33184  
    4646        self.scratchDb = ScratchDb(logger, self.doc, 1)
    4747
    48         # decide if we are using the right DVO
    49         self.correctDvo = self.scratchDb.isThisDvoCurrentlyIngested(self.dvoLocation)
    50 
    51         # using correct DVO, so now get up-to-date versions of Images and SkyTable tables
    52         self.updateMetaTables()
     48        # or decide if we are using the right DVO
     49        self.correctDvo = self.scratchDb.isCorrectDvo(self.dvoLocation)
    5350
    5451    '''
     
    6057
    6158    '''
    62     Updates two main meta tables, Images and SkyTable
    63     '''
    64     def updateMetaTables(self):
    65 
    66         self.loadImages()
    67         self.loadSkyTable()
    68 
    69     '''
    7059    Check we are importing the DVO currenly ingested
    7160    '''
     
    7766    '''
    7867    def resetDetections(self):
     68
    7969        self.logger.infoPair("Resetting", "just detections")
    8070        self.scratchDb.resetOnlyDetectionDvoTables()
     
    173163
    174164    '''
     165    Gets a bunch of region files from DVO for a RA/Dec box centered with these coords and with this side length PLUS a border
     166    '''
     167    def getRegionsInThisBoxWithBorder(self, regionsToIngest, regionsToPurge, ra=180., dec=0., side=181.0, border=0.):
     168
     169        halfSide = (side + (border*2.0)) /2.0
     170        self.getRegions(regionsToIngest, regionsToPurge, ra-halfSide, ra+halfSide, dec-halfSide, dec+halfSide)
     171   
     172    '''
     173    Gets a bunch of region files from DVO for a RA/Dec box centered with these coords and with this side length
     174    '''
     175    def getRegionsInThisBox(self, regionsToIngest, regionsToPurge, ra=180., dec=0., side=181.0):
     176
     177        halfSide = side/2.0
     178        self.getRegions(regionsToIngest, regionsToPurge, ra-halfSide, ra+halfSide, dec-halfSide, dec+halfSide)
     179   
     180
     181    '''
    175182    Gets a bunch of region files from DVO for this RA/Dec box
    176183    '''
    177184    def getRegions(self, regionsToIngest, regionsToPurge, minRa=-1., maxRa=361., minDec=-91., maxDec=91):
    178185   
     186        # go no further if we've already partly ingested a different DVO
     187        if not self.correctDvo: return
     188
    179189        if (maxRa - minRa <= 0) or (maxDec - minDec) <= 0:
    180190            self.logger.errorPair("Zero range in either RA or Dec",
     
    225235        sizeOfRegionsToIngest = self.getFileSizeStr(self.getDiskSizeOfDvoRegions(regionsToIngest))
    226236
    227         self.logger.infoTitle("DVO Overview")
     237        self.logger.infoTitle("Summary for this region")
    228238        self.logger.infoPair("RA range", "%.2f -> %.2f" % (minRa, maxRa))
    229239        self.logger.infoPair("Dec range", "%.2f -> %.2f" % (minDec, maxDec))
     
    240250    def purgeRegions(self, regions):
    241251
     252        # go no further if we've already partly ingested a different DVO
     253        if not self.correctDvo: return
     254
    242255        if len(regions) < 1: return
    243256
     
    282295        if not self.correctDvo: return
    283296
    284         self.updateMetaTables()
     297        # update the two meta tables, Images and SkyTable
     298        self.loadImages()
     299        self.loadSkyTable()
    285300
    286301        regionsToIngest = []
     
    302317           cptTableName = self.scratchDb.getDbFriendlyTableName(region + ".cpt")
    303318
     319           self.logger.infoTitle("Region: " + region)
     320
    304321           # if we have not already ingested the cpm table, then do it now
    305322           if not self.scratchDb.alreadyImportedThisDvoTable(cpmPath):
    306323   
    307                self.logger.infoTitle("Region: " + region)
    308 
    309324               # import cpm table and index
    310325               self.importFits(
Note: See TracChangeset for help on using the changeset viewer.