Ejemplo n.º 1
0
Archivo: noaa.py Proyecto: alcm-b/metar
 def action(self):
     file = NoaaCycle.current_file()
     local_dir = self.download_dir + '/' + NoaaCycle.current_date()
     # 2do select FTP client depending on configuration (development|production)
     # mock-up client for a while
     session = FTP2(self.ftp_host)
     self.log.info("Connected to %s" % self.ftp_host)
     self.log.info("Downloading %s/%s" % (self.remote_dir, file))
     try:
         session.login() 
         session.cwd(self.remote_dir)
         self.download(session, local_dir, file)
     except Exception, e:
         self.log.error("%s" % e)
Ejemplo n.º 2
0
Archivo: noaa.py Proyecto: alcm-b/metar
 def download_all(self, session, file):
     # read the filelist
     newfiles = session.nlst()
     self.log.debug("Got a file list: "+newfiles)
     local_dir = self.download_dir + '/' + NoaaCycle.current_date()
     files     = newfiles.splitlines()
     [self.download(session, local_dir, file) for file in files]
Ejemplo n.º 3
0
 def listFiles(self):
     """
     Get the list of files to be archived
     """
     current_month = NoaaCycle.last_month()
     # 2do archive contain extra path: data/noaa/metar/2011-* ; better is 2011-*
     dir_regex    = os.path.join(self.download_dir, "%s-*" % current_month)
     self.archive_name = os.path.join(self.download_dir, current_month)
     return glob.glob(dir_regex)