pygmi.seis package

Submodules

pygmi.seis.beachball module

Plot fault plane solutions.

The code below is translated from bb.m written by Andy Michael and Oliver Boyd at http://www.ceri.memphis.edu/people/olboyd/Software/Software.html

class pygmi.seis.beachball.BeachBall(parent=None)

Bases: BasicModule

Create shapefiles with beachballs.

change_alg()

Change algorithm.

Return type:

None.

data_init()

Initialise Data - entry point into routine.

Returns:

True if successful, False otherwise.

Return type:

bool

save_shp()

Save Beachballs.

Returns:

True if successful, False otherwise.

Return type:

bool

save_shp_new()

Save Beachballs.

Returns:

True if successful, False otherwise.

Return type:

bool

saveproj()

Save project data from class.

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

setupui()

Set up UI.

Return type:

None.

class pygmi.seis.beachball.MyMplCanvas(parent=None)

Bases: FigureCanvasQTAgg

Canvas for the actual plot.

init_graph()

Initialize the graph.

Return type:

None.

pygmi.seis.beachball.TDL(AN, BN)

TDL.

Parameters:
  • AN (numpy array) – array comprising XN, YN, ZN

  • BN (numpy array) – array comprising XE, YE, ZE

Returns:

  • FT (float) – relates to strike (360 - ft)

  • FD (float) – dip

  • FL (float) – relates to rake (180 - fl)

pygmi.seis.beachball.auxplane(s1, d1, r1)

Get Strike and dip of second plane.

Adapted from Andy Michael bothplanes.c

Parameters:
  • s1 (numpy array) – Strike 1.

  • d1 (numpy array) – Dip 1.

  • r1 (numpy array) – Rake 1.

Returns:

  • strike (numpy array) – Strike of second plane.

  • dip (numpy array) – Dip of second plane.

  • rake (numpy array) – Rake of second plane.

pygmi.seis.beachball.beachball(fm, centerx, centery, diam, isgeog, showlog=<built-in function print>)

Beachball.

Source code provided here are adopted from MatLab script bb.m written by Andy Michael and Oliver Boyd.

function bb(fm, centerx, centery, diam, ta, color) Draws beachball diagram of earthquake double-couple focal mechanism(s). S1, D1, and R1, the strike, dip and rake of one of the focal planes, can be vectors of multiple focal mechanisms.

Parameters:
  • fm (numpy array) – focal mechanism that is either number of mechanisms (NM) by 3 (strike, dip, and rake) or NM x 6 (mxx, myy, mzz, mxy, mxz, myz - the six independent components of the moment tensor). The strike is of the first plane, clockwise relative to north. The dip is of the first plane, defined clockwise and perpendicular to strike, relative to horizontal such that 0 is horizontal and 90 is vertical. The rake is of the first focal plane solution. 90 moves the hanging wall up-dip (thrust), 0 moves it in the strike direction (left-lateral), -90 moves it down-dip (normal), and 180 moves it opposite to strike (right-lateral).

  • centerx (float) – place beachball(s) at position centerx

  • centery (float) – place beachball(s) at position centery

  • diam (float) – draw beachball with this diameter.

  • isgeog (bool) – True if in geographic coordinates, False otherwise.

  • showlog (function, optional) – Routine to show text messages. The default is print.

Returns:

  • X (numpy array) – array of x coordinates for vertices

  • Y (numpy array) – array of y coordinates for vertices

  • xx (numpy array) – array of x coordinates for vertices

  • yy (numpy array) – array of y coordinates for vertices

pygmi.seis.beachball.mij2sdr(mxx, myy, mzz, mxy, mxz, myz)

Adapted from code, mij2d.f, created by Chen Ji.

Parameters:
  • float (myz -) – independent component of the moment tensor

  • float – independent component of the moment tensor

  • float – independent component of the moment tensor

  • float – independent component of the moment tensor

  • float – independent component of the moment tensor

  • float – independent component of the moment tensor

Returns:

  • strike (float) – strike of first focal plane (degrees)

  • dip (float) – dip of first focal plane (degrees)

  • rake (float) – rake of first focal plane (degrees)

pygmi.seis.beachball.pol2cart(phi, rho)

Polar to cartesian coordinates.

