.. _sec-caps-examples: Examples and Recipes ==================== Retrieve real-time data from a CAPS server ------------------------------------------ The :ref:`listed plugins` can be used for exchanging real-time data. .. _sec-caps_data: CAPS server to data processing modules ...................................... Use this recipe to: - Provide data from a Caps server to data processing modules. Recipe: 1. Configure the CAPS server in the module configuration. #. Start the CAPS server #. For data processing use the :ref:`caps or capss RecordStream ` and configure it in the global module configuration: .. code-block:: sh recordstream = caps://localhost:18002 CAPS server to SeedLink clients ............................... Use this recipe to: * Provide data from a CAPS server to external :cite:t:`seedlink` clients. Recipe: #. Configure and start the CAPS server to provide the data. #. Configure a new SeedLink instance **Case 1 - CAPS uses SeedLink plugins for data collection:** Configure a SeedLink client instance on a second computer which will act as a seedlink client and server. **Case 2 - CAPS does not use SeedLink plugins for data collection:** Generate an alias for seedlink on the same computer which will act as a SeedLink client and server. #. Use the plugin *caps* in the SeedLink bindings and configure the plugin to connect to the CAPS server, #. Configure the new SeedLink instance, #. Update configuration of the new SeedLink instance (no module selection), #. Start the new SeedLink instance. Import data into a CAPS server ------------------------------ .. _sec-caps_slink: Real-time import with seedlink plugins ...................................... Use this recipe to: * Fetch data from a SeedLink server or from other sources using standard SeedLink plugins :cite:p:`seedlink` of |scname| and provide them to a CAPS server. Recipe: #. Configure and start the :ref:`CAPS server ` to receive the data, #. Choose and configure the seedlink plugin in the SeedLink bindings configuration, #. Uncheck the parameter *loadTimeTable* in the :cite:t:`seedlink` module configuration. .. code-block:: sh plugins.chain.loadTimeTable = false #. Update the configuration. #. Enable and start :ref:`slink2caps`. Real-time import with CAPS plugins .................................. Use this recipe to: * Fetch data from external source using the CAPS-specific :ref:`CAPS plugins ` and provide them to a CAPS server. Recipe: #. Configure and start the :ref:`CAPS server ` to receive the data, #. Choose and configure the :ref:`CAPS plugin ` in the module configuration, #. Enable and start the plugin. .. _sec-caps_example_offline: Import offline data: miniSEED and other formats ............................................... Use this recipe to: * Populate a CAPS server with offline miniSEED or other typs of data. Recipe: Besides real-time data exchange, data from offline experiments, offline stations or from other offline data archives can be fed into the caps data archive from where they are made available by the caps server. For example, a set of miniSEED data files (".mseed") can be pushed into the caps archive using :ref:`rs2caps` and the :term:`RecordStream` interface "file" (``-I file://``, *file* is default and can be omitted) along with the :ref:`CAPS server `. #. Input one file (file.miniSEED), accept all streams: .. code-block:: sh seiscomp start caps rs2caps -I file.mseed --passthrough #. Input all files ending with .mseed, accept all streams: .. code-block:: sh seiscomp start caps cat *.mseed | rs2caps -I - --passthrough #. Input all files ending with .mseed, accept only streams found in the database: .. code-block:: sh seiscomp start caps cat *.mseed | rs2caps -I - -d mysql://sysop:sysop@localhost/seiscomp -j "" Real-time playbacks ------------------- Use this recipe to: * Play back sorted miniSEED data as in real time using :cite:t:`msrtsimul`. Real-time playbacks can be realized using * A combination of msrtsimul and the CAPS plugin :ref:`rs2caps` or * :cite:t:`seedlink`. When using rs2caps the data can be stored in the CAPS archive or not. When using seedlink then data a kept in the seedlink buffer and :cite:t:`slarchive` can be used to store the data in the SDS archive. .. note:: For playbacks, the input data must be **sorted by end time**. Real-time playback will create **events with fake times**, e.g creationTime, eventTime. Therefore, they should be executed on production system only in exceptional cases, e.g. for whole system validation. Better use dedicated SeisComP3 machines. Starting msrtsimul with the option *-m historic* preserves the time of the data records, thus the pick times. Instead, using **offline playbacks based on XML files** may be the faster and better option to create parameters from historic events. Procedure using CAPS / rs2caps .............................. #. Retrieve miniSEED data from CAPS archive using :ref:`capstool` or other methods. #. Sort miniSEED records by endtime using :ref:`scmssort`: .. code-block:: sh scmssort -E miniSEED_file > miniSEED_file_sorted #. Stop :ref:`caps`, :ref:`slink2caps`, :ref:`rs2caps` and all other active data acquisition. This will stop the real-time data acquisition. #. Execute caps on the command line without archiving the data: .. code-block:: sh caps --read-only .. warning:: As the data are not archived, processing of playback data will be impossible after stopping caps. Only in dedicated playback systems, caps should be used normally without any additional option. #. Playback the sorted miniSEED data using msrtsimul: .. code-block:: sh msrtsimul -v -c miniSEED_file_sorted | rs2caps -I - --passthrough The option ``--passthrough`` ensures that all data are passed to caps. #. Stop caps after the playback and the evaluation are finished #. Start caps and all other real-time data acquisition modules. Procedure using seedlink ........................ 1. Retrieve miniSEED data from CAPS archive using :ref:`capstool`. #. Sort miniSEED records by endtime using :ref:`scmssort`: .. code-block:: sh scmssort -E miniSEED_file > miniSEED_file_sorted #. Activate msrtsimul and activate loadTimeTable in the seedlink configuration: .. code-block:: sh msrtsimul = true plugins.chain.loadTimeTable = true #. Configure the :term:`RecordStream` with seedlink: .. code-block:: sh recordstream = slink://localhost:18000 #. Start seedlink and restart the modules that use the RecordStream interface: .. code-block:: sh seiscomp update-config seiscomp start seedlink seiscomp restart scautopick scamp #. Playback the sorted miniSEED data using msrtsimul: .. code-block:: sh msrtsimul -v miniSEED_file_sorted #. Revert all changes after the playback.