logfile = os.path.normpath(OutDirName + '/fauna.log') try: os.remove(logfile) except OSError: pass if args.verbose: logging.basicConfig(format='%(levelname)s: %(message)s', filename=logfile, level=logging.DEBUG) else: logging.basicConfig(format='%(levelname)s: %(message)s', filename=logfile, level=logging.INFO) if format == '2010': survey = tools_lib.import_survey(InFileNameFauna, 'p_muestreo_pl', 1) if format == '2015': survey = tools_lib.import_survey(InFileNameFauna, 'nombre_pm', 1) # Import the different fauna species list species_list = {} for i in [ InFileNameSpeciesBirds, InFileNameSpeciesMammals, InFileNameSpeciesReptiles, InFileNameSpeciesAmphibans ]: with open(i, 'rb') as csvfile: datareader = csv.DictReader(csvfile, delimiter=',') for row in datareader: species = class_lib.Species(row['no'], row['code'], row['scientific_name']) species.common_name = row['synonyms']
if format not in ['2015']: error_msg = " The specified format: \"{format}\" is currently not supported".format( format=format) print error_msg sys.exit(0) if args.LogFileName: logfile = args.LogFileName else: file, ext = os.path.splitext(OutFileName) logfile = os.path.normpath(file + '.log') try: os.remove(logfile) except OSError: pass if args.verbose: logging.basicConfig(format='%(levelname)s: %(message)s', filename=logfile, level=logging.DEBUG) else: logging.basicConfig(format='%(levelname)s: %(message)s', filename=logfile, level=logging.INFO) survey = tools_lib.import_survey(InFileNamePlots, 'nombre_pm', 1) species_list = tools_lib.import_species_list(InFileNameSpecies) import_regeneration(survey, species_list, InFileNamePlots, format, verbose) survey.export_regeneracion(OutFileName)