Parameters:
  • phi (numpy array) – Polar angles in radians.

  • rho (numpy array) – Polar r values.

Returns:

  • xxx (numpy array) – X values.

  • yyy (numpy array) – Y values.

pygmi.seis.beachball.strikedip(n, e, u)

Find strike and dip of plane given normal vector.

Adapted from Andy Michaels stridip.c

Parameters:
  • n (numpy array) – North coordinates for normal vector.

  • e (numpy array) – East coordinate for normal vector.

  • u (numpy array) – Up coordinate for normal vector.

Returns:

  • strike (numpy array) – Strike of plane.

  • dip (numpy array) – Dip of plane.

pygmi.seis.datatypes module

Class for seismic data types.

Docstring information is from SEISAN documentation.

class pygmi.seis.datatypes.seisan_1

Bases: object

Class to hold Seisan Type 1 data.

Type 1 Line Format:

Columns Format Description Comments 1 Free 2-5 I4 Year 6 Free 7-8 I2 Month 9-10 I2 Day of Month 11 Fix o. time Normally blank, an F fixes - origin time 12-13 I2 Hour 14-15 I2 Minutes 16 Free 17-20 F4.1 Seconds 21 Location model indicator Any character 22 A1 Distance Indicator L = Local, R = Regional, - D = Distant, etc. 23 A1 Event ID E = Confirmed explosion - P = Probable explosion - V = Volcanic - Q = Confirmed earthquake - ‘ ‘ = Presumed earthquake - X = Landslide 24-30 F7.3 Latitude Degrees (+ N) 31-38 F8.3 Longitude Degrees (+ E) 39-43 F5.1 Depth Km 44 A1 Depth Indicator F = Fixed, S = Starting value 45 A1 Locating indicator —————————-, - * do not locate 46-48 A3 Hypocenter Reporting Agency 49-51 Number of Stations Used 52-55 RMS of Time Residuals 56-59 F4.1 Magnitude No. 1 60 A1 Type of Magnitude L=ML, b=mb, B=mB, s=Ms, S=MS, W=MW, - G=MbLg (not used by SEISAN), C=Mc 61-63 A3 Magnitude Reporting Agency 64-67 F4.1 Magnitude No. 2 68 A1 Type of Magnitude 69-71 A3 Magnitude Reporting Agency 72-75 F4.1 Magnitude No. 3 76 A1 Type of Magnitude 77-79 A3 Magnitude Reporting Agency 80 A1 Type of this line (“1”), can be blank if first - line of event

class pygmi.seis.datatypes.seisan_2

Bases: object

Type 2 line (Macroseismic information).

Cols Format Description 1-5 Blank 6-20 a Any descriptive text 21 Free 22 a1 Diastrophism code (PDE type) - F = Surface faulting - U = Uplift or subsidence - D = Faulting and Uplift/Subsidence 23 a1 Tsunami code (PDE type) - T = Tsunami generated - Q = Possible tsunami 24 a1 Seiche code (PDE type) - S = Seiche - Q = Possible seiche 25 a1 Cultural effects (PDE type) - C = Casualties reported - D = Damage reported - F = Earthquake was felt - H = Earthquake was heard 26 a1 Unusual events (PDE type) - L = Liquefaction - G = Geyser/fumarole - S = Landslides/Avalanches - B = Sand blows - C = Cracking in the ground (not normal faulting). - V = Visual phenomena - O = Olfactory phenomena - M = More than one of the above observed. 27 Free 28-29 i2 Max Intensity 30 a1 Max Intensity qualifier - (+ or - indicating more precisely the intensity) 31-32 a2 Intensity scale (ISC type definitions) - MM = Modified Mercalli - RF = Rossi Forel - CS = Mercalli - Cancani - Seberg - SK = Medevev - Sponheur - Karnik 33 Free 34-39 f6.2 Macroseismic latitude (Decimal) 40 Free 41-47 f7.2 Macroseismic longitude (Decimal) 48 Free 49-51 f3.1 Macroseismic magnitude 52 a1 Type of magnitude - I = Magnitude based on maximum Intensity. - A = Magnitude based on felt area. - R = Magnitude based on radius of felt area. - * = Magnitude calculated by use of special formulas - developed by some person for a certain area. - Further info should be given on line 3. 53-56 f4.2 Logarithm (base 10) of radius of felt area. 57-61 f5.2 Logarithm (base 10) of area (km**2) number 1 where - earthquake was felt exceeding a given intensity. 62-63 i2 Intensity bordering the area number 1. 64-68 f5.2 Logarithm (base 10) of area (km**2) number 2 where - earthquake was felt exceeding a given intensity. 69-70 i2 Intensity bordering the area number 2. 71 Free 72 a1 Quality rank of the report (A, B, C, D) 73-75 a3 Reporting agency 76-79 Free 80 a1 Type of this line (“2”)

