Changeset 39786 for trunk/ippToPsps/jython/gaiaobjectbatch.py
- Timestamp:
- Oct 21, 2016, 1:09:00 PM (10 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/gaiaobjectbatch.py (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/gaiaobjectbatch.py
r39785 r39786 14 14 from ipptopspsdb import IppToPspsDb 15 15 from scratchdb import ScratchDb 16 from dvo objects import DvoObjects16 from dvogaiaobjects import DvoGaiaObjects 17 17 from sqlUtility import sqlUtility 18 18 … … 49 49 dvoID, 50 50 batchID, 51 " OB",51 "GO", 52 52 None) 53 53 … … 84 84 ''' 85 85 def alterPspsTables(self): 86 87 self.scratchDb.execute("ALTER TABLE GaiaFrameCoordinate CHANGE dec_ `dec` double") 86 88 87 89 return True … … 119 121 cpsTableName = self.scratchDb.getDbFriendlyTableName(self.region + ".cps") 120 122 121 if False: 123 #if False: 124 # self. 122 125 # XXX EAM 20140724 : this is probably wrong : flux measurements can be 0.0 or negative: please review 123 126 self.logger.info("Populating GaiaFrameCoordinate") … … 134 137 sqlLine.group("batchID", "'" + str(self.batchID) + "'") 135 138 sqlLine.group("ra", "RA_MEAN") 136 sqlLine.group(" dec", "DEC_MEAN")139 sqlLine.group("`dec`", "DEC_MEAN") 137 140 sqlLine.group("raErr", "RA_ERR") 138 141 sqlLine.group("decErr", "DEC_ERR") 139 142 sqlLine.group("gaiaFlag", "FLAGS") 140 143 sql = sqlLine.makeRaw(") SELECT ", " FROM " + cptTableName) 141 144 … … 179 182 #count out of range 180 183 181 sql = "SELECT count(*) FROM gaiaFrameCoordinate where \182 gaiaFrameCoordinate.dec> " + str(decMax) + " \183 or gaiaFrameCoordinate.dec< " + str(decMin) + " \184 or gaiaFrameCoordinate.ra > " + str(raMax) + " \185 or gaiaFrameCoordinate.ra < " + str(raMin)184 sql = "SELECT count(*) FROM GaiaFrameCoordinate where \ 185 GaiaFrameCoordinate.`dec` > " + str(decMax) + " \ 186 or GaiaFrameCoordinate.`dec` < " + str(decMin) + " \ 187 or GaiaFrameCoordinate.ra > " + str(raMax) + " \ 188 or GaiaFrameCoordinate.ra < " + str(raMin) 186 189 187 190 rs = self.scratchDb.executeQuery(sql) … … 193 196 194 197 195 sql = "DELETE FROM gaiaFrameCoordinate where \196 gaiaFrameCoordinate.dec> (" + str(decMax) + " + .0033) or \197 gaiaFrameCoordinate.dec< (" + str(decMin) + " - .0033) or \198 gaiaFrameCoordinate.ra > (" + str(raMax) + " + .0033) or \199 gaiaFrameCoordinate.ra < (" + str(raMin) + " - .0033)"198 sql = "DELETE FROM GaiaFrameCoordinate where \ 199 GaiaFrameCoordinate.`dec` > (" + str(decMax) + " + .0033) or \ 200 GaiaFrameCoordinate.`dec` < (" + str(decMin) + " - .0033) or \ 201 GaiaFrameCoordinate.ra > (" + str(raMax) + " + .0033) or \ 202 GaiaFrameCoordinate.ra < (" + str(raMin) + " - .0033)" 200 203 self.logger.infoPair("Deleting", str(nToDelete) + " objects outside of ra/dec range") 201 204 … … 203 206 self.scratchDb.execute(sql) 204 207 except: 205 self.logger.errorPair("Couldn't cull outsiders from gaiaFrameCoordinate table", sql)208 self.logger.errorPair("Couldn't cull outsiders from GaiaFrameCoordinate table", sql) 206 209 raise 207 210 … … 210 213 self.logger.infoPair("updatePspsUniqueIDs","end") 211 214 212 self.logger.infoPair("Dropping row column from", " gaiaFrameCoordinate table")213 self.scratchDb.dropColumn(" gaiaFrameCoordinate", "row")214 self.logger.infoPair("Dropped row column", " gaiaFrameCoordinate")215 216 self.setMinMaxObjID([" gaiaFrameCoordinate"])215 self.logger.infoPair("Dropping row column from", "GaiaFrameCoordinate table") 216 self.scratchDb.dropColumn("GaiaFrameCoordinate", "row") 217 self.logger.infoPair("Dropped row column", "GaiaFrameCoordinate") 218 219 self.setMinMaxObjID(["GaiaFrameCoordinate"]) 217 220 218 221 return True … … 234 237 235 238 ### force objID uniqueness on *** ObjectThin *** 236 self.logger.infoPair("Forcing uniqueness on", "objID in gaiaFrameCoordinate table")237 rowCountBefore = self.scratchDb.getRowCount(" gaiaFrameCoordinate")239 self.logger.infoPair("Forcing uniqueness on", "objID in GaiaFrameCoordinate table") 240 rowCountBefore = self.scratchDb.getRowCount("GaiaFrameCoordinate") 238 241 239 242 # XXX EAM : note that in mysql versions later than 5.1, this fails … … 246 249 self.scratchDb.execute("set session old_alter_table=1") 247 250 248 self.scratchDb.execute("ALTER IGNORE TABLE gaiaFrameCoordinate ADD UNIQUE INDEX(objID)")251 self.scratchDb.execute("ALTER IGNORE TABLE GaiaFrameCoordinate ADD UNIQUE INDEX(objID)") 249 252 if self.scratchDb.version > 5.1: 250 253 self.scratchDb.execute("set session old_alter_table=0") 251 254 252 rowCountAfter = self.scratchDb.getRowCount(" gaiaFrameCoordinate")255 rowCountAfter = self.scratchDb.getRowCount("GaiaFrameCoordinate") 253 256 self.logger.infoPair("Number of duplicated objIDs removed", "%d out of %d" % ((rowCountBefore - rowCountAfter), rowCountBefore)) 254 257
Note:
See TracChangeset
for help on using the changeset viewer.
