Use the method connection.iterate()
to retrieve data progressively or online. Use connection.next()
to grab each chunk as it becomes available. connection.iterate()
supports the following arguments:
Offline, manual step size. connection.iterate(
Request the channels start
, stop
, step
, list_of_channel_names
)list_of_channel_names
, spanning GPS times in seconds from start
to stop
, in blocks of step
seconds.
Offline, automatic step size. connection.iterate(
Same as above, but choose an appropriate start
, stop
, list_of_channel_names
)step
automatically to keep each buffer smaller than 128 MB.
Online, manual step size. connection.iterate(
Request online data for channels step
, list_of_channel_names
)list_of_channel_names
starting from the current GPS time and continuing indefinitely. Transfer data in steps of step
seconds.
Online, autoamtic step size. connection.iterate(
Request online data, but use the shortest possible list_of_channel_names
)step
.
start
, stop
, and step
must be divisible by 60.connection.next()
makes no attempts to trim the received buffers to size.Example 4.16. Grabbing online or offline data progressively in Python
connection.iterate()
returns the original nds2.connection
object, which implements the Python iterator protocol. As a result, you can use connection.iterate()
as the iterator of a for...in
loop.
As these requests are for older data explicitly allow data on tape. >>>conn.set_parameter('ALLOW_DATA_ON_TAPE', '1')
To progressively download offline data in small chunks, callconnection.iterate()
with the same arguments asconnection.fetch()
: GPS start and stop times, and list of channel names. >>>for bufs in conn.iterate(1024417918, 1024417928, ['H1:PSL-ISS_PDA_OUT_DQ', 'H1:PSL-ISS_PDB_OUT_DQ']):
...print bufs
... ('<H1:PSL-ISS_PDA_OUT_DQ (GPS time 1024417918.000000000, 32768 samples)>', '<H1:PSL-ISS_PDB_OUT_DQ (GPS time 1024417918.000000000, 32768 samples)>') ('<H1:PSL-ISS_PDA_OUT_DQ (GPS time 1024417919.000000000, 32768 samples)>', '<H1:PSL-ISS_PDB_OUT_DQ (GPS time 1024417919.000000000, 32768 samples)>') ... Alternatively, to initiate online data retrieval starting from the current time, omit the GPS start and stop time when callingconnection.iterate()
. >>>for bufs in conn.iterate(['H1:PSL-ISS_PDA_OUT_DQ', 'H1:PSL-ISS_PDB_OUT_DQ']):
...print bufs
...
Example 4.17. Grabbing online or offline data progressively in Octave
for...in
loop, but you can retrieve the buffers in a while
loop, checking whether there is more data remaining with connection.has_next()
.
As these requests are for older data explicitly allow data on tape. octave:1>conn.set_parameter('ALLOW_DATA_ON_TAPE', '1')
To progressively download offline data in small chunks, callconnection.iterate()
with the same arguments asconnection.fetch()
: GPS start and stop times, and list of channel names. octave:2>conn.iterate(1024417918, 1024417928, {'H1:PSL-ISS_PDA_OUT_DQ', 'H1:PSL-ISS_PDB_OUT_DQ'});
After callingconnection.iterate()
, callconnection.next()
repeatedly to retrieve bufferes repeatedly. octave:3>while conn.has_next()
>bufs = conn.next();
>disp(bufs);
>end
( [1] = <H1:PSL-ISS_PDA_OUT_DQ (GPS time 1024417918.000000000, 32768 samples)> [2] = <H1:PSL-ISS_PDB_OUT_DQ (GPS time 1024417918.000000000, 32768 samples)> ) ( [1] = <H1:PSL-ISS_PDA_OUT_DQ (GPS time 1024417919.000000000, 32768 samples)> [2] = <H1:PSL-ISS_PDB_OUT_DQ (GPS time 1024417919.000000000, 32768 samples)> ) ... Alternatively, to initiate online data retrieval starting from the current time, omit the GPS start and stop time when callingconnection.iterate()
. octave:5>conn.iterate({'H1:PSL-ISS_PDA_OUT_DQ', 'H1:PSL-ISS_PDB_OUT_DQ'});
octave:6>while conn.has_next()
>bufs = conn.next();
> ...
Example 4.18. Grabbing online or offline data progressively in MATLAB
while conn.hasNext()
loop in MATLAB.
As these requests are for older data explicitly allow data on tape. >>conn.set_parameter('ALLOW_DATA_ON_TAPE', '1')
To progressively download offline data in small chunks, callconnection.iterate()
with the same arguments asconnection.fetch()
: GPS start and stop times, and list of channel names. >>conn.iterate(1024417918, 1024417928, {'H1:PSL-ISS_PDA_OUT_DQ', 'H1:PSL-ISS_PDB_OUT_DQ'});
After callingconnection.iterate()
, callconnection.next()
repeatedly to retrieve bufferes repeatedly. >>while conn.hasNext()
bufs = conn.next();
disp(bufs);
end
nds2.buffer[]: [nds2.buffer] [nds2.buffer] nds2.buffer[]: [nds2.buffer] [nds2.buffer] ... Alternatively, to initiate online data retrieval starting from the current time, omit the GPS start and stop time when callingconnection.iterate()
. >>conn.iterate({'H1:PSL-ISS_PDA_OUT_DQ', 'H1:PSL-ISS_PDB_OUT_DQ'});
>>while conn.hasNext()
bufs = conn.next();
...