class pygmi.seis.datatypes.seisan_3

Bases: object

Type 3 Line (Optional).

Columns Format Description Comments 1 Free 2-79 A Text Anything 80 A1 Type of this line (“3”)

class pygmi.seis.datatypes.seisan_4

Bases: object

Type 4 (phase) line.

Columns Format Description Comments

1 Free 2- 6 A5 Station Name Blank = End of readings = end of event 7 A1 Instrument Type S = SP, I = IP, L = LP etc 8 A1 Component Z, N, E ,T, R, 1, 2 9 Free or weight, see note below 10 A1 Quality Indicator I, E, etc. 11-14 A2 Phase ID PN, PG, LG, P, S, etc. ** 15 I1 Weighting Indicator (1-4) 0 or blank= full weight, 1=75%, - 2=50%, 3=25%, 4=0%, 9: no weight, use difference time - (e.g. P-S). 16 Free or flag A to indicate automatic pick, removed when - picking 17 A1 First Motion C, D 18 Note: Currently 15 to 18 can also be used for phase - assuming column 11-14 is not blank. See note ** below. 19-20 I2 Hour Hour can be up to 48 to indicate next day 21-22 I2 Minutes 23-28 F6.0 Seconds 29 Free 30-33 I4 Duration (to noise) Seconds 34-40 g7.1 Amplitude (Zero-Peak) in units of nm, nm/s, nm/s^2 or - counts. 41 Free 42-45 F4.0 Period Seconds 46 Free 47-51 F5.0 Direction of Approach Degrees 52 Free 53-56 F4.0 Phase Velocity Km/second 57-60 F4.0 Angle of incidence (was Signal to noise ratio before - version 8) 61-63 I3 Azimuth residual 64-68 F5.1 Travel time residual 69-70 I2 Weight 71-75 F5.0 Epicentral distance(km) 76 Free 77-79 I3 Azimuth at source 80 A1 Type of this line (“4”), can be blank, which it is most - often.

Type 4 cards should be followed by a Blank Card (Type 0)

Nordic 2:

Columns Format Description Comments 1 Free 2-6 A5 Station Name 7-9 A3 Component, e.g. SHZ 10 Free 11-12 A2 Network code 13-14 A2 Location 15 Free 16 A1 Quality Indicator I, E, etc. 17-24 A8 Phase ID PN, PG, LG, P, S, etc. 25 I1 Weighting Indicator (1-4) 0 or blank= full weight, 1=75%, 2=50%, - 3=25%,4=0%, 9: no weight, time (e.g. P-S). 26 Free or flag A to indicate automatic pick, removed when picking 27-28 I2 Hour Hour can be up to 48 to indicate next day 29-30 I2 Minutes 31 Free 32-37 F6.0 Seconds 38-44 Parameter 1. If a phase, it is polarity in column 44 - If phase END for coda, it is duration(s)(F) - If amplitude phase, it is amplitude (G7) - Amplitude is(Zero-Peak) in units of nm, - nm/s, nm/s^2 or counts. - If back azimuth phase (BAZ), it a back azimuth (F) 45-50 Parameter 2 If a phase or END, it is blank - If an amplitude, it is period (F) - If back azimuth phase, it is apparent velocity(km/s) 51 Free 52-54 A3 Agency 55 Free 56-58 A3 Operator 59 Free 60-63 F4.0 Angle of incidence 64-68 F5.1 Residual, can be travel time, back azimuth or magnitude 69-70 I2 Weight used, like 05 is 0.5 71-75 F5.0 Epicentral distance(km) 76 Free 77-79 I3 Azimuth at source 80 A1 Type of this line (” “)

