Пример #1
0
        if csvrow[int(catcm.cfg_data_column_catid)] == args.catid
    ]

    # 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 for cat with id {}.'.format(
            args.catid))

    # Create a new Trail object, which is a series of fixes
    trail = catfc.FCTrail(args.catid, args.radius, args.time_cutoff,
                          args.minimum_count, args.minimum_stay)

    # For every row, create a Fix object and add it to the Trail
    for csvrow in csvrows:
        try:
            new_fix = catcm.Fix(csvrow, sun_metrics)
        except IndexError:
            sys.stderr.write(
                'CSV row doesn’t have expected number of columns: {}\n'.format(
                    csvrow))
            continue
        except:
            sys.stderr.write(
                'CSV row doesn’t look like data: {}\n'.format(csvrow))
            continue

        # Add the fix to the trail
        trail.fixes.append(new_fix)

# Limit by date, if requested
if args.start_date:
Пример #2
0
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)
        except IndexError:
            sys.stderr.write(
                'CSV row doesn’t have expected number of columns: {}\n'.format(
                    csvrow))
            continue
        except:
            sys.stderr.write(
                'CSV row doesn’t look like data: {}\n'.format(csvrow))
            continue

        # Add the fix to the datapool
        datapool.fixes.append(new_fix)

#print('Find all clusters in the data file...')