Пример #1
0
def test_buoy_parser_04():
#    datafile = '/Users/egg/Temp/oceancurrents/globaldrifter/buoydata_5001_sep12.dat'
    datafile = 'test_resources/buoydata.dat'
    parser = buoyparsers.GlobalDrifterParser()
    my_nearness_function = get_nearness_function(-33, 25) #big cluster between cuba and africa
    combined_criterion_function = create_combined_criterion((record_length, my_nearness_function))
    doc = parser.parse(datafile,
                       num_buoys=4,
                       criterion_function=combined_criterion_function,
                       start=datetime(2012, 06, 01), end=datetime(2012, 10, 01), maxlines=None)
    renderer = CSVRenderer()
    result = renderer.render(doc, print_to_screen=False, filename='/tmp/out.txt')
    known_result = '26.592,324.555,27.123,41.963,5.79,7.73,26.158,324.069,27.386'
    assert known_result in result
Пример #2
0
def csv(doc):
    csvrenderer = CSVRenderer()
    result = csvrenderer.render(doc, print_to_screen=False, filename='/tmp/out.txt')
    return result