Beispiel #1
0
 def process(self, filename, csv_folder):
     #unzip file
     with zipfile.ZipFile(filename) as myzip:
         for name in myzip.namelist():
             myzip.extract(name, csv_folder)
     #get the protocol file
     protocol_path = os.path.join(csv_folder, "protocol.obsprot")
     fgdb_folder = self.root_folder
     database, protocol_json = CsvLoader.DatabaseCreator.database_for_protocol_file(protocol_path, fgdb_folder)
     #CSVLoad file
     CsvLoader.process_csv_folder(csv_folder, protocol_json, database)
Beispiel #2
0
def process(archive):
    extraction_folder = tempfile.mkdtemp()
    try:
        # unzip file
        with zipfile.ZipFile(archive) as myzip:
            for name in myzip.namelist():
                myzip.extract(name, extraction_folder)
        # get the protocol file
        protocol_path = os.path.join(extraction_folder, "protocol.obsprot")
        fgdb_folder = os.path.dirname(archive)
        database, protocol_json = CsvLoader.DatabaseCreator.database_for_protocol_file(protocol_path, fgdb_folder)
        # CSVLoad file
        CsvLoader.process_csv_folder(extraction_folder, protocol_json, database)
    finally:
        shutil.rmtree(extraction_folder)