Fetching offline data

Use the connection.fetch() method to retrieve data spanning a range of GPS times and a list of channel names.

If the requested data range comprises multiple buffers, connection.fetch() will concatenate and trim the buffers as required to match the requested time range.

Warning

If your request includes one or more minute-trend channels, then the GPS start and stop time arguments must be divisible by 60.

Example 4.13. Fetching offline data in Python


As these requests are for older data explicitly allow data on tape.
>>> conn.set_parameter('ALLOW_DATA_ON_TAPE', '1')

Arguments are start and stop times in GPS seconds and a list of channel names.
>>> buffers = conn.fetch(1024417918, 1024417928, ['H1:PSL-ISS_PDA_OUT_DQ', 'H1:PSL-ISS_PDB_OUT_DQ'])

The return value of fetch() is a sequence of nds2.buffer objects.
>>> print buffers
('<H1:PSL-ISS_PDA_OUT_DQ (GPS time 1024417918.000000000, 327680 samples)>', '<H1:PSL-ISS_PDB_OUT_DQ (GPS time 1024417918.000000000, 327680 samples)>')

Each buffer object has a channel property which provides information about the channel.
>>> print buffers[0].channel
<H1:PSL-ISS_PDA_OUT_DQ (32768Hz, RAW, FLOAT32)>
>>> print buffers[0].channel.sample_rate
32768.0

Each buffer object also has properties called gps_seconds and gps_nanoseconds that relate the buffer's timestamp.
>>> print buffers[0].gps_seconds, buffers[0].gps_nanoseconds
1024417918 0

Finally, each buffer's numerical content is in the property called data.
>>> buffers[0].data
array([ 2.39337158,  2.39943528,  2.38724732, ...,  2.39846468,
        2.39515495,  2.39528942], dtype=float32)

Example 4.14. Fetching offline data in Octave

As these requests are for older data explicitly allow data on tape.
octave:1> conn.set_parameter('ALLOW_DATA_ON_TAPE', '1')

Arguments are start and stop times in GPS seconds and a list of channel names.
octave:2> buffers = conn.fetch(1024417918, 1024417928, {'H1:PSL-ISS_PDA_OUT_DQ', 'H1:PSL-ISS_PDB_OUT_DQ'})

The return value of fetch() is a cell array of nds2.buffer objects.
octave:3> buffers
buffers =
(
  [1] =

<H1:PSL-ISS_PDA_OUT_DQ (GPS time 1024417918.000000000, 327680 samples)>
  [2] =

<H1:PSL-ISS_PDB_OUT_DQ (GPS time 1024417918.000000000, 327680 samples)>
)

Each buffer object has a channel property which provides information about the channel.
octave:4> buffers{1}.channel
ans =

<H1:PSL-ISS_PDA_OUT_DQ (32768Hz, RAW, FLOAT32)>
octave:5> buffers{1}.channel.sample_rate
ans =  32768

Each buffer object also has properties called gps_seconds and gps_nanoseconds that relate the buffer's timestamp.
octave:6> buffers{1}.gps_seconds
ans =  1.0244e+09
octave:7> buffers{1}.gps_nanoseconds
ans = 0

Finally, each buffer's numerical content is in the property called data.
octave:8> buffers{1}.data
ans =

   2.3934
   2.3994
   2.3872
   2.3891
   ...

Example 4.15. Fetching offline data in MATLAB

As these requests are for older data explicitly allow data on tape.
>> conn.setParameter('ALLOW_DATA_ON_TAPE', '1')

Arguments are start and stop times in GPS seconds and a list of channel names.
>> buffers = conn.fetch(1024417918, 1024417928, {'H1:PSL-ISS_PDA_OUT_DQ', 'H1:PSL-ISS_PDB_OUT_DQ'})

The return value of fetch() is a cell array of nds2.buffer objects.
>> buffers

buffers =

nds2.buffer[]:
    [nds2.buffer]
    [nds2.buffer]

Each buffer object has a channel property which provides information about the channel.
>> buffers(1).getChannel()

ans =

<H1:PSL-ISS_PDA_OUT_DQ (32768Hz, RAW, FLOAT32)>

>> buffers(1).getChannel().getSampleRate()

ans =

       32768

Each buffer object also has properties called gps_seconds and gps_nanoseconds that relate the buffer's timestamp.
>> buffers(1).getGpsSeconds()

ans =

   1.0244e+09

>> buffers(1).getGpsNanoseconds()

ans =

     0

Finally, each buffer's numerical content is in the property called data.
>> buffers(1).getData()

ans =

    2.4013
    2.3873
    2.3949
    2.3995
    ...