Changeset 31299 for trunk/ippToPsps/jython/batch.py
- Timestamp:
- Apr 15, 2011, 1:52:28 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/batch.py (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/batch.py
r31291 r31299 62 62 if self.survey != "": 63 63 64 # get survey ID from init table65 sql = "SELECT surveyID from Survey WHERE name = '" + self. getPspsSurveyType()+ "'"64 # get survey ID from init table 65 sql = "SELECT surveyID from Survey WHERE name = '" + self.survey + "'" 66 66 try: 67 67 rs = self.localStmt.executeQuery(sql) … … 69 69 self.surveyID = rs.getInt(1) 70 70 except: 71 self.logger.exception("No survey ID found for this survey: '" + self. getPspsSurveyType()+ "'")71 self.logger.exception("No survey ID found for this survey: '" + self.survey + "'") 72 72 self.surveyID = -1; 73 73 74 # get dvo info from config74 # get dvo info from config 75 75 dvoName = doc.find(survey+"dvo/name").text 76 76 self.dvoLocation = doc.find(survey+"dvo/location").text … … 109 109 # create DVO table 110 110 self.createDvoTable() 111 header = self.findAndReadFITSHeader("XY86.hdr") 111 112 112 113 ''' … … 171 172 root.attrib['timestamp'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") 172 173 if self.survey != "": 173 root.attrib['survey'] = self.get PspsSurveyType()174 root.attrib['survey'] = self.getBatchFriendlySurveyType() 174 175 try: self.minObjID 175 176 except: pass … … 243 244 Gets PSPS-friendly survey type 244 245 ''' 245 def get PspsSurveyType(self):246 def getBatchFriendlySurveyType(self): 246 247 247 248 try: … … 287 288 288 289 ''' 290 Drops a table 291 ''' 292 def dropTable(self, table): 293 294 sql = "DROP TABLE " + table 295 try: self.localStmt.execute(sql) 296 except: return 297 298 ''' 289 299 Updates a table with surveyID 290 300 ''' … … 413 423 self.logger.info(" Selecting database tables") 414 424 for table in self.pspsTables: 425 426 # check for an empty table 427 if self.getRowCount(table.name) < 1: continue 428 429 # get everything from table 415 430 _table = stilts.tread(self.localUrl + '#SELECT * FROM ' + table.name) 416 # if table.name == "StackDetection": _table.cmd_keepcols('stackDetectID projectionCellID').cmd_head(4).write()417 431 418 432 self.logger.info(" Replacing NULLs with weird PSPS -999 constant for " + table.name) 419 _table = stilts.tpipe(_table, cmd='replaceval "" -999 *') # TODO doesn't work 420 #if table.name == "StackDetection": _table.cmd_keepcols('stackDetectID projectionCellID').cmd_head(4).write() 433 434 # replace nulls and empty fields with weird PSPS -999 pseudo-null 435 _table = stilts.tpipe(_table, cmd='replaceval "" -999 *') 436 437 # change table names 421 438 _table = stilts.tpipe(_table, cmd='tablename ' + table.name) 422 439 _tables.append(_table) … … 425 442 stilts.twrites(_tables, self.outputFitsPath, fmt='fits') 426 443 self.logger.info(" ...done") 444 427 445 428 446 ''' … … 537 555 538 556 ''' 557 Returns a row count for this table 558 ''' 559 def getRowCount(self, table): 560 561 sql = "SELECT COUNT(*) FROM " + table 562 try: 563 rs = self.localStmt.executeQuery(sql) 564 rs.first() 565 return rs.getInt(1) 566 except: 567 self.logger.exception("Could not count rows for table: '" + table + "'") 568 return -1 569 570 571 ''' 539 572 Calls DVO program to 'query' DVO database and populate results to local MySQL Db table 540 573 '''
Note:
See TracChangeset
for help on using the changeset viewer.
