IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 12, 2014, 4:10:18 PM (12 years ago)
Author:
eugene
Message:

merge changes from branches/eam_branches/ipp-20140717

File:
1 edited

Legend:

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

    r36447 r37246  
    5050        self.regionsIngestedButOutOfDate = []
    5151       
    52         # we have (still) 3 modes of ingest from dvo cpt/cps/cpm files
    53         # 1) dvograbber (useFullTables == FALSE),
     52        # we USED TO have 3 modes of ingest from dvo cpt/cps/cpm files
     53        # 1) dvograbber (useStilts == TRUE, useFullTables == FALSE),
    5454        # 2) jython/stilts (useStilts == TRUE, useFullTables == TRUE)
    55         # 3) dvopsps (useStilts == FALSE, useFullTables == TRUE)
     55        # 3) dvopsps (useStilts == FALSE, useFullTables == FALSE)
    5656        # my goal (EAM, 2013/01/31) is to migrate to only dvopsps
    5757
    58         self.useStilts = 0
    59         self.scratchDb.setUseFullTables(True)
     58        self.scratchDb.setDvoTableNames()
    6059
    6160        # decide if we are using the right DVO for this scratchDb
     
    6463        # this scratch Db either has no DVO info ingested, or a different DVO ingested. Prompt user
    6564        if not self.correctDvo:
    66             print "*******************************************************************************"
    6765            self.logger.warning("switching to a new dvo: '" + self.skychunk.dvoLocation + "'")
    6866            # response = raw_input("(y/n) ")
     
    104102        # go no further if we've already partly ingested a different DVO
    105103        if not self.correctDvo: return
     104
     105        if (self.skychunk.dvoLocation == 'none'):
     106            # print "do not load Photcodes for place-holder DVO " + self.skychunk.dvoLocation
     107            return False
    106108
    107109        # check if we have up-to-date version
     
    156158        if not self.correctDvo: return False
    157159
     160        if (self.skychunk.dvoLocation == 'none'):
     161            # print "do not load SkyTable for place-holder DVO " + self.skychunk.dvoLocation
     162            return False
     163
    158164        path =  self.skychunk.dvoLocation + "/SkyTable.fits"
    159165        if self.scratchDb.alreadyImportedThisDvoTable(path):
     
    164170        self.logger.infoPair("DVO SkyTable.fits file", "NOT up-to-date")       
    165171
    166         if self.useStilts:
    167             self.importFits(
    168                 path,
    169                 "R_MIN R_MAX D_MIN D_MAX INDEX NAME",
    170                 self.scratchDb.dvoSkyTable)
    171         else:
    172            
    173             # create dvoSkyTable
    174             sql = "drop TABLE dvoSkyTable"
    175             try:
    176                 self.scratchDb.execute(sql)
    177             except: pass
    178 
    179             # create dvoSkyTable
    180             sql = "CREATE TABLE dvoSkyTable (R_MIN REAL, R_MAX REAL, D_MIN REAL, D_MAX REAL, INDEX_ INT, NAME CHAR(18))"
    181             self.scratchDb.execute(sql)
    182 
    183             # TODO path to DVO prog hardcoded temporarily
    184             cmd = "dvopsps skytable"
    185             cmd += " -dbhost " + self.scratchDb.dbHost
    186             cmd += " -dbname " + self.scratchDb.dbName
    187             cmd += " -dbuser " + self.scratchDb.dbUser
    188             cmd += " -dbpass " + self.scratchDb.dbPass
    189             cmd += " -D CATDIR " + self.skychunk.dvoLocation
    190 
    191             self.logger.infoPair("Running dvopsps", cmd)
    192             p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
    193             p.wait()
    194             if p.returncode != 0:
    195                 self.logger.errorPair("dvopsps failed on SkyTable.fits for ", self.skychunk.dvoLocation)
    196                 raise
     172        # drop dvoSkyTable (if it exists)
     173        sql = "drop TABLE dvoSkyTable"
     174        try: self.scratchDb.execute(sql)
     175        except: pass
     176
     177        # create dvoSkyTable
     178        sql = "CREATE TABLE dvoSkyTable (R_MIN REAL, R_MAX REAL, D_MIN REAL, D_MAX REAL, INDEX_ INT, NAME CHAR(18))"
     179        self.scratchDb.execute(sql)
     180
     181        # TODO path to DVO prog hardcoded temporarily
     182        cmd = "dvopsps skytable"
     183        cmd += " -dbhost " + self.scratchDb.dbHost
     184        cmd += " -dbname " + self.scratchDb.dbName
     185        cmd += " -dbuser " + self.scratchDb.dbUser
     186        cmd += " -dbpass " + self.scratchDb.dbPass
     187        cmd += " -D CATDIR " + self.skychunk.dvoLocation
     188
     189        self.logger.infoPair("Running dvopsps", cmd)
     190        p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
     191        p.wait()
     192        if p.returncode != 0:
     193            self.logger.errorPair("dvopsps failed on SkyTable.fits for ", self.skychunk.dvoLocation)
     194            raise
    197195
    198196        self.logger.infoPair("Adding index to", self.scratchDb.dvoSkyTable)
     
    268266           regionDec = region[2]
    269267           regionPath = region[3]
    270 
    271            # get paths for this region for the file types we are interested in
    272            # XXX ipptopsps cannot check files -- it does not know where they are
    273            ## paths = []
    274            ## for fileType in self.ingestFileTypes:
    275            ##     paths.append(self.skychunk.dvoLocation + "/" + regionPath + "." + fileType)
    276 
    277            # check for the existence of all interested file types
    278            # XXX ipptopsps cannot check files -- it does not know where they are
    279            ## skipThisRegion = False
    280            ## for path in paths:
    281            ##     if not os.path.isfile(path):
    282            ##         skipThisRegion = True
    283            ##         break
    284 
    285            ## if skipThisRegion: continue
    286268
    287269           # ok, have real, populated files so add this region to the list
     
    680662                useP2 = 1
    681663
    682         if (useP2 ==0 and useST ==1):
    683             #grab only stacks
    684             cmd += " -photcode-start 11000 -photcode-end 11500"
    685 
    686         if (useP2 ==1 and useST==0):
    687             #grabd only P2s   
    688             cmd += " -photcode-start 10000 -photcode-end 10577"
    689 
     664        if (useP2 == 0 and useST == 1):
     665            # grab only stacks
     666            if (self.config.camera == "simtest"):
     667                # SIMTEST.x.SkyChip
     668                cmd += " -photcode-start 14100 -photcode-end 14500"
     669            else:
     670                # not gpc1test -> GPC1.x.SkyShip
     671                cmd += " -photcode-start 11000 -photcode-end 11500"
     672
     673        if (useP2 == 1 and useST == 0):
     674            # grab only P2s (4000-4500 are test cameras, SIMTEST and SIMMOSAIC)
     675            if (self.config.camera == "simtest"):
     676                # SIMTEST.x.Chip
     677                cmd += " -photcode-start  4100 -photcode-end 4500"
     678            else:
     679                # not gpc1test -> GPC1.x.XYnn
     680                cmd += " -photcode-start 10000 -photcode-end 10577"
    690681
    691682        self.logger.infoPair("Running dvopsps", cmd)
Note: See TracChangeset for help on using the changeset viewer.