Skip to content

Commit

Permalink
[sceewlog] Improve shakemap script documentation (#69)
Browse files Browse the repository at this point in the history
* Improve shakemap script documentation
* Add shakemap script to EEWscript configuration description
  • Loading branch information
FMassin authored Jan 24, 2025
1 parent 93da250 commit 87ce0b3
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 57 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

* sceewlog

* [#69](https://github.com/SED-EEW/SED-EEW-SeisComP-contributions/pull/69): New script `eew2shakemap` to prepare and run shakemap based on EEW solition via option `EEW.script`.

* [#61](https://github.com/SED-EEW/SED-EEW-SeisComP-contributions/pull/61): New options `FCM.topicnotification` and `FCM.eewmessagecomment` to send notification by topic and/or create an EEW message as a comment of the relevant magnitude.

* scfinder:
Expand Down
7 changes: 5 additions & 2 deletions apps/eew/sceewlog/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ INSTALL(FILES ${descs} DESTINATION ${SC3_PACKAGE_APP_DESC_DIR})
SC_ADD_PYTHON_PROG(sceewdump)

# sceewlog2file
SC_ADD_PYTHON_PROG(sceewlog2file)
SC_ADD_PYTHON_PROG(eew2file)

# eewlogconfplot
SC_ADD_PYTHON_PROG(eewlogconfplot)
SC_ADD_PYTHON_PROG(eewlogconfplot)

# eew2shakemap: make rupture-json and all xml input from db + call shakemap
SC_ADD_PYTHON_PROG(eew2shakemap)
3 changes: 2 additions & 1 deletion apps/eew/sceewlog/descriptions/sceewlog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
magnitude=.. lat=.. lon=.. depth=.. nstorg=.. nstmag=.. ot=.. When the module
is started, the script is tested with argument test=1. An example of a script
preparing a data file for posting on social media is provided with
$SEISCOMP_ROOT/bin/sceewlog2file.
$SEISCOMP_ROOT/bin/eew2file. An example of a script that can be adjusted to run
Shakemap from EEW solutions is provided with $SEISCOMP_ROOT/bin/eew2shakemap.
</description>
</parameter>
<group name="email">
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,26 @@
1. **event_id**: The ID of the earthquake event.
2. **origin_id**: The origin ID associated with the event.
3. **shakemap_flag**: False or True: Flag that determines if ShakeMap calculation shall be exectuted. (optional)
For example, to run the script:
For example, to run the script based on origin ID:
```bash
python eew2shakemap.py --event_id <event_id> --origin_id <origin_id> --shakemap_flag <shakemap_flag>
```
To run the script based on event ID:
```bash
python script_name.py --event_id <event_id> origin_id <origin_id> --shakemap_flag <shakemap_flag>
python eew2shakemap.py --event_id <event_id> --shakemap_flag <shakemap_flag>
```
### Requirements
- Python libraries in lines 40-54
- Strong motion seiscomp database extension
- Shakemap
- Adjust:
- lines 1: the python environment
- lines 57-65: the global variables
- all SQL lines: the postgresql-specific syntax (e.g. replace ".m_" by ".").
"""

import os
Expand Down
2 changes: 1 addition & 1 deletion apps/eew/scfinder/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ IF(FinDer_FOUND)
utils/makeFinDerPlot.py
utils/makeFinDerPlot.sh
)
SC_INSTALL_DATA(FD ${FinDer_FOUND})
SC_INSTALL_DATA(FD FinDer)
ENDIF(SC_GLOBAL_PYTHON_WRAPPER)

ELSE(FinDer_FOUND)
Expand Down
103 changes: 52 additions & 51 deletions doc/apps/sceewlog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,57 +46,6 @@ to configuration of the ActiveMQ broker.
Please refer to `ActiveMQ`_ for setting up an ActiveMQ broker.


Firebase Cloud Messaging
========================
EEW messages are controlled by the parameters Magnitude Association and Regionalized Profiles. Notifications are sent using the `HTTP v1`_ when topic notification option is enabled and it requires the following python libraries:

.. code-block:: sh
google
requests
google-auth-oauthlib
firebase-admin
Further information on the Firebase Cloud Messaging interface can be found in `Firebase Cloud Messaging`_. This interface is activated in the module configuration file with the option:

.. code-block:: sh
FCM.activate = true
When this is enable then two options are possible:

1) For **sending push notification to a topic**:

.. code-block:: sh
FCM.topicnotification = true
In this case the configuration file defined in *FCM.dataFile* must be provided and containing the firebase configuration. Additionally, the python libraries mentioned above must be installed. The configuration file includes the path to a service JSON (see the Firebase project console `Service JSON File`_), the broadcasted topic (notification topic), the project ID string (see `Project ID`_), and it controls (enable or disable) notification to Android, iOS and a legacy notification format.
Below is an example how this file, referenced in the *FCM.dataFile*, looks like:

.. code-block:: python
[TOPICS]
topic=eqAlerts
[SERVICEFILE]
servicefile= /opt/fcm/credentials/projectServiceFile.json
[PROJECTID]
projectid = myappid
[ENABLED_OS]
android = true
ios = true
[SUPPORT_OLD_FORMAT]
oldformat = true
2) For creating an **eew message dictionary**:


.. code-block:: sh
FCM.eewmessagecomment = true
In this case this message contains the EQ origin information. It will be added as a comment type: *eewmessage* and text will be the message dictionary. In addition to this, the comment will be sent to the messaging system so that any other module can listen to this comment.

.. _sceewlog-reports:

Reports
Expand Down Expand Up @@ -247,6 +196,58 @@ For the *stationMagNumber* evaluation is necessary to have a similar list of Mag
In this example for the mag type *Mfd* is necessary to at least have 7 stations to pass this evaluation, otherwise, the evaluation ends. For *MVS* must be at least 4 stations that have been used to qunatify the magnitude, otherwise, the valution ends.


Firebase Cloud Messaging
========================
EEW messages are controlled by the parameters Magnitude Association and Regionalized Profiles. Notifications are sent using the `HTTP v1`_ when topic notification option is enabled and it requires the following python libraries:

.. code-block:: sh
google
requests
google-auth-oauthlib
firebase-admin
Further information on the Firebase Cloud Messaging interface can be found in `Firebase Cloud Messaging`_. This interface is activated in the module configuration file with the option:

.. code-block:: sh
FCM.activate = true
When this is enable then two options are possible:

1) For **sending push notification to a topic**:

.. code-block:: sh
FCM.topicnotification = true
In this case the configuration file defined in *FCM.dataFile* must be provided and containing the firebase configuration. Additionally, the python libraries mentioned above must be installed. The configuration file includes the path to a service JSON (see the Firebase project console `Service JSON File`_), the broadcasted topic (notification topic), the project ID string (see `Project ID`_), and it controls (enable or disable) notification to Android, iOS and a legacy notification format.
Below is an example how this file, referenced in the *FCM.dataFile*, looks like:

.. code-block:: python
[TOPICS]
topic=eqAlerts
[SERVICEFILE]
servicefile= /opt/fcm/credentials/projectServiceFile.json
[PROJECTID]
projectid = myappid
[ENABLED_OS]
android = true
ios = true
[SUPPORT_OLD_FORMAT]
oldformat = true
2) For creating an **eew message dictionary**:


.. code-block:: sh
FCM.eewmessagecomment = true
In this case this message contains the EQ origin information. It will be added as a comment type: *eewmessage* and text will be the message dictionary. In addition to this, the comment will be sent to the messaging system so that any other module can listen to this comment.


Headline Change for CAP1.2 XML alerts
=====================================

Expand Down

0 comments on commit 87ce0b3

Please sign in to comment.