Exemplo n.º 1
0
url = data.ispec_catalog_url
filename = '2020-03-25CENC-M4.7.dat'
localpath = downloadurl(url + filename, filename)
print(localpath)  #文件路径

db2 = cat.Database('2020-03-25CENC-M4.7')
# header = ['Year', 'Month','Day','Hour','Minute','Second','Latitude','Longitude', 'Depth','MagType','MagSize','Log']
# db2.Import0(localpath, Header = header, Delimiter= ' ', flag = False)

db2.Import0('D:/MyWorks/geoist/geoist/catalog/data/us2010-2012.csv')
#header = ['time', 'latitude','longitude', 'depth','mag','magType','type']
#db2.Import0('D:/MyWorks/geoist/geoist/catalog/data/us2010-2012-1.csv') #, Header=header)
#db2.Size()
#db2.Events[2]
db2.Info()
exp.MagTimePlot(db2)

#print(gi.EXAMPLES_PATH, gi.DATA_PATH, gi.TEMP_PATH)
##gi.__verison__
##gi.log.info('test')
#pathname,prefix = qc.create_figures_new(qc.qcinit(), catalog_file = 'us2010-2012.csv')
pathname, prefix = qc.create_figures_new(qc.qcinit(), db2)

# import pandas as pd
# df = pd.DataFrame(columns=['newind','time','latitude','longitude', 'depth' ,'mag', 'magType'])
# dt = pd.DataFrame({'year': db2.Extract('Year'), 'month': db2.Extract('Month'),
#               'day': db2.Extract('Day'),'hour': db2.Extract('Hour'),'minute': db2.Extract('Minute'),
#               'second': db2.Extract('Second')} )
# df['newind'] = pd.to_datetime(dt)
# df['id'] = db2.Extract('Id')
# df['time'] = [x.strftime("%Y-%m-%dT%H:%M:%S.%fZ") for x in df['newind'].tolist()]
Exemplo n.º 2
0
if CASE == 2:
  p = pathname+"/data/area.xy"
  Db2 = Sel.AreaSelect(Db1,p,File='xy')
  P = Ct.Polygon()
  P.Import(p)

if CASE == 3:
  p = pathname+"/data/area.wkt"
  Db2 = Sel.AreaSelect(Db1,p,File='wkt')
  P = Ct.Polygon()
  P.Import(p,Type='wkt')

#-----------------------------------------------------------------------------------------
# Get Coordinates

x1,y1,z1 = Exp.GetHypocenter(Db1)
x2,y2,z2 = Exp.GetHypocenter(Db2)

#-----------------------------------------------------------------------------------------
# Map Plot

# Reshape polygon (to plot area)
P.x.append(P.x[0])
P.y.append(P.y[0]) 

# Plot map
cfg = {'Bounds': [10., -40., 60., 20.],
       'FigSize': [8., 6.],
       'Background': ['none',[0.9,0.8,0.6],[0.5,0.8,1.]],
       'Grid': [10., 10.]}
Exemplo n.º 3
0
          SkipLine=1,
          Delimiter=',')

