Introduction

This documents covers the conversion of SeisComP3 event parameters stored in Barcelona format to SeisComP3 event parameters stored in Erice format. This involves dumping the old database and copy it to the new database.

It is recommended to have two systems with a Barcelona installation and an Erice installation. In this case procede with dumping the database on the Barcelona installation, copy the dumped files to the second system having the Erice installed and procede with converting the database.

If only one system is available then procede with (1) *before* the update to Erice. Then stop the system using "seiscomp stop" and drop the database. Before dropping the database one can dump the SeisComP3 database using mysqldump to be on the safe side:

mysqldump -u sysop -p seiscomp3 > seiscomp3-barcelona.sql

To drop the database irreversibly, execute:

mysql -u sysop -p -D seiscomp3 -h localhost -E "drop database seiscomp3"

All events are now deleted (beside all other information like inventory data).

Now go on installing the Erice release following the instructions in the manual. After completion procede with converting the database.

Dumping the Barcelona database

To dump the Barcelona database use the Barcelona installation! Create a directory anywhere, e.g. mkdir -p /home/sysop/sc3-barcelona-db-dump. Change into this directory, e.g. cd /home/sysop/sc3-barcelona-db-dump and execute the script below.

#!/bin/bash
trap 'echo "script aborted by CTRL-C"; exit 1' SIGINT # traps Ctrl-C (signal 2)

DB="mysql://sysop:sysop@localhost/seiscomp3"

echo "Dump all Barcelona events from $DB"
for i in `scevtls -d $DB`; do
  echo "Processing event $i";
  scxmldump -fPAM -E $i -d $DB | bzip2 > $i.barcelona.bz2;
done

echo "Finished";
exit 0;

Convert and Copy

All following steps require the Erice installation! It it assumed that "setup" and "seiscomp config" has been executed and the database has been initialized and set up properly.

Separate steps

To separate conversion and copying might be more secure in case of an error. You can check each converted file and discard it. It is also more easy to backup the converted event files.

Converting the Barcelona event files

#!/bin/bash
trap 'exit 1' 2 # traps Ctrl-C (signal 2)

echo "Convert all events from Barcelona format to Erice format"
for i in `ls *.barcelona.bz2`; do
  echo "Processing file $i"
  bunzip2 -c $i | sccnv -i scdm0.51:- -o trunk:- | bzip2 > `echo $i | cut -d . -f 1`.erice.bz2
done

Copy the converted Erice event files to database

#!/bin/bash
trap 'exit 1' 2 # traps Ctrl-C (signal 2)

DB="mysql://sysop:sysop@localhost/seiscomp3"

echo "Copy all Erice events to $DB"
for i in `ls *.erice.bz2`; do
  bunzip2 -c $i | scdb -i - -b 1000 -d $DB
done

Single step

This procedure converts and copies the events in one step. The intermediate converted event files are not saved.

#!/bin/bash

trap 'exit 1' 2 # traps Ctrl-C (signal 2)
DB="mysql://sysop:sysop@localhost/seiscomp3"

echo "Convert all events from Barcelona format to Erice format and copy them to $DB"
for i in `ls *.barcelona.bz2`; do
  echo "Processing file $i"
  bunzip2 -c $i | sccnv -i scdm0.51:- -o trunk:- | scdb -i - -b 1000 -d $DB
done