class pygmi.seis.datatypes.seisan_5

Bases: object

Type 5 line (optional).

Error estimates of previous line, currently not used by any SEISAN programs.

Columns Format Description Comments 1 Free 2-79 Error estimates in same format as previous line, normally type 4 80 A1 Type of this line (“5”)

class pygmi.seis.datatypes.seisan_6

Bases: object

Type 6 Line (Optional).

Columns Format Description Comments 1 Free 2-79 A Name(s) of file or archive reference, a-format 80 A1 Type of this line (“6”)

class pygmi.seis.datatypes.seisan_E

Bases: object

Type E Line (Optional): Hyp error estimates.

Before version 12.0 there was only one E-line in S-file which could only belong to the main hypocenter. In order to know which E-line belongs to which 1-line, the location program indicator and the agency must match. If only one E-line and no agency, it is assumed it belongs to the main hypocenter. This ensures backwards compatibility. Multiple E-lines can be used in both Nordic and Nordic2 format.

Columns Format Description

1 Free 2-5 A4 The text GAP= 6-8 I3 Gap 10:10 A1 Location program indicator, blank for Hypocenter (new from version 12) 11:11 Free 12:14 A3 Agency (new from version 12) 15-20 F6.2 Origin time error 25-30 F6.1 Latitude (y) error 31-32 Free 33-38 F6.1 Longitude (x) error (km) 39-43 F5.1 Depth (z) error (km) 44-55 E12.4 Covariance (x,y) km*km 56-67 E12.4 Covariance (x,z) km*km 68-79 E14.4 Covariance (y,z) km*km

covariance matrix: var(1,1)=erx*erx var(2,2)=ery*ery var(3,3)=erz*erz var(1,2)=cvxy var(1,3)=cvxz var(2,3)=cvyz var(2,1)=var(1,2) var(3,1)=var(1,3) var(3,2)=var(2,3)

class pygmi.seis.datatypes.seisan_F

Bases: object

Type F Line (Optional): Fault plane solution.

Columns Format Description

1:30 3F10.0 Strike, dip and rake, Aki convention 31:45 3F5.1 Error in strike dip and rake (HASH), error in fault plane - and aux. plane (FPFIT) 46:50 F5.1 Fit error: FPFIT and HASH (F-fit) 51:55 F5.1 Station distribution ratio (FPFIT, HASH) 56:60 F5.1 Amplitude ratio fit (HASH, FOCMEC) 61:65 I2 Number of bad polarities (FOCMEC, PINV) 64.65 I2 Number of bad amplitude ratios (FOCMEC) 67:69 A3 Agency code 71:77 A7 Program used 78:78 A1 Quality of solution, A (best), B C or D (worst), added - manually 79:79 A1 Blank, can be used by user 80:80 A1 F

class pygmi.seis.datatypes.seisan_H

Bases: object

Type H line, High accuracy hypocenter line.

Columns Format Description 1:15 As type 1 line including program used in column 6 (new from version 12) 16 Free 17 f6.3 Seconds 23 Free 24:32 f9.5 Latitude 33 Free 34:43 f10.5 Longitude 44 Free 45:52 f8.3 Depth 53 Free 54:59 f6.3 RMS 61:63 Agency, A3 (new from version 12) 62:79 Free 80 H

class pygmi.seis.datatypes.seisan_I

Bases: object

Type I Line, ID line.

Columns Description 1 Free 2:8 Help text for the action indicator 9:11 Last action done, so far defined: - ARG: AUTO Register, AUTOREG - ARX: From ARC extract - DPH: Phases deleted with DELS - DUP: Duplicated event - HIN: Updated with HYPOINVERSE - NEW: New event - REE: Register from EEV - REG: Register - SPL: Split - UPD: Update with HYP - UP : Update with HYP only from EEV 1 Free 13:26 Date and time of last action 27 Free 28:30 Help text for operator 36:42 Help text for status 43:56 Status flags, not yet defined 57 Free 58:60 Help text for ID 61:74 ID, year to second 75 If d, this indicate that a new file id had to be created which was - one or more seconds different from an existing ID to avoid - overwrite. 76 Indicate if ID is locked. Blank means not locked, L means locked.