Db.SetField('LocCode', 'ISC-GEM')
Db.SetField('MagCode', 'ISC-GEM')
Db.SetField('MagType', 'MW')
#-----------------------------------------------------------------------------------------
# Search Area (China) using internal filter
lon = [70, 135]
lat = [15, 55]
#地震筛选
Db.Filter('Latitude', lat[0], Opr='>=')
Db.Filter('Latitude', lat[1], Opr='<=')
Db.Filter('Longitude', lon[0], Opr='>=')
Db.Filter('Longitude', lon[1], Opr='<=')
Exp.AgencyReport(Db, 'L')
#二维时间序列图
Exp.MagTimePlot(Db)
Exp.MagTimeBars(Db)
Exp.RateDensityPlot(Db)
# G-R关系
Enum, Mbin = Exp.GetKeyHisto(Db, 'MagSize', Bnum=10, Norm=False)
Minc = (max(Mbin) - min(Mbin)) / 10.
#拟合b值
a, b = Sem.MfdOptimize(Enum, Mbin, Minc, max(Mbin))
print('b-value=', b)
#复发概率
Sem.MfdPlot(a,
            b,
            max(Mbin),
            Enum=Enum,
Exemplo n.º 4
0
usgsfile = 'usgsca.csv'
localpath2 = usgs_catalog(usgsfile, '1970-01-01', '2020-01-01', '15','55','70','135',minmag = '5')
print(localpath2) 
dbusgs = cat.Database(usgsfile)
dbusgs.Import0(localpath2)
dbusgs.Info()

#平滑地震目录
#pdb.set_trace()
p = [(90.,20.),(90.,40.),(105.,40.),(105.,20.),(90.,20.)]
db3 = sel.AreaSelect(dbusgs,p)
P = ct.Polygon()
P.Load(p)

x1,y1,z1 = exp.GetHypocenter(db3)
wkt = ct.XYToWkt(P.x, P.y)
xsm, ysm, asm = sm.SmoothMFD(db3, 1., wkt, Delta=0.5)
cfg1 = {'Bounds': [90., 20., 105., 40.],
        'FigSize': [10., 12.],
        'Background': ['none',[0.9,0.8,0.6],[0.5,0.8,1.]],
        'Grid': [5., 5.]}
m1 = mapt.GeoMap(cfg1)
m1.BasePlot()
m1.MeshPlot(xsm, ysm, asm)
#m1.AreaPlot(P.x, P.y, Set=['y',0.5,'k',1])
#m1.PointPlot(xsm, ysm, Set=['o','b',2,1], Label='Grid')
m1.PointPlot(x1, y1, Set=['o','g',5,1], Label='全部')
m1.DrawGrid()
m1.Title('川滇地区地震目录高斯平滑')
m1.Show()
Exemplo n.º 5
0
# Plot map

cfg = {
    'Bounds': [-20., 30., 60., 60.],
    'FigSize': [8., 6.],
    'Background': ['none', [0.9, 0.8, 0.6], [0.5, 0.8, 1.]],
    'Grid': [10., 10.]
}

M = Map.GeoMap(cfg)

M.BasePlot()
M.DrawBounds()
M.DrawGrid()

MagTab = [[3, 4, ['d', 'w', 2, 1]], [4, 5, ['^', 'y', 4, 1]],
          [5, 6, ['o', 'g', 6, 1]], [6, 7, ['s', 'r', 8, 1]],
          [7, 8, ['p', 'm', 10, 1]]]

for mt in MagTab:

    # Selection by magnitude range
    DbC = Sel.MagRangeSelect(Db, mt[0], mt[1])
    x, y, z = Exp.GetHypocenter(DbC)
    M.PointPlot(x, y, Set=mt[2])

M.Title('Example - cattools parseing ndk')
M.Show()

#M.SaveFig(pathname+'/data/example9.png')
Exemplo n.º 6
0
db2.SetField('LocCode', 'CENC')
db2.SetField('MagCode', 'CENC4.7')

#地震筛选
# Search Area (China) using internal filter
lon = [70, 135]
lat = [15, 55]
db2.Filter('Latitude', lat[0], Opr='>=')
db2.Filter('Latitude', lat[1], Opr='<=')
db2.Filter('Longitude', lon[0], Opr='>=')
db2.Filter('Longitude', lon[1], Opr='<=')

db2.Info()
#二维时间序列图
exp.MagTimePlot(db2)
exp.MagTimeBars(db2)
exp.RateDensityPlot(db2)
# G-R关系
enum, mbin = exp.GetKeyHisto(db2, 'MagSize', Bnum=20, Norm=False)
minc = (max(mbin) - min(mbin)) / 10.
#拟合b值
a, b = sem.MfdOptimize(enum, mbin, minc, max(mbin))
print('b-value=', b)
#复发概率
sem.MfdPlot(a,
            b,
            max(mbin),
            Enum=enum,
            Ecum=np.cumsum(enum[::-1])[::-1],
            Mbin=mbin,