Exemplo n.º 1
0
  def degrib(self):
    """
    degribs the file
    gribName: file with whole directory specified. Ex. C:\my_data\gribFile

    output : with whole directory specified
    cformat: format to convert the file. Csv, Shp.

    msg: Which message to convert if 0 it will convert the whole file.
    """
    for variable in self.variablesDicts:
      degribFiles = util.findFiles(variable.get_name(), self.directory)
      logger.debug("Got files: %s" % degribFiles)
      for degribFile in degribFiles:
        self.__degribFile(degribFile, variable)
Exemplo n.º 2
0
  def upload(self, pattern, directory, variable):
    """
    Uploads the files found with specified pattern.

    pattern - If in need to upload more than one file, using wildcards. Else just use the filename to upload the file
    directory - directory to look for the files.
    variable - which variable to upload the found files

    """
    uploads = util.findFiles(pattern, directory)
    uploads = map(os.path.basename, uploads)
    remotedir = urlparse.urljoin(self.rootdir, variable)
    #If '/' is missing, it needs to append one to comply with wput
    if remotedir[-1] != '/':
      remotedir += '/'
    logger.debug("Remotedir:" + remotedir)
    self.ftp.wput(directory, remotedir, uploads)