class pygmi.seis.datatypes.seisan_M

Bases: object

Type M Line (Optional): Moment tensor solution.

Note: the type M lines are pairs of lines with one line that gives the hypocenter time, and one line that gives the moment tensor values:

The first moment tensor line: Columns Format Description 1:1 Free 2:5 I4 Year 7:8 I2 Month 9:10 I2 Day of Month 12:13 I2 Hour 14:15 I2 Minutes 17:20 F4.1 Seconds 24:30 F7.3 Latitude Degrees (+ N) 31:38 F8.3 Longitude Degrees (+ E) 39:43 F5.1 Depth Km 46:48 A3 Reporting Agency 56:59 F4.1 Magnitude 60 A1 Type of Magnitude L=ML, b=mb, B=mB, s=Ms, S=MS, W=MW, 61:63 A3 Magnitude Reporting Agency 71:77 A7 Method used 78:78 A1 Quality of solution, A (best), B C or D (worst), added - manually 79:79 A1 Blank, can be used by user 80:80 A1 M

The second moment tensor line: Columns Format Description 1:1 Free 2:3 A2 MT 4:9 F6.3 Mrr or Mzz [Nm] 11:16 F6.3 Mtt or Mxx [Nm] 18:23 F6.3 Mpp or Myy [Nm] 25:30 F6.3 Mrt or Mzx [Nm] 32:37 F6.3 Mrp or Mzy [Nm] 39:44 F6.3 Mtp or Mxy [Nm] 46:48 A3 Reporting Agency 49:49 A1 MT coordinate system (S=spherical, C=Cartesian) 50:51 i2 Exponential 53:62 G6.3 Scalar Moment [Nm] 71:77 A7 Method used 78:78 A1 Quality of solution, A (best), B C or D (worst), added - manually 79:79 A1 Blank, can be used by user 80:80 A1 M

class pygmi.seis.datatypes.seisan_P

Bases: object

Type P line, file name of a picture file.

Columns Description 1:1 Free 2:79 File name 80:80 P

pygmi.seis.del_rec module

Delete SEISAN records.

class pygmi.seis.del_rec.DeleteRecord(parent=None)

Bases: BasicModule

Main form which does the GUI and the program.

delrec(ifile)

Delete record.

Parameters:

ifile (str) – Input filename.

Return type:

None.

saveproj()

Save project data from class.

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

class pygmi.seis.del_rec.Quarry(parent=None)

Bases: BasicModule

Main form which does the GUI and the program.

calcrq2()

Calculate the Rq value.

Returns:

newevents – New events

Return type:

list

calcrq2b()

Calculate the Rq value.

Returns:

newevents – New events

Return type:

list

randrq(nmax, nstep, nrange, day)

Calculate random Rq values.

Parameters:
  • nmax (int) – DESCRIPTION.

  • nstep (int) – DESCRIPTION.

  • nrange (list) – DESCRIPTION.

  • day (tuple) – DESCRIPTION.

Returns:

rperc – Percentiles

Return type:

list

randrqb(N1, day, num)

Calculate random Rq values.

Parameters:
  • N1 (TYPE) – DESCRIPTION.

  • day (tuple) – DESCRIPTION.

  • num (int) – DESCRIPTION.

Returns:

rperc – Percentiles

Return type:

list

saveproj()

Save project data from class.

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

pygmi.seis.del_rec.import_for_plots(ifile, dind='R')

Import data to plot.

Parameters:
  • ifile (str) – Input file name.

  • dind (str, optional) – Distance indicator. The default is ‘R’.

Returns:

datd – Output data.

Return type:

dictionary

pygmi.seis.graphs module

Plot Seismology Data.

This module provides a variety of methods to plot raster data via the context menu.

class pygmi.seis.graphs.GraphWindow(parent=None)

Bases: ContextModule

Graph Window - The QDialog window which will contain our image.

change_band()

Combo box to choose band.

Return type:

None.

save_shp()

Save shapefile.

Return type:

None.

class pygmi.seis.graphs.MyMplCanvas(parent=None)

Bases: FigureCanvasQTAgg

Canvas for the actual plot.

axes

