Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Instruments Configuration

Diana Norgaard edited this page Apr 8, 2019 · 2 revisions

Winston has the ability to store instrument location in the database. Configuring should alleviate the need to configure locations in the external software (e.g. DataSources.config in Swarm) if that software is capable of retrieving location from Winston. It will also allow custom applications to get this information through the Winston API. Below are the instructions on how to configure the instrument location in Winston:

  • Connect to Winston MySQL database

    • mysql -u root -p (you will be prompted for password after hitting enter; user name may be different)

    • MariaDB [W_ROOT]> use W_ROOT;

  • The locations are configured in the instruments table: MariaDB [W_ROOT]> show columns from instruments;

+-------------+--------------+------+-----+---------+----------------+
| Field       | Type         | Null | Key | Default | Extra          |
+-------------+--------------+------+-----+---------+----------------+
| iid         | int(11)      | NO   | PRI | NULL    | auto_increment |
| name        | varchar(255) | YES  | UNI | NULL    |                |
| description | varchar(255) | YES  |     | NULL    |                |
| lon         | double       | YES  |     | -999    |                |
| lat         | double       | YES  |     | -999    |                |
| height      | double       | YES  |     | -999    |                |
| timezone    | varchar(128) | YES  |     | NULL    |                |
+-------------+--------------+------+-----+---------+----------------+
  • Instrument table columns:

    • iid - Instrument ID. This can be auto-generated so it is not necessary to be specified.

    • name - Use the 1-5 character station name, e.g. FG8.

    • description - Description of the station, e.g. Fuego

    • lon - Longitude in DD; e.g. -90.9359

    • lat - Latitude in DD; e.g. 14.4325

    • height - elevation in meters; e.g. 3636

    • timezone - Timezone used to stamp time on the data. This is typically UTC and can be left blank. If the instruments are configured to stamp time using localtime, this should be configured.

  • Add data to the instruments table

    • MariaDB [W_ROOT]> insert into instruments values (NULL, 'FG8','Fuego', -90.9359, 14.4325, 3636, NULL);

      • The iid will automatically be generated.

      • See above for description of columns.

    • Repeat for all other stations.

  • To view contents of table: use W_ROOT;

    • MariaDB [W_ROOT]> select * from instruments;

+-----+-------+---------------------------+-----------+----------+--------+----------+
| iid | name  | description               | lon       | lat      | height | timezone |
+-----+-------+---------------------------+-----------+----------+--------+----------+
|  16 | FG8   | Fuego, Guatemala          |  -90.9359 |  14.4325 |   3636 | NULL     |
|  17 | STG7  | Guatemala                 | -91.58876 | 14.77487 |   3370 | NULL     |
|  18 | MOY   | Guatemala                 | -90.07833 |  14.0495 |   1320 | NULL     |
|  31 | STG6  | Guatemala                 |   -91.526 | 14.80484 |   -999 | NULL     |
+-----+-------+---------------------------+-----------+----------+--------+----------+
  • Now that we have data in the instruments table, we have to map the channels to the stations. The channels table will contain an iid column that is blank and needs to be populated.

    • MariaDB [W_ROOT]> show columns from channels;

+---------+--------------+------+-----+---------+----------------+
| Field   | Type         | Null | Key | Default | Extra          |
+---------+--------------+------+-----+---------+----------------+
| sid     | int(11)      | NO   | PRI | NULL    | auto_increment |
| iid     | int(11)      | YES  |     | NULL    |                |
| code    | varchar(50)  | YES  |     | NULL    |                |
| st      | double       | YES  |     | NULL    |                |
| et      | double       | YES  |     | NULL    |                |
| alias   | varchar(255) | YES  |     | NULL    |                |
| unit    | varchar(255) | YES  |     | NULL    |                |
| linearA | double       | YES  |     | 1e300   |                |
| linearB | double       | YES  |     | 1e300   |                |
+---------+--------------+------+-----+---------+----------------+
  • Update the channels table:

    • MariaDB [W_ROOT]> update channels a join instruments b on a.code like concat(b.name,'$%$%') set a.iid=b.iid;

  • Check channels table:

    • MariaDB [W_ROOT]> select a.code, b.iid, b.name, b.description from channels a join instruments b on a.iid=b.iid;

+----------------+-----+-------+------------------------------------+
| code           | iid | name  | description                        |
+----------------+-----+-------+------------------------------------+
| FG3$SHZ$GI$01  |  19 | FG3   | Fuego (analog), Guatemala          |
| FG3$SHE$GI$01  |  19 | FG3   | Fuego (analog), Guatemala          |
| FG3$SHN$GI$01  |  19 | FG3   | Fuego (analog), Guatemala          |
| FG8$BHN$GI$00  |  16 | FG8   | Fuego, Guatemala                   |
| FG8$BHE$GI$00  |  16 | FG8   | Fuego, Guatemala                   |
| CRIN$HHE$NU    |  33 | CRIN  | San Cristobal, Nicaragua           |
| CRIN$HHN$NU    |  33 | CRIN  | San Cristobal, Nicaragua           |
| CRIN$HHZ$NU    |  33 | CRIN  | San Cristobal, Nicaragua           |
| HERN$HHE$NU    |  34 | HERN  | Herminio, Volcan Telica, Nicaragua |
| HERN$HHN$NU    |  34 | HERN  | Herminio, Volcan Telica, Nicaragua |
| HERN$HHZ$NU    |  34 | HERN  | Herminio, Volcan Telica, Nicaragua |
| TELN$EHE$NU$00 |  35 | TELN  | Telica, Nicaragua                  |
| TELN$EHN$NU$00 |  35 | TELN  | Telica, Nicaragua                  |
| TELN$EHZ$NU$00 |  35 | TELN  | Telica, Nicaragua                  |
| ACON$HHZ$NU    |  36 | ACON  | Acoyapa, Nicaragua                 |
| BC8A$HNE$NU$00 |  37 | BC8A  | Acelerografo INETER, Nicaragua     |
| BC8A$HNN$NU$00 |  37 | BC8A  | Acelerografo INETER, Nicaragua     |
| BC8A$HNZ$NU$00 |  37 | BC8A  | Acelerografo INETER, Nicaragua     |
| BLUN$HHZ$NU    |  38 | BLUN  | Bluefields, Entresa, Nicaragua     |
| CNGN$HHZ$NU    |  39 | CNGN  | Cerro Negro, Nicaragua             |
| CSGN$EHZ$NU$00 |  40 | CSGN  | Cosiguina, Nicaragua               |
| ESPN$HHZ$NU    |  41 | ESPN  | Las Esperanzas, Nicaragua          |
| MASN$EHE$NU$50 |  42 | MASN  | Volcan Masaya, Nicaragua           |
| MASN$EHN$NU$50 |  42 | MASN  | Volcan Masaya, Nicaragua           |
| MASN$EHZ$NU$50 |  42 | MASN  | Volcan Masaya, Nicaragua           |
| MGAN$BLZ$NU    |  43 | MGAN  | Managua, Nicaragua                 |
+----------------+-----+-------+------------------------------------+
Clone this wiki locally