Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Below are examples of definitions in the script and the corresponding menu items:

# !SWIP5
# !MENU Create IS-EPOS catalog

Python→Create IS-EPOS catalog

# !SWIP5
# !MENU Create catalogs
# !MENU IS-EPOS catalog

Python→Create catalogs→IS-EPOS catalog

# !SWIP5
# !TOP MENU Filters
# !MENU Python filter

Filters→Python filter

Anchor
Konfiguracja przekazywania danych do programu Python
Konfiguracja przekazywania danych do programu Python
Configuring data transfer to Python scripts

The lines that define how to pass data to Python must be below the lines that define the menus. Depending on the appropriate lines at the beginning of the script, the appropriate data is passed to the Python program. It is presented in the table below



Data exported to python

Python script line

1

Current event. If SWIP has loaded many events, only the current (selected) phenomenon is transferred (see working on multiple events). The parameters of the event are available in the script as a QuakeML global variable catalogSWIP5.

# !CURRENT EVENT

2

The entire QuakeML structure, including all loaded phenomena, is passed to the Python environmen. This is useful, for example, when in Python we have functions to create a catalog or we want to study the seismicity of a given area in Python, study statistics, etc.. The catalog of the event is available in the script as a QuakeML global variable catalogSWIP5.

# !QUAKEML

3

All channels that are visible in the SWIP5 main window time clipped  to the signal visible in the main window are sent to Python. Seismic channels are available in the script as global variable streamSWIP5 of Stream type.

# !DATA FROM MAIN WINDOW

4

All channels visible in the SWIP5 zoom window time clipped to the signal visible in the zoom window are sent to Python. Seismic channels are available in the script as global variable streamSWIP5 of Stream type.

# !DATA FROM ZOOM WINDOW

5

Channels selected (shown as blue in the main window) untimed are sent to Python. Seismic channels are available in the script as global variable streamSWIP5 of Stream type.

# !DATA FROM SELECTION


Data imported from Python


6The study of the phenomenon stored in the variable catalogSWIP5 is imported into SWIP5 replacing the existing study or catalog# !REPLACE QUAKEML
7The parameters of the phenomenon stored in the variable catalogSWIP5 are imported into SWIP5. New parameters are added to the current study of the phenomenon: origin, magnitude, station magnitude, amplitudes, mechanisms, phases, etc. Only new values are added. The already existing ones are not changed. In the study exported from Python, there must be an event with the ID the same as the current event in SWIP5. Otherwise, the data is ignored.# !INSERT TO QUAKEML
8The MiniSEED file saved by the Python script is loaded into SWIP5. The script must contain a command to write to the file whose name is in the configuration file.# !READ MINISEED
9The MiniSEED file saved by the Python script is added into SWIP5. The script must contain a command to write to the file whose name is in the configuration file.# !ADD MINISEED

Parameters of phenomena or entire bulletins from QuakeML are passed to Python in QuakeML format and seen as catalogSWIP5 no matter how many channels are passed, while seismic records in MiniSEED format and seen as streamSWIP5. There may be one line in the script describing how to transfer QuakeML and one line describing how to transfer seismic records.

...