geoist.catalog package

Submodules

geoist.catalog.AsciiTools module

A simple tool to manipulate data from/to ascii files.

class geoist.catalog.AsciiTools.AsciiTable(header=[])[源代码]

基类:object

AddElement(data=[])[源代码]

Add an element (with header's format) to the data structure. Element can be empty or filled with data.

AddKey(key, data=[], index=- 1)[源代码]

Add header key at given position (default is last element). Data structure can optionally be inflated.

Append(new_table)[源代码]

Method to merge two data structures consecutively. (Header structure must be identical).

Export(ascii_file, write_header='yes', delimiter=',')[源代码]

Method to export data object into an ascii file.

ExportEQT(ascii_file, write_header='no', delimiter=' ')[源代码]

Method to export data object into an ascii file.

Extract(key, dtype='float')[源代码]

Method to extract data values by key. Data type can be specified.

Filter(key, filter_key)[源代码]

Method to filter the data table by key value. Value can be a string to amtch (* and ? allowed) or a numerical range (as a list of floats). In output it is returned a new table.

Import(ascii_file, header=[], dtype='float', delimiter=',', skipline=0, comment='#', empty=[])[源代码]

Method to import data from ascii file (tabular)

RemoveKey(key)[源代码]

Remove a given key from header and data structure.

RenameKey(old_key, new_key)[源代码]

Rename a given key in the header and the data structure.

Replace(key, old_value, new_value)[源代码]

Replace occurences of a key give value. If old_value is '*' it replaces all values.

Size()[源代码]

Method to return size of the data matrix.

geoist.catalog.CatUtils module

geoist.catalog.CatUtils.CastValue(key, value)[源代码]
geoist.catalog.CatUtils.ConcaveHull(X, Y)[源代码]
geoist.catalog.CatUtils.DateToSec(Year, Month, Day, Hour, Minute, Second)[源代码]
geoist.catalog.CatUtils.IsEmpty(number)[源代码]
geoist.catalog.CatUtils.IsType(value, dtype)[源代码]
geoist.catalog.CatUtils.KeyGroup(key)[源代码]
geoist.catalog.CatUtils.LeapCheck(Year)[源代码]
geoist.catalog.CatUtils.LeapNum(Year)[源代码]
geoist.catalog.CatUtils.LocationInit()[源代码]
geoist.catalog.CatUtils.MagnitudeInit()[源代码]
class geoist.catalog.CatUtils.Polygon[源代码]

基类:object

AddBuffer(Delta)[源代码]

TO DO: Tempory implementation using Shapely. In the future, all Polygon objects will be defined this way

Area(Wgs=True)[源代码]

Using Shoelace formula to compute area. Optionally, Wgs coordinates can be approximated to Km using sinusoidal projection (default).

CartGrid(Dx=0.1, Dy=0.1, Bounds=[])[源代码]

Produce a lat/lon cartesian grid. Dx and Dy distances are degrees (area is not preserved). Bounds are [MinX, MinY, MaxX, MaxY]

Import(FileName, Type='xy')[源代码]
IsInside(x, y)[源代码]
Load(XY)[源代码]

Input polygon can be defined in two possible ways:

  1. list of x-y float pairs, e.g.

    [[22.0, -15.0],[24.0, -15.0],[24.0, -10.0],[22.0, -15.0]]

  2. wkt formatted string, e.g.

    'POLYGON((22. -15.,24. -15.,24. -10.,22. -15.))'

SphereGrid(Delta=0.5, Bounds=[], Unwrap=False)[源代码]

Distance between nearby points (in degree) is an approximated value. Bounds are [MinX, MinY, MaxX, MaxY]

Unwrap(Dir='Plus')[源代码]
geoist.catalog.CatUtils.SphericalMesh(Delta, Km=False)[源代码]

Produce a shperical mesh using golder spiral algorithm. Distance is the average beween nearby points (degree by default).

class geoist.catalog.CatUtils.Trace[源代码]

基类:object

Buffer(Delta)[源代码]

Return a polygon object containing the buffer area

Load(XY)[源代码]

Input trace line can be defined in two possible ways:

  1. list of x-y float pairs, e.g.

    [[22.0, -15.0],[24.0, -15.0],[24.0, -10.0],[22.0, -15.0]]

  2. wkt formatted string, e.g.

    'LINESTRING((22. -15.,24. -15.,24. -10.,22. -15.))'

Resample(Delta)[源代码]

Original code by Christian K (modified) https://stackoverflow.com/users/2588210/christian-k

geoist.catalog.CatUtils.Unwrap(Angle)[源代码]

Unwrap phase angle. Note: Angle must be a numpy array

geoist.catalog.CatUtils.WgsDistance(Lat1, Lon1, Lat2, Lon2)[源代码]

Author: Salvador Dali http://stackoverflow.com/users/1090562/salvador-dali

geoist.catalog.CatUtils.WgsToXY(Lat, Lon, Km=True)[源代码]

Approximate conversion using sinusoidal projection.

geoist.catalog.CatUtils.WktToXY(WktString)[源代码]

NOTE: 1) Internal polygons are not considered 2) Multi objects are simply concatenated

