pygmi.seis.iodefs#
Import and export seismology data.
Classes#
GUI to import SEISAN and SeisComP data. |
|
GUI to import Generic Fault Plane Solution data. |
|
GUI to export SEISAN data. |
|
GUI export seismic data to CSV. |
|
GUI to export a seismic data summary. |
|
GUI to filter seismic data events. |
Functions#
|
Format strings. |
|
Convert a number float, or returns NaN. |
|
Convert a number to integer, or returns NaN. |
|
Import macro format. |
|
Import Nordic and Nordic2 data. |
|
Import SeisComp data. |
|
Import Excel summary. |
Read record type 1. |
|
Read record type 2. |
|
Read record type 3. |
|
Read record type 4. |
|
Read record type phase (nordic2 type 4). |
|
Read record type 5. |
|
Read record type 6. |
|
Read record type E. |
|
Read record type F. |
|
Read record type H. |
|
Read record type I. |
|
Read record type M. |
|
|
Merge M records. |
Read record type P. |
|
|
Return Mercalli index. |
Convert an excel file to macro file. |
Module Contents#
- pygmi.seis.iodefs.sform(strform, val, tmp, col1, col2=None, nval=-999)#
Format strings.
Formats strings according with a mod for values containing the value -999 or None. In that case it will output spaces instead. In the case of strings being output, they are truncated to fit the format statement. This routine also puts the new strings in the correct columns
- Parameters:
strform (python format string) – This string must be of the form {0:4.1f}, where 4.1f can be changed.
val (float, int, str) – input value
tmp (str) – Input string
col1 (int) – start column (1 is first column)
col2 (int) – end column. The default is None.
nval (float, int) – null value which gets substituted by spaces. The default is -999.
- Returns:
tmp – Output formatted string.
- Return type:
str
- pygmi.seis.iodefs.str2float(inp)#
Convert a number float, or returns NaN.
- Parameters:
inp (str) – string with a float in it
- Returns:
output – float or np.nan
- Return type:
float
- pygmi.seis.iodefs.str2int(inp)#
Convert a number to integer, or returns NaN.
- Parameters:
inp (str) – string with an integer in it
- Returns:
output – integer or np.nan
- Return type:
int
- class pygmi.seis.iodefs.ImportSeisan(parent=None)#
Bases:
pygmi.misc.BasicModule
GUI to import SEISAN and SeisComP data.
- Parameters:
parent (parent, optional) – Reference to the parent routine. The default is None.
- settings(nodialog=False)#
Entry point into item.
- Parameters:
nodialog (bool, optional) – Run settings without a dialog. The default is False.
- Returns:
True if successful, False otherwise.
- Return type:
bool
- saveproj()#
Save project data from class.
- Return type:
None.
- pygmi.seis.iodefs.importmacro(ifile)#
Import macro format.
Line Location, GMT time, Local time. Format a30,i4,1x,2i2,1x,2i2,1x,i2, ‘GMT’,1x,i4,1x,2i2,1x,2i2,1x,i2,1x,’Local time’
Line Comments
Line Observations: Latitude, Longitude,intensity, code for scale, postal code or similar, location,Format 2f10.4,f5.1,1x,a3,1x,a10,2x,a. Note the postal code is an ascii string and left justified (a10).
- Parameters:
ifile (str) – Input macro file.
- Returns:
gdf1 – List of locations with intensities.
- Return type:
GeoPandas dataframe
- pygmi.seis.iodefs.importnordic(ifile, showlog=print)#
Import Nordic and Nordic2 data.
- Parameters:
ifile (str) – Input file to import.
showlog (function, optional) – Display information. The default is print.
- Returns:
dat – SEISAN Data.
- Return type:
list
- pygmi.seis.iodefs.importseiscomp(ifile, showlog=print, prefmag='MLv')#
Import SeisComp data.
- Parameters:
ifile (str) – Input file to import.
showlog (function, optional) – Display information. The default is print.
- Returns:
sdat – SEISAN Data.
- Return type:
list
- pygmi.seis.iodefs.importxlsx(ifile, showlog=print)#
Import Excel summary.
- Parameters:
ifile (str) – Input file to import.
showlog (function, optional) – Display information. The default is print.
- Returns:
sdat – SEISAN Data.
- Return type:
list
- pygmi.seis.iodefs.read_record_type_1(i)#
Read record type 1.
- Parameters:
i (str) – String to read from.
- Returns:
tmp – SEISAN 1 record.
- Return type:
sdt.seisan_1
- pygmi.seis.iodefs.read_record_type_2(i)#
Read record type 2.
- Parameters:
i (str) – String to read from.
- Returns:
tmp – SEISAN 2 record.
- Return type:
sdt.seisan_2
- pygmi.seis.iodefs.read_record_type_3(i)#
Read record type 3.
- Parameters:
i (str) – String to read from.
- Returns:
tmp – SEISAN 4 record.
- Return type:
sdt.seisan_4
- pygmi.seis.iodefs.read_record_type_4(i)#
Read record type 4.
- Parameters:
i (str) – String to read from.
- Returns:
tmp – SEISAN 4 record.
- Return type:
sdt.seisan_4
- pygmi.seis.iodefs.read_record_type_phase(i)#
Read record type phase (nordic2 type 4).
- Parameters:
i (str) – String to read from.
- Returns:
tmp – SEISAN 4 record.
- Return type:
sdt.seisan_4
- pygmi.seis.iodefs.read_record_type_5(i)#
Read record type 5.
- Parameters:
i (str) – String to read from.
- Returns:
tmp – SEISAN 5 record.
- Return type:
sdt.seisan_5
- pygmi.seis.iodefs.read_record_type_6(i)#
Read record type 6.
- Parameters:
i (str) – String to read from.
- Returns:
tmp – SEISAN 6 record.
- Return type:
sdt.seisan_6
- pygmi.seis.iodefs.read_record_type_e(i)#
Read record type E.
- Parameters:
i (str) – String to read from.
- Returns:
tmp – SEISAN E record.
- Return type:
sdt.seisan_E
- pygmi.seis.iodefs.read_record_type_f(i)#
Read record type F.
- Parameters:
i (str) – String to read from.
- Returns:
out – Dictionary with a SEISAN F record.
- Return type:
dictionary
- pygmi.seis.iodefs.read_record_type_h(i)#
Read record type H.
- Parameters:
i (str) – String to read from.
- Returns:
tmp – SEISAN H record.
- Return type:
sdt.seisan_H
- pygmi.seis.iodefs.read_record_type_i(i)#
Read record type I.
- Parameters:
i (str) – String to read from.
- Returns:
tmp – SEISAN I record.
- Return type:
sdt.seisan_I
- pygmi.seis.iodefs.read_record_type_m(i)#
Read record type M.
- Parameters:
i (str) – String to read from.
- Returns:
tmp – SEISAN M record.
- Return type:
sdt.seisan_M
- pygmi.seis.iodefs.merge_m(rec1, rec2)#
Merge M records.
- Parameters:
rec1 (sdt.seisan_M) – SEISAN M record.
rec2 (sdt.seisan_M) – SEISAN M record.
- Returns:
rec1 – SEISAN M record.
- Return type:
sdt.seisan_M
- pygmi.seis.iodefs.read_record_type_p(i)#
Read record type P.
- Parameters:
i (str) – String to read from.
- Returns:
tmp – SEISAN P record.
- Return type:
sdt.seisan_P
- class pygmi.seis.iodefs.ImportGenericFPS(parent=None)#
Bases:
pygmi.misc.BasicModule
GUI to import Generic Fault Plane Solution data.
This is stored in a csv file.
- Parameters:
parent (parent, optional) – Reference to the parent routine. The default is None.
- settings(nodialog=False)#
Entry point into item.
- Parameters:
nodialog (bool, optional) – Run settings without a dialog. The default is False.
- Returns:
True if successful, False otherwise.
- Return type:
bool
- saveproj()#
Save project data from class.
- Return type:
None.
- class pygmi.seis.iodefs.ExportSeisan(parent=None)#
Bases:
pygmi.misc.ContextModule
GUI to export SEISAN data.
- Parameters:
parent (parent, optional) – Reference to the parent routine. The default is None.
- run(filename=None)#
Entry point into the routine, used to run context menu item.
- Return type:
None.
- write_record_type_1(data)#
Write record type 1.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Return type:
None.
- write_record_type_2(data)#
Write record type 2.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Return type:
None.
- write_record_type_3(data)#
Write record type 3.
This changes depending on the preceding line.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Return type:
None.
- write_record_type_4(data)#
Write record type 4.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Return type:
None.
- write_record_type_phase(data)#
Write record type 4.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Return type:
None.
- write_record_type_5(data)#
Write record type 5.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Return type:
None.
- write_record_type_6(data)#
Write record type 6.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Return type:
None.
- write_record_type_7()#
Write record type 7.
- Return type:
None.
- write_record_type_e(data)#
Write record type E.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Return type:
None.
- write_record_type_f(data)#
Write record type F.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Return type:
None.
- write_record_type_h(data)#
Write record type H.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Return type:
None.
- write_record_type_i(data)#
Write record type I.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Return type:
None.
- write_record_type_m(data)#
Write record type M.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Return type:
None.
- write_record_type_p(data)#
Write record type P.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Return type:
None.
- class pygmi.seis.iodefs.ExportCSV(parent=None)#
Bases:
pygmi.misc.ContextModule
GUI export seismic data to CSV.
- Parameters:
parent (parent, optional) – Reference to the parent routine. The default is None.
- run()#
Entry point into the routine, used to run context menu item.
- Return type:
None.
- write_record_type_1(data)#
Write record type 1.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Returns:
tmp – Output string.
- Return type:
str
- write_record_type_2(data)#
Write record type 2.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Returns:
tmp – Output string.
- Return type:
str
- write_record_type_3(tmp)#
Write record type 3.
This changes depending on the preceding line.
- Parameters:
tmp (str) – Data string.
- Returns:
tmp – Output string.
- Return type:
str
- write_record_type_4(data)#
Write record type 4.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Returns:
tmpfin – List of output string.
- Return type:
list
- write_record_type_5(data)#
Write record type 5.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Returns:
tmp – Output string.
- Return type:
str
- write_record_type_6(data)#
Write record type 6.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Returns:
tmp – Output string.
- Return type:
str
- write_record_type_7()#
Write record type 7.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Returns:
tmp – Output string.
- Return type:
str
- write_record_type_e(data)#
Write record type E.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Returns:
tmp – Output string.
- Return type:
str
- write_record_type_f(data)#
Write record type F.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Returns:
tmp – Output string.
- Return type:
str
- write_record_type_h(data)#
Write record type H.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Returns:
tmp – Output string.
- Return type:
str
- write_record_type_i(data)#
Write record type I.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Returns:
tmp – Output string.
- Return type:
str
- write_record_type_m(data)#
Write record type M.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Returns:
tmp – Output string.
- Return type:
str
- write_record_type_p(data)#
Write record type P.
- Parameters:
data (Dictionary) – Dictionary of record types.
- Returns:
tmp – Output string.
- Return type:
str
- class pygmi.seis.iodefs.ExportSummary(parent=None)#
Bases:
pygmi.misc.ContextModule
GUI to export a seismic data summary.
- Parameters:
parent (parent, optional) – Reference to the parent routine. The default is None.
- run()#
Entry point into the routine, used to run context menu item.
- Return type:
None.
- pygmi.seis.iodefs.mercalli(mag)#
Return Mercalli index.
- Parameters:
mag (float) – Local magnitude.
- Returns:
merc – Mercalli index
- Return type:
str
- class pygmi.seis.iodefs.FilterSeisan(parent=None)#
Bases:
pygmi.misc.BasicModule
GUI to filter seismic data events.
This filters data using thresholds.
- Parameters:
parent (parent, optional) – Reference to the parent routine. The default is None.
- setupui()#
Set up UI.
- Return type:
None.
- dind_click(state)#
Check checkboxes.
- Parameters:
state (int) – State of checkbox.
- Return type:
None.
- rectype_init(txt)#
Change combo.
- Parameters:
txt (str) – Text.
- Return type:
None.
- recdesc_init(txt)#
Change Description.
- Parameters:
txt (str) – Text.
- Return type:
None.
- get_limits()#
Get limits for SEISAN data.
- Return type:
None.
- settings(nodialog=False)#
Entry point into item.
- Parameters:
nodialog (bool, optional) – Run settings without a dialog. The default is False.
- Returns:
True if successful, False otherwise.
- Return type:
bool
- saveproj()#
Save project data from class.
- Return type:
None.
- acceptall()#
Accept option.
Updates self.outdata, which is used as input to other modules.
- Return type:
None.
- pygmi.seis.iodefs.xlstomacro()#
Convert an excel file to macro file.
Line Location, GMT time, Local time. Format a30,i4,1x,2i2,1x,2i2,1x,i2, ‘GMT’,1x,i4,1x,2i2,1x,2i2,1x,i2,1x,’Local time’
Line Comments
Line Observations: Latitude, Longitude,intensity, code for scale, postal code or similar, location,Format 2f10.4,f5.1,1x,a3,1x,a10,2x,a. Note the postal code is an ascii string and left justified (a10).