Esempio n. 1
0
def main():
    srcs = find_glider_files(filename = '??.mdr')
    srcs = sorted([mdr_parser.parse(src)[1] for src in srcs], key = lambda x: x.mtime, reverse= True)
    moor = []
    for src in srcs[:]:
        if (src.station_name(),src.mooring_name()) not in [(mdr.station_name(),mdr.mooring_name()) for mdr in moor] and src.mooring_name() is not None:
            moor.append(src)

    rem_station = ''
    lines = []
    for mdr in sorted(moor, key = lambda x: x.platformID):
        if rem_station != mdr.station_name():
          rem_station = mdr.station_name()
          lines.append('{} ({})'.format(rem_station, e2ts(mdr.mtime)))

        lines.append('    {}    = {}'.format(mdr.mooring_name(),mdr.filename))
        lines.append('    Gap Sum = {} kb'.format(mdr.gap_sum()/10**3))
        lines.append('    Gap Num = {}'.format(mdr.gap_num()))
        lines.append('    Percent Collected = {} %'.format(mdr.percent()))
        lines.append('    Total Collected   = {} kb'.format(mdr.collected()/10**3))
        lines.append('')

    with open(os.path.join('gliderops','report','output', 'mdr_report.txt'), 'w') as f:
        for line in lines:
            f.write(line + os.linesep)
Esempio n. 2
0
def thru_test():
    #src = SourceFile('cp_376-2016-148-3-96.sbd')
    src = find_glider_files(filename='cp_376-2016-148-3-90.sbd')[0]
    print(src)

    sensors, parsed_src = parse_master(src)
    m_depth = filter(lambda x: x.name=='m_depth', sensors).__next__()
    print(parsed_src)
    m_depth.xy[-1] = (m_depth.xy[-1][0] + 27, m_depth.xy[-1][1])
    print(m_depth)

    print();print('MSENSORing')
    mm_depth = MSensor.from_sensor(m_depth)
    print(mm_depth)
    for s in mm_depth:
        print(s)

    res = store2mongo('cp_376',m_depth)
    res = store2mongo('cp_376',parsed_src)
    print(res)