geoist.catalog.CatUtils.XYToWkt(X, Y)[源代码]

geoist.catalog.Catalogue module

Module for Earthquake Catalogue Storage and Manipulation. Examples of earthquake catalogue format: eventID,Agency,year,month,day,hour,minute,second,longitude,latitude,SemiMajor90,SemiMinor90,ErrorStrike,depth,depthError,magnitude,sigmaMagnitude,moment,scaling,source,mpp,mpr,mrr,mrt,mtp,mtt

class geoist.catalog.Catalogue.Database(Name=[], Info=[])[源代码]

基类:object

EARTHQUAKE CATALOGUE DATABASE OBJECT Initialisation parameters:

Name [str, Optional] = Catalogue identifier string Info [str, Optional] = Additional catalogue information

.Header [dict] = Container for catalogue information
.Events [list] = Container for earthquake events
.AddEvent = Add an earthquake event to the database
.DelEvent = Remove an earthquake avent from the database
.Import = Import catalogue from file (csv format)
.ImportEQT = Import catalogue form file(eqt format)
.Export = Export catalogue to file (csv format)
.ExportEQT = Export catalogue to file (eqt format)
.Load = Import database structure from binary file (cPickle compressed)
.Dump = Exprot database structure to binary file (cPickle compressed)
.Filter = Filter earthquake events by key field and rule
.Extract = Extract database information by key field
.KeyStat = Compute statistics on key field occurrence
.Copy = Create hardcopy of the database
.Append = Concatenate event list of two databases
.Size = Output number of earthquake events
.Print = Print event information on screen (by ID or index)
.Sort = Sort events according to origin time
[to check]:

.SetField = Set database key field to a specific value .GetIndex = Get event index from ID string .SetID = Regenerate progressive IDs

AddEvent(Id, Location=[], Magnitude=[], Log='', Append=False)[源代码]
Append(NewDb)[源代码]
Copy()[源代码]
DelEmpty(Key, Owrite=True)[源代码]
DelEvent(I)[源代码]
Dump(FileName)[源代码]
Export(FileName)[源代码]
ExportEQT(FileName)[源代码]
Extract(Key=[], All=False)[源代码]
Filter(Key, Value, Opr='=', Best=False, All=False, Owrite=True)[源代码]
GetIndex(Id)[源代码]
Import(FileName, Header=[], Delimiter=',', SkipLine=0, Comment='#')[源代码]
ImportEQT(FileName)[源代码]
Info()[源代码]
KeyStat(Key, Verbose=False)[源代码]
Load(FileName)[源代码]
Print(I)[源代码]
Select(Index, Boolean=False, Owrite=True)[源代码]

Catalogue selection by index. Index can be scalar or boolean (optional)

SetField(Key, Value, Match=[])[源代码]
SetID(Str0='', Str1='')[源代码]
Size()[源代码]
Sort(Key='Time', Owrite=True)[源代码]
UnWrap()[源代码]

geoist.catalog.Declusterer module

geoist.catalog.Declusterer.GardnerKnopoff(M)[源代码]
geoist.catalog.Declusterer.Grunthal(M)[源代码]
geoist.catalog.Declusterer.PlotLog(Log, OutFile=[])[源代码]

Presently only for Debug

geoist.catalog.Declusterer.Uhrhammer(M)[源代码]
geoist.catalog.Declusterer.WindowSearch(Db, WinFun=<function GardnerKnopoff>, WinScale=1)[源代码]

geoist.catalog.Exploration module

