Changeset 37246 for trunk/ippToPsps/jython/dvo.py
- Timestamp:
- Aug 12, 2014, 4:10:18 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/dvo.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/dvo.py
r36447 r37246 50 50 self.regionsIngestedButOutOfDate = [] 51 51 52 # we have (still)3 modes of ingest from dvo cpt/cps/cpm files53 # 1) dvograbber (use FullTables == FALSE),52 # we USED TO have 3 modes of ingest from dvo cpt/cps/cpm files 53 # 1) dvograbber (useStilts == TRUE, useFullTables == FALSE), 54 54 # 2) jython/stilts (useStilts == TRUE, useFullTables == TRUE) 55 # 3) dvopsps (useStilts == FALSE, useFullTables == TRUE)55 # 3) dvopsps (useStilts == FALSE, useFullTables == FALSE) 56 56 # my goal (EAM, 2013/01/31) is to migrate to only dvopsps 57 57 58 self.useStilts = 0 59 self.scratchDb.setUseFullTables(True) 58 self.scratchDb.setDvoTableNames() 60 59 61 60 # decide if we are using the right DVO for this scratchDb … … 64 63 # this scratch Db either has no DVO info ingested, or a different DVO ingested. Prompt user 65 64 if not self.correctDvo: 66 print "*******************************************************************************"67 65 self.logger.warning("switching to a new dvo: '" + self.skychunk.dvoLocation + "'") 68 66 # response = raw_input("(y/n) ") … … 104 102 # go no further if we've already partly ingested a different DVO 105 103 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 106 108 107 109 # check if we have up-to-date version … … 156 158 if not self.correctDvo: return False 157 159 160 if (self.skychunk.dvoLocation == 'none'): 161 # print "do not load SkyTable for place-holder DVO " + self.skychunk.dvoLocation 162 return False 163 158 164 path = self.skychunk.dvoLocation + "/SkyTable.fits" 159 165 if self.scratchDb.alreadyImportedThisDvoTable(path): … … 164 170 self.logger.infoPair("DVO SkyTable.fits file", "NOT up-to-date") 165 171 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 197 195 198 196 self.logger.infoPair("Adding index to", self.scratchDb.dvoSkyTable) … … 268 266 regionDec = region[2] 269 267 regionPath = region[3] 270 271 # get paths for this region for the file types we are interested in272 # XXX ipptopsps cannot check files -- it does not know where they are273 ## 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 types278 # XXX ipptopsps cannot check files -- it does not know where they are279 ## skipThisRegion = False280 ## for path in paths:281 ## if not os.path.isfile(path):282 ## skipThisRegion = True283 ## break284 285 ## if skipThisRegion: continue286 268 287 269 # ok, have real, populated files so add this region to the list … … 680 662 useP2 = 1 681 663 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" 690 681 691 682 self.logger.infoPair("Running dvopsps", cmd)
Note:
See TracChangeset
for help on using the changeset viewer.
