Changeset 33259 for trunk/ippToPsps/jython/dvo.py
- Timestamp:
- Feb 14, 2012, 12:02:48 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/dvo.py (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/dvo.py
r33234 r33259 16 16 from java.lang import * 17 17 from java.sql import * 18 from xml.etree.ElementTree import ElementTree, Element, tostring19 18 20 19 … … 35 34 36 35 ''' 37 def __init__(self, logger, doc):36 def __init__(self, logger, config): 38 37 39 38 # set up logging 40 39 self.logger = logger 41 self. doc = doc40 self.config = config 42 41 self.logger.infoSeparator() 43 self.dvoLocation = self.doc.find("dvo/location").text44 42 45 43 # create database object 46 self.scratchDb = ScratchDb(logger, self. doc, 1)44 self.scratchDb = ScratchDb(logger, self.config, 1) 47 45 48 46 # or decide if we are using the right DVO 49 self.correctDvo = self.scratchDb.isCorrectDvo(self. dvoLocation)47 self.correctDvo = self.scratchDb.isCorrectDvo(self.config.dvoLocation) 50 48 51 49 # set up empty lists … … 57 55 58 56 if not self.correctDvo: 59 response = raw_input("* Wrong DVO is use. Do you want to reset and use '" + self.dvoLocation + "' instead (y/n)? ") 57 print "*******************************************************************************" 58 response = raw_input("**** Wrong DVO in use. Do you want to reset and use '" + self.config.dvoLocation + "' instead (y/n)? ") 60 59 if response == "y": 61 response = raw_input("* Are you ABSOLUTELY sure you want to do this? (y/n)? ")60 response = raw_input("**** Are you ABSOLUTELY sure you want to do this? (y/n)? ") 62 61 if response == "y": 63 62 self.resetAllTables() … … 101 100 102 101 # check if we have up-to-date version 103 path = self. dvoLocation + "/Images.dat"102 path = self.config.dvoLocation + "/Images.dat" 104 103 if self.scratchDb.alreadyImportedThisDvoTable(path): 105 104 self.logger.infoPair("DVO Images.dat file", "up-to-date") … … 156 155 if not self.correctDvo: return 157 156 158 path = self. dvoLocation + "/SkyTable.fits"157 path = self.config.dvoLocation + "/SkyTable.fits" 159 158 if self.scratchDb.alreadyImportedThisDvoTable(path): 160 159 self.logger.infoPair("DVO SkyTable.fits file", "up-to-date") … … 173 172 174 173 self.scratchDb.setImportedThisDvoTable(path) 175 self.logger.infoPair("Finished importing SkyTable at", self. dvoLocation)174 self.logger.infoPair("Finished importing SkyTable at", self.config.dvoLocation) 176 175 177 176 ''' … … 181 180 182 181 halfSide = side/2.0 182 print "%f %f %f" % (ra, dec, side) 183 183 self.setSkyArea(ra-halfSide, ra+halfSide, dec-halfSide, dec+halfSide) 184 184 … … 208 208 209 209 # reset all lists 210 allRegions = self.scratchDb.getDvoRegions ForThisBox(minRa, maxRa, minDec, maxDec)210 allRegions = self.scratchDb.getDvoRegions(minRa, maxRa, minDec, maxDec) 211 211 allIngestedRegions = self.scratchDb.getIngestedDvoRegions() 212 212 self.regionsToIngest = [] … … 219 219 for region in allRegions: 220 220 221 cpmPath = self. dvoLocation + "/" + region + ".cpm"222 cptPath = self. dvoLocation + "/" + region + ".cpt"221 cpmPath = self.config.dvoLocation + "/" + region + ".cpm" 222 cptPath = self.config.dvoLocation + "/" + region + ".cpt" 223 223 224 224 # check for existence of cpm and cpt files … … 262 262 # go no further if we've already partly ingested a different DVO 263 263 if not self.correctDvo: 264 self.logger.infoPair("Wrong DVO in use", self. dvoLocation)264 self.logger.infoPair("Wrong DVO in use", self.config.dvoLocation) 265 265 return 266 266 … … 327 327 328 328 # get combined size of cpm and cpt files 329 size = size + self.getDiskSize(self. dvoLocation + "/" + region + ".cpm")330 size = size + self.getDiskSize(self. dvoLocation + "/" + region + ".cpt")329 size = size + self.getDiskSize(self.config.dvoLocation + "/" + region + ".cpm") 330 size = size + self.getDiskSize(self.config.dvoLocation + "/" + region + ".cpt") 331 331 332 332 return size … … 357 357 for region in self.regionsToIngest: 358 358 359 cpmPath = self. dvoLocation + "/" + region + ".cpm"360 cptPath = self. dvoLocation + "/" + region + ".cpt"359 cpmPath = self.config.dvoLocation + "/" + region + ".cpm" 360 cptPath = self.config.dvoLocation + "/" + region + ".cpt" 361 361 362 362 cpmTableName = self.scratchDb.getDbFriendlyTableName(region + ".cpm")
Note:
See TracChangeset
for help on using the changeset viewer.