axes for matplotlib subplot

Type:

matplotlib axes

parent

reference to the parent routine

Type:

parent

update_bvalue(data1a, bins='doane')

Update the b value plot.

Parameters:
  • data1a (numpy array) – Data array.

  • bins (int or str, optional) – Number of bins or binning strategy. See matplotlib.pyplot.hist. The default is ‘doane’.

Return type:

None.

update_ellipse(datd, dats, nodepth=False)

Update error ellipse plot.

Parameters:
  • datd (dictionary) – Dictionary containing latitudes and longitudes

  • dats (list) – Data list.

  • nodepth (bool, optional) – Flag to determine if there are depths. The default is False.

Return type:

None.

update_hexbin(data1, data2, xlbl='Time', ylbl='ML', xbin=None, xrng=None)

Update the hexbin plot.

Parameters:
  • data1 (numpy array) – raster dataset to be used

  • data2 (numpy array) – raster dataset to be used

  • xlbl (str, optional) – X-axis label. The default is ‘Time’.

  • ylbl (str, optional) – Y-axis label. The default is ‘ML’.

  • xbin (int, optional) – Number of bins in the x direction. The default is None.

  • xrng (list, optional) – X-range. The default is None.

Return type:

None.

update_hist(data1, xlbl='Data Value', ylbl='Number of Observations', bins='doane', rng=None)

Update the histogram plot.

Parameters:
  • data1 (numpy array.) – raster dataset to be used

  • xlbl (str, optional) – X-axis label. The default is ‘Data Value’.

  • ylbl (str, optional) – Y-axis label. The default is ‘Number of Observations’.

  • bins (int or str, optional) – Number of bins or binning strategy. See matplotlib.pyplot.hist. The default is ‘doane’.

  • rng (tuple or None, optional) – Bin range. The default is None.

Return type:

None.

update_isocontour(datd)

Update isoseismic plot using contours.

Parameters:

datd (GeoDatFrame) – Macroseismic data.

Return type:

None.

update_isohull(datd)

Update isoseismic plot using convex hull method.

Parameters:

datd (GeoDatFrame) – Macroseismic data.

Return type:

None.

update_pres(data1, phase='P')

Update the plot.

Parameters:
  • data1 (numpy array) – Data array.

  • phase (str, optional) – Phase. The default is ‘P’.

Return type:

None.

update_residual(dat, res='ML')

Update the residual plot.

Parameters:
  • data1 (numpy array) – Data array.

  • res (str, optional) – Response type. The default is ‘ML’.

Return type:

None.

update_wadati(dat, min_wad=5, min_vps=1.53, max_vps=1.93)

Update the wadati plot.

Parameters:
  • dat (list) – List of events.

  • min_wad (int, optional) – Minimum data length for plot. The default is 5.

  • min_vps (float, optional) – Minimum VPS. The default is 1.53.

  • max_vps (float, optional) – Maximum VPS. The default is 1.93.

Return type:

None.

class pygmi.seis.graphs.PlotIso(parent=None)

Bases: GraphWindow

Plot Hist Class.

lbl_2

reference to GraphWindow’s lbl_2

Type:

QLabel

cmb_2

reference to GraphWindow’s cmb_2

Type:

QComboBox

change_band()

Combo box to choose band.

Return type:

None.

run()

Entry point to run routine.

Return type:

None.

save_shp()

Save shapefile.

Returns:

True if successful, False otherwise.

Return type:

bool

class pygmi.seis.graphs.PlotQC(parent=None)

Bases: GraphWindow

Plot Hist Class.

lbl_2

reference to GraphWindow’s lbl_2

Type:

QLabel

cmb_2

reference to GraphWindow’s cmb_2

Type:

QComboBox

change_band()

Combo box to choose band.

Return type:

None.

run()

Entry point to run routine.

Return type:

None.

save_shp()

Save shapefile.

Returns:

True if successful, False otherwise.

Return type:

bool

pygmi.seis.graphs.contourtopoly(cntr)

Convert Matplotlib contours to Polygons.

Parameters:

cntr (Matplotlib countour) – Contour collection.

Returns:

plist – List of Polygon objects.

Return type:

list

pygmi.seis.graphs.eigsorted(cov)

