argman.add_argument( '-d2', '--end_date', dest='end_date', action='store', type=catcm.date_string_to_objects, default=catcm.cfg_territory_end_date, help='Limit points shown to before this date. YYYY-MM-DD.' ) # Using the argument parser to do a lot of work: # * Prefer command line arguments # * Fall back on config file values # * Convert to appropriate types # * Check validity of arguments args = argman.parse_args() # Make sure integer arguments are in a reasonable range. args.dot_size = catcm.constrain_integer(args.dot_size, 2, 100) args.perimeter_resolution = catcm.constrain_integer(args.perimeter_resolution, 1, 120) # Open and process the data file with open(args.datafile_path, 'rt') as datafile: csvrows = csvreader(datafile) # Limit to certain cats, if requested if args.catids: csvrows = [csvrow for csvrow in csvrows if csvrow[int(catcm.cfg_data_column_catid)] in args.catids] # If no rows were retrieved, warn user that cat is not represented in the current data if not csvrows: sys.exit('No CSV data was found after checking cat ids. Cat ids were {}.'.format(','.join(args.catids))) # Create a new DataPool object to work with
argman.add_argument( '-z', '--crossingid', dest='crossingid', action='store', type=str, default=False, help='Zoom in on a specific crossing.' ) # Using the argument parser to do a lot of work: # * Prefer command line arguments # * Fall back on config file values # * Convert to appropriate types # * Check validity of arguments args = argman.parse_args() # Make sure integer arguments are in a reasonable range. args.radius = catcm.constrain_integer(args.radius, 0, 1000) args.time_cutoff = catcm.constrain_integer(args.time_cutoff, 0, 31536000) # Create a SunMetrics object so any fixes can compute day and night sun_metrics = catsm.SunMetrics() # Open and process the data file with open(args.datafile_path, 'rt') as datafile: csvrows = csvreader(datafile) # Limit to certain cats, if requested if args.catids: csvrows = [csvrow for csvrow in csvrows if csvrow[int(catcm.cfg_data_column_catid)] in args.catids] # If no rows were retrieved, warn user that cat is not represented in the current data if not csvrows:
'--clusterid', dest='clusterid', action='store', type=str, default=False, help='Zoom in on a specific cluster.') # Using the argument parser to do a lot of work: # * Prefer command line arguments # * Fall back on config file values # * Convert to appropriate types # * Check validity of arguments args = argman.parse_args() # Make sure integer arguments are in a reasonable range. args.radius = catcm.constrain_integer(args.radius, 0, 1000) args.time_cutoff = catcm.constrain_integer(args.time_cutoff, 0, 31536000) args.minimum_count = catcm.constrain_integer(args.minimum_count, 0, 100) args.minimum_stay = catcm.constrain_integer(args.minimum_stay, 0, 8640000) # Create a SunMetrics object so any fixes can compute day and night sun_metrics = catsm.SunMetrics() # Open and process the data file with open(args.datafile_path, 'rt') as datafile: csvrows = csvreader(datafile) # Limit to just one cat csvrows = [ csvrow for csvrow in csvrows if csvrow[int(catcm.cfg_data_column_catid)] == args.catid
'--time_cutoff', dest='time_cutoff', action='store', type=catcm.hours_arg_to_seconds, default=catcm.cfg_matchsurvey_time_cutoff, help='Design time cutoff of a match, in hours.') # Using the argument parser to do a lot of work: # * Prefer command line arguments # * Fall back on config file values # * Convert to appropriate types # * Check validity of arguments args = argman.parse_args() # Make sure integer arguments are in a reasonable range. args.radius = catcm.constrain_integer(args.radius, 0, 1000) args.time_cutoff = catcm.constrain_integer(args.time_cutoff, 0, 31536000) #print('Process the data file...') # Open and process the data file with open(args.datafile_path, 'rt') as datafile: csvrows = csvreader(datafile) # Create a new DataPool object to work with datapool = catms.MSDataPool(args.radius, args.time_cutoff) # For every row, create a Fix object and it to the DataPool for csvrow in csvrows: try: new_fix = catcm.Fix(csvrow)
argman.add_argument( '-z', '--clusterid', dest='clusterid', action='store', type=str, default=False, help='Zoom in on a specific cluster.' ) # Using the argument parser to do a lot of work: # * Prefer command line arguments # * Fall back on config file values # * Convert to appropriate types # * Check validity of arguments args = argman.parse_args() # Make sure integer arguments are in a reasonable range. args.radius = catcm.constrain_integer(args.radius, 0, 1000) args.time_cutoff = catcm.constrain_integer(args.time_cutoff, 0, 31536000) args.minimum_count = catcm.constrain_integer(args.minimum_count, 0, 100) args.minimum_stay = catcm.constrain_integer(args.minimum_stay, 0, 8640000) # Create a SunMetrics object so any fixes can compute day and night sun_metrics = catsm.SunMetrics() # Open and process the data file with open(args.datafile_path, 'rb') as datafile: csvrows = csvreader(datafile) # Limit to just one cat csvrows = [csvrow for csvrow in csvrows if csvrow[1] == args.catid] # If no rows were retrieved, warn user that cat is not represented in the current data
'--end_date', dest='end_date', action='store', type=catcm.date_string_to_objects, default=catcm.cfg_territory_end_date, help='Limit points shown to before this date. YYYY-MM-DD.') # Using the argument parser to do a lot of work: # * Prefer command line arguments # * Fall back on config file values # * Convert to appropriate types # * Check validity of arguments args = argman.parse_args() # Make sure integer arguments are in a reasonable range. args.dot_size = catcm.constrain_integer(args.dot_size, 2, 100) args.perimeter_resolution = catcm.constrain_integer(args.perimeter_resolution, 1, 120) # Open and process the data file with open(args.datafile_path, 'rt') as datafile: csvrows = csvreader(datafile) # Limit to certain cats, if requested if args.catids: csvrows = [ csvrow for csvrow in csvrows if csvrow[int(catcm.cfg_data_column_catid)] in args.catids ] # If no rows were retrieved, warn user that cat is not represented in the current data