Exemplo n.º 1
0
  
  if(options.polygons == None):
    parser.print_usage()
    parser.print_help()
    sys.exit(-1)
  
  logger = None  
  try:
    logging.config.fileConfig(options.logConf)
    logger = logging.getLogger("nexrad_proc_logger")
    logger.info("Session started")

    if(logger != None):
      logger.debug("Command line options: %s" % (options)) 
        
    db = xmrgDB(logger)
    if(db.connect(options.databaseFile, options.spatialiteLib) != True):
      logger.debug("Unable to connect to database: %s, cannot continue" %(options.databaseFile))   
  
    #Create our polygon dictionary
    polygons = dict(arg.split('=') for arg in (options.polygons.split(';')))
    
    nexradProc = nexradProcess(options.bbox, polygons, db, logger, options.outputFile, options.outInches)
    if(options.shapefileDir):
      nexradProc.writeShapefiles(options.shapefileDir)
    if(options.nexradDir):
      nexradProc.importFilesIntoDB(options.nexradDir, options.delFiles)

    if(options.cleanDB):
      import datetime
      from datetime import tzinfo
Exemplo n.º 2
0
        else:
          try:
            #Get optional settings.
            importBBOX = None
            writeImportKMLFile = False
            startSummaryHour = '07:00:00'
            #Params that aren't required
            importBBOX = configFile.get(watershed, 'ImportBBOX')
            writeImportKMLFile = configFile.getboolean(watershed, 'WriteImportKMLFile')
            startSummaryHour = configFile.get(watershed, 'StartSummaryHour')
          except ConfigParser.Error, e:
            if(logger):
              logger.exception(e)
          
          #Make out database object and connect.
          db = xmrgDB()
          if(db.connect(nexradDbFile, spatialiteLib) != True):
            if(logger):
              logger.debug("Unable to connect to database: %s, cannot continue" % (nexradDbFile))   
              sys.exit(-1)

          #We want to check todays date against the control file.
          today = datetime.datetime.now()
          today = today.replace(hour=0,minute = 0,second = 0,microsecond = 0)
          
          checkDate = dateControlFile(dateControlFilename, True)          
          #startDate,endDate = checkDate.getReportingDates(today)
          reportDay, startDate, endDate = checkDate.isReportingDay(today)  
           
          nexradProc = horryCountyNexradProcess(bbox = importBBOX, 
                                     dbObj = db,