IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 14, 2012, 12:02:48 PM (14 years ago)
Author:
rhenders
Message:

Big changes to support a new Config class that encapuslates the xml config file

File:
1 edited

Legend:

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

    r33234 r33259  
    1616from java.lang import *
    1717from java.sql import *
    18 from xml.etree.ElementTree import ElementTree, Element, tostring
    1918
    2019
     
    3534
    3635    '''
    37     def __init__(self, logger, doc):
     36    def __init__(self, logger, config):
    3837
    3938        # set up logging
    4039        self.logger = logger
    41         self.doc = doc
     40        self.config = config
    4241        self.logger.infoSeparator()
    43         self.dvoLocation = self.doc.find("dvo/location").text
    4442
    4543        # create database object
    46         self.scratchDb = ScratchDb(logger, self.doc, 1)
     44        self.scratchDb = ScratchDb(logger, self.config, 1)
    4745
    4846        # 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)
    5048
    5149        # set up empty lists
     
    5755
    5856        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)? ")
    6059            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)? ")
    6261                if response == "y":
    6362                    self.resetAllTables()
     
    101100
    102101        # check if we have up-to-date version
    103         path = self.dvoLocation + "/Images.dat"
     102        path = self.config.dvoLocation + "/Images.dat"
    104103        if self.scratchDb.alreadyImportedThisDvoTable(path):
    105104            self.logger.infoPair("DVO Images.dat file", "up-to-date")
     
    156155        if not self.correctDvo: return
    157156
    158         path =  self.dvoLocation + "/SkyTable.fits"
     157        path =  self.config.dvoLocation + "/SkyTable.fits"
    159158        if self.scratchDb.alreadyImportedThisDvoTable(path):
    160159            self.logger.infoPair("DVO SkyTable.fits file", "up-to-date")       
     
    173172       
    174173        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)
    176175
    177176    '''
     
    181180
    182181        halfSide = side/2.0
     182        print "%f %f %f" % (ra, dec, side)
    183183        self.setSkyArea(ra-halfSide, ra+halfSide, dec-halfSide, dec+halfSide)
    184184   
     
    208208
    209209        # reset all lists
    210         allRegions = self.scratchDb.getDvoRegionsForThisBox(minRa, maxRa, minDec, maxDec)
     210        allRegions = self.scratchDb.getDvoRegions(minRa, maxRa, minDec, maxDec)
    211211        allIngestedRegions = self.scratchDb.getIngestedDvoRegions()
    212212        self.regionsToIngest = []
     
    219219        for region in allRegions:
    220220
    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"
    223223
    224224           # check for existence of cpm and cpt files
     
    262262        # go no further if we've already partly ingested a different DVO
    263263        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)
    265265            return
    266266
     
    327327
    328328            # 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")
    331331
    332332        return size
     
    357357        for region in self.regionsToIngest:
    358358
    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"
    361361
    362362           cpmTableName = self.scratchDb.getDbFriendlyTableName(region + ".cpm")
Note: See TracChangeset for help on using the changeset viewer.