geoist.catalog.Exploration.AgencyReport(Db, Code, Key=[], LogFile=[], Threshold=0)[源代码]
geoist.catalog.Exploration.DuplicateCheck(Log, Tmax=[], Smax=[], Tnum=[], Snum=[], Smooth=[], OutFile=[])[源代码]
geoist.catalog.Exploration.GetHypocenter(Db, All=False)[源代码]
geoist.catalog.Exploration.GetKeyHisto(Db, Key, Bins=[], Bmin=[], Bmax=[], Bnum=10, Blog=False, Norm=True, Plot=True, OutFile=[])[源代码]
geoist.catalog.Exploration.GetMagnitudePair(Db, Code1, Code2)[源代码]
geoist.catalog.Exploration.KeyTimeHisto(Db, Code, Key=[], Year0=[], Year1=[], Delta=5, Threshold=0, OutFile=[])[源代码]
geoist.catalog.Exploration.MagTimeBars(Db, Mag0=[], Mag1=[], MBin=0.5, Year0=[], Year1=[], Delta=5, OutFile=[])[源代码]
geoist.catalog.Exploration.MagTimePlot(Db, Mag0=[], Mag1=[], Year0=[], Year1=[], CompTable=[], OutFile=[])[源代码]
geoist.catalog.Exploration.PlotCompTable(CompTable)[源代码]
geoist.catalog.Exploration.RateDensityPlot(Db, Mag0=[], Mag1=[], MBin=0.25, Year0=[], Year1=[], Delta=2, CompTable=[], Normalise=True, OutFile=[])[源代码]

geoist.catalog.MagRules module

geoist.catalog.MagRules.Ml_Mw_Edwards2010(MagSize, MagError)[源代码]

Polynomial

geoist.catalog.MagRules.Ms_Mw_Exp_DiGiacomo2015(MagSize, MagError)[源代码]

Exponential

geoist.catalog.MagRules.Ms_Mw_ISC_Weatherill2016(MagSize, MagError)[源代码]

Piecewise linear

geoist.catalog.MagRules.Ms_Mw_Lin_DiGiacomo2015(MagSize, MagError)[源代码]

Piecewise linear

geoist.catalog.MagRules.Ms_Mw_NEIC_Weatherill2016(MagSize, MagError)[源代码]

Piecewise linear

geoist.catalog.MagRules.Ms_Mw_Scordilis2006(MagSize, MagError)[源代码]

Linear

geoist.catalog.MagRules.Msz_Mw_NEIC_Weatherill2016(MagSize, MagError)[源代码]

Piecewise linear

geoist.catalog.MagRules.Mw_Mw_Generic(MagSize, MagError)[源代码]

Generic 1:1 conversion

geoist.catalog.MagRules.Mw_PolyReg(MagSize, MagError, Coeff)[源代码]

Conversion using polynomial coefficients

geoist.catalog.MagRules.mb_Mw_Exp_DiGiacomo2015(MagSize, MagError)[源代码]

Exponential

geoist.catalog.MagRules.mb_Mw_ISC_Weatherill2016(MagSize, MagError)[源代码]

Linear

geoist.catalog.MagRules.mb_Mw_Lin_DiGiacomo2015(MagSize, MagError)[源代码]

Linear

geoist.catalog.MagRules.mb_Mw_NEIC_Weatherill2016(MagSize, MagError)[源代码]

Linear

geoist.catalog.MagRules.mb_Mw_Scordilis2006(MagSize, MagError)[源代码]

Linear

geoist.catalog.MapTools module

class geoist.catalog.MapTools.GeoMap(Cfg=[])[源代码]

基类:object

INFO:

Map boundary edges order: [LeftLowerLon,LeftLowerLat,UpperRightLon,UpperRightLat]

Background type:

'none' 'etopo' 'esri' --> background source

Background sources available for 'esri':

ESRI_Imagery_World_2D (MapServer) ESRI_StreetMap_World_2D (MapServer) I3_Imagery_Prime_World (GlobeServer) NASA_CloudCover_World (GlobeServer) NatGeo_World_Map (MapServer) NGS_Topo_US_2D (MapServer) Ocean_Basemap (MapServer) USA_Topo_Maps (MapServer) World_Imagery (MapServer) World_Physical_Map (MapServer) World_Shaded_Relief (MapServer) World_Street_Map (MapServer) World_Terrain_Base (MapServer) World_Topo_Map (MapServer)