Calculate and sort eigenvalues.

Parameters:

cov (numpy array) – matrix to perform calculations on.

Returns:

  • vals (numpy array) – Sorted eigenvalues.

  • vecs (numpy array) – Sorted eigenvectors.

pygmi.seis.graphs.import_for_plots(dat)

Import data to plot.

Parameters:

dat (list) – List of events.

Returns:

datd – Dictionary of data to plot.

Return type:

dictionary

pygmi.seis.iodefs module

Import Seismology Data.

class pygmi.seis.iodefs.ExportCSV(parent=None)

Bases: ContextModule

Export SEISAN Data.

run()

Run.

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.ExportSeisan(parent=None)

Bases: ContextModule

Export SEISAN Data.

run(filename=None)

Run.

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(tmp)

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_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.

write_record_type_phase(data)

Write record type 4.

Parameters:

data (Dictionary) – Dictionary of record types.

Return type:

None.

class pygmi.seis.iodefs.ExportSummary(parent=None)

Bases: ContextModule

Export SEISAN Data.

run()

Run.

Return type:

None.

class pygmi.seis.iodefs.FilterSeisan(parent=None)

Bases: BasicModule

Filter Data.

This filters data using thresholds.

acceptall()

Accept option.

Updates self.outdata, which is used as input to other modules.

Return type:

None.

dind_click(state)

Check checkboxes.

Parameters:

state (int) – State of checkbox.

Return type:

None.

get_limits()

Get limits for SEISAN data.

Return type:

None.

recdesc_init(txt)

Change Description.

Parameters:

txt (str) – Text.

Return type:

None.

rectype_init(txt)

Change combo.

Parameters:

txt (str) – Text.

Return type:

None.

saveproj()

Save project data from class.

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

setupui()

Set up UI.

Return type:

None.

class pygmi.seis.iodefs.ImportGenericFPS(parent=None)

Bases: BasicModule

Import Generic Fault Plane Solution Data.

This is stored in a csv file.

saveproj()

Save project data from class.

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

class pygmi.seis.iodefs.ImportSeisan(parent=None)

Bases: BasicModule

Import SEISAN Data.

saveproj()

Save project data from class.

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

pygmi.seis.iodefs.importmacro(ifile)

Import macro format.

  1. 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’

  2. Line Comments

  3. 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=<built-in function 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.mercalli(mag)

Return Mercalli index.

Parameters:

mag (float) – Local magnitude.

Returns:

merc – Mercalli index

Return type:

str

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_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_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.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

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.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

pygmi.seis.iodefs.xlstomacro()

Convert an excel file to macro file.

  1. 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’

  2. Line Comments

  3. 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).

pygmi.seis.menu module

Seis Menu Routines.

class pygmi.seis.menu.MenuWidget(parent=None)

Bases: object

Widget class to call the main interface.

This widget class creates the seismology menus to be found on the main interface. Normal as well as context menus are defined here.

parent

Reference to MainWidget class found in main.py

Type:

pygmi.main.MainWidget

beachball()

Create Beachballs from Fault Plane Solutions.

correct_desc()

Correct Seisan descriptions.

delete_recs()

Delete Records.

export_csv()

Export Seisan data to csv.

export_seisan()

Export Seisan data.

filter_seisan()

Filter Seisan.

import_genfps()

Import Generic Fault Plane Solution.

import_seisan()

Import Seisan.

quarry()

Remove quarry events.

sexport()

Export Summary data.

show_QC_plots()

Show QC plots.

show_iso_plots()

Show QC plots.

pygmi.seis.utils module

Module for miscellaneous utilities relating to earthquake seismology.

class pygmi.seis.utils.CorrectDescriptions(parent=None)

Bases: BasicModule

Correct SEISAN descriptions.

This compares the descriptions found in SEISAN type 3 lines to a custom list.

acceptall()

Accept option.

Updates self.outdata, which is used as input to other modules.

Return type:

None.

get_textfile(filename='')

Get description list filename.

Parameters:

filename (str, optional) – Filename submitted for testing. The default is ‘’.

Return type:

None.

saveproj()

Save project data from class.

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

setupui()

Set up UI.

Return type:

None.

Module contents

Seismology Routines.