コード例 #1
0
def chunk_n_fetch():
    start,end,sbd = chunklist('cp_376', 'segment', 8)
    ssor = fetch_sensor('cp_376','m_depth', startime=start, endtime=end, truncate=True)

    pprint(sbd)
    print('XBD_File end:', e2ts(sbd['end']), e2ts(end))
    print(ssor)
コード例 #2
0
def load_sensor(glider: str, sensor: str) -> dict:
    try:
        #print(sensor)
        sensor = mongoman.fetch_sensor(glider, sensor)
        times = [int(s*10**3) for s in sensor.x()]

        return dict(x=times, y=sensor.y())
    except IndexError:
        print('{} {} empty'.format(glider, sensor))
        return dict(x=[], y=[])
コード例 #3
0
def load_sensor(glider: str, sensor: str, chunkation: str or int, index: int) -> (dict, tuple):
    try:
        #print(sensor)
        if chunkation != '-ALL-':
            if chunkation == '24hr':
                chunkation = 24*60*60
            elif chunkation == '30days':
                chunkation = 30*24*60*60
            startend = mongoman.chunklist(glider, chunkation, index)
        else:
            startend = [None,None] #everything

        sensor = mongoman.fetch_sensor(glider, sensor, startime = startend[0], endtime = startend[1])
        times = [int(s*10**3) for s in sensor.x()]

        return dict(x=times, y=sensor.y()), startend
    except IndexError:
        print('{} {} empty'.format(glider, sensor))
        return dict(x=[], y=[]), startend