AreaPlot(Lon, Lat, Set=['y', 1, 'k', 1])[源代码]
BasePlot()[源代码]
Close()[源代码]
DrawBounds()[源代码]
DrawGrid()[源代码]
LabelPlot(Lon, Lat, Label, Set=['normal', 'k', 14])[源代码]
Legend(Location=[])[源代码]
MeshPlot(Lon, Lat, Elev, Cmap=[], Clim=[], Mesh=True)[源代码]
PointPlot(Lon, Lat, Label=[], Set=['o', 'y', 5, 1])[源代码]
SaveFig(OutFile, Dpi=300)[源代码]
ShapeFile(ShpFile, Name, Color='k')[源代码]
Show()[源代码]
Title(string, Set=['bold', 'k', 18])[源代码]

geoist.catalog.Parsers module

Module for Specific Catalogue Parsers

class geoist.catalog.Parsers.Database(Name=[], Info=[])[源代码]

基类:geoist.catalog.Catalogue.Database

ImportIgn(file_name)[源代码]
ImportIscGemExt(file_name)[源代码]
ImportIsf(file_name)[源代码]
ImportNdk(file_name)[源代码]

geoist.catalog.QCmulti module

Code for creating figures comparing two catalogs spanning the same time frame. Run QCmulti.py -h for command line options.

geoist.catalog.QCmulti.create_figures()[源代码]

Generate and save all relevant figures and text files.

geoist.catalog.QCmulti.generate_html(dirname, matchbool)[源代码]

Generate an HTML file containing all of the generated images and test files.

geoist.catalog.QCreport module

geoist.catalog.QCutils module

geoist.catalog.QCutils.WW2000(mcval, mags, binsize)[源代码]

Wiemer and Wyss (2000) method for determining a and b values.

geoist.catalog.QCutils.access_url(url)[源代码]

Return list of lines in url; if HTTPError, repeat.

geoist.catalog.QCutils.add_centers(catalog, gridsize)[源代码]

Add corresponding centers to catalog.

geoist.catalog.QCutils.draw_grid(lats, lons, col, alpha=1)[源代码]

Draw rectangle with vertices given in degrees.

geoist.catalog.QCutils.format_time(ogtime)[源代码]

Increase readability of given catalog times.

geoist.catalog.QCutils.get_azs_and_dists(cat1, cat2, cat1mids, cat2mids)[源代码]

Calculate azimuths for all matches between two catalogs.

geoist.catalog.QCutils.get_data(catalog, dirname, startyear=2000, endyear=2000, minmag=- 5, maxmag=12)[源代码]

Download catalog data from earthquake.usgs.gov

geoist.catalog.QCutils.get_map_bounds(cat1, cat2=None)[源代码]

Generate map bounds and gridsize.

geoist.catalog.QCutils.group_lat_lons(catalog, minmag=- 5)[源代码]

Group detections by nearest grid-square center and return min/max of counts.

geoist.catalog.QCutils.progress_bar(count, total, status='')[源代码]

Show progress bar for the desired task.

geoist.catalog.QCutils.range2rgb(rmin, rmax, numcolors)[源代码]

Create a list of red RGB values using colmin and colmax with numcolors number of colors.

geoist.catalog.QCutils.round2bin(number, binsize, direction)[源代码]

Round number to nearest histogram bin edge (either 'up' or 'down').

geoist.catalog.QCutils.round2center(num, gridsize)[源代码]

Round number to nearest grid-square center.

geoist.catalog.QCutils.round2lon(num)[源代码]

Round number to nearest timezone longitude.

geoist.catalog.QCutils.to_epoch(ogtime)[源代码]

Convert formatted time to Unix/epoch time.

geoist.catalog.QCutils.trim_times(cat1, cat2, otwindow=16)[源代码]

Trim catalogs so they span the same time window.

geoist.catalog.Regressor module

class geoist.catalog.Regressor.Data(X, Y, Xw=[], Yw=[])[源代码]

基类:object

Close()[源代码]
OrthReg(Deg=1)[源代码]

Orthogonal regressiong of a polynomial of arbitrary degree.

Plot(Xlabel='', Ylabel='', Axis=[], OutFile='', Dpi=300)[源代码]

Plot utility to check regression results.

Print()[源代码]

Print regression coefficients.

geoist.catalog.Regressor.PolyFun(B, X)[源代码]

Arbitrary polynomial of arbitrary degree. Degree is taked from the length of the coefficient array (B).

geoist.catalog.Seismicity module

geoist.catalog.Seismicity.GetEventRates(Db, CompTable, Area=1.0)[源代码]

Method to compute observed annual rates (incremental and cumulative) from a given completeness table. In this implementation, completeness is one window per magnitude bin in M. Example: CompTable = [[4.50, 0.25, 2000., 2013.],

[4.75, 0.25, 1980., 2013.], [5.00, 0.25, 1970., 2013.], [5.25, 0.25, 1960., 2013.], [5.50, 0.50, 1950., 2013.], [6.00, 1.50, 1901., 2013.]]

geoist.catalog.Seismicity.MfdCum(a, b, Mbin, Mmax)[源代码]

Cumulative MFD (Truncated Gutenberg-Richter)

geoist.catalog.Seismicity.MfdFit(ab, Enum, Mbin, Minc, Mmax, Merr, bfix=[])[源代码]

Misfit function (log normal)

geoist.catalog.Seismicity.MfdInc(a, b, Mbin, Minc, Mmax)[源代码]

Incremental MFD (for discrete magnitude intervals).

geoist.catalog.Seismicity.MfdOptimize(Enum, Mbin, Minc, Mmax, Merr=[], a0=[], b0=[], bfix=[])[源代码]

Optimisation function Note: Minc and Merr can be single (constant) values or array

geoist.catalog.Seismicity.MfdPlot(a, b, Mmax, Enum=[], Ecum=[], Mbin=[], Minc=[], OutFile=[])[源代码]
geoist.catalog.Seismicity.TableMerge(M0, M1, Y0, Y1)[源代码]

Utility to assemble a completeness table from arrays

geoist.catalog.Seismicity.TableSplit(CompTable)[源代码]

Utility to split a completeness table into arrays

geoist.catalog.Selection module

geoist.catalog.Selection.AreaSelect(Db, XY, File=[], Owrite=False, Any=False, Buffer=[], Unwrap=False)[源代码]
geoist.catalog.Selection.DepRangeSelect(Db, MinDep, MaxDep, Owrite=False, TopEdge=False)[源代码]
geoist.catalog.Selection.LocCodeSelect(Db, LocList, Best=False, Owrite=False)[源代码]
geoist.catalog.Selection.MagCodeSelect(Db, MagList, Best=False, Owrite=False)[源代码]
geoist.catalog.Selection.MagConvert(Db, MagAgency, MagOld, MagNew, ConvFun, Coeff=None, Owrite=True)[源代码]
geoist.catalog.Selection.MagRangeSelect(Db, MinMag, MaxMag, Owrite=False, Any=False, TopEdge=False)[源代码]
geoist.catalog.Selection.MergeDuplicate(DbA, DbB=[], Twin=60.0, Swin=50.0, Mwin=[], Zwin=[], Tunit='Second', Owrite=True, Log=False, LogFile=[])[源代码]
geoist.catalog.Selection.SelectPrime(Db, Owrite=False)[源代码]

This method derives from SplitPrime, assuming that: 1) Prime is always assigned for multiple solutions 2) Event with only one solution is Prime

geoist.catalog.Selection.SplitPrime(Db)[源代码]
geoist.catalog.Selection.TimeSelect(Db, Date0, Date1, Owrite=False)[源代码]

geoist.catalog.Smoothing module

geoist.catalog.Smoothing.GaussWin(Dis, Sig)[源代码]
geoist.catalog.Smoothing.SmoothMFD(Db, a, Wkt, Window=<function GaussWin>, Par=50.0, Delta=0.1, SphereGrid=False, Box=[], Buffer=[], Grid=[], Threshold=-100, Unwrap=False, ZeroRates=False)[源代码]

geoist.catalog.decorators module

class geoist.catalog.decorators.printstatus(status)[源代码]

基类:object

geoist.catalog.decorators.retry(ExceptionToCheck, tries=4, delay=4, backoff=1.5, logger=None)[源代码]

geoist.catalog.findDuplicates module

geoist.catalog.findDuplicates.detect_duplicates(catfile, otwindow=16, distwindow=100, diffnet=True)[源代码]

Return possible duplicate events within a catalog.

geoist.catalog.findDuplicates.eq_dist(lat1, lon1, lat2, lon2)[源代码]

Calculate equirectangular distance between two points.

geoist.catalog.findDuplicates.main()[源代码]

Main function. Defines command line arguments.

geoist.catalog.findDuplicates.to_epoch(ogtime)[源代码]

Convert from catalog time format to Unix/epoch time.

Module contents