Browse Source

map_plotlib statt plotlib, small fixes

main
gesap 1 week ago
parent
commit
d259e81a93
  1. 5
      README.md
  2. 79
      src/clustering.py
  3. 8
      src/clusty.py
  4. 2
      src/config.py

5
README.md

@ -18,7 +18,7 @@ prerequisits:
- python3
- python3-sklearn
- Seismology toolbox pyrocko: https://pyrocko.org/ (Heimann et al. 2017)
- gmt version 5: http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html
- for map plots: gmt version 5: http://gmt.soest.hawaii.edu/doc/5.4.5/GMT_Docs.html or cartopy
- plotly: https://plotly.com/python/
@ -224,6 +224,9 @@ settings:
# plot cluster results on a map
plot_map: True
# choose map plotting library (gmt or cartopy)
map_plotlib: cartopy
# set the logarithmic magnitude scaling (circle size) for the EQs on the map with tuple (a,b)
# markersize = a**magnitude/b
# comment out to use automated scaling instead

79
src/clustering.py

@ -26,10 +26,7 @@ import matplotlib.ticker as ticker
import string
import math
import cartopy
import cartopy.crs as ccrs
from pyrocko.plot import beachball
from cartopy.mpl.ticker import LongitudeFormatter, LatitudeFormatter
logger = logging.getLogger('__name__')
@ -217,7 +214,7 @@ def get_mag_tuple_auto(mag_min,mag_max,plotlib):
if plotlib in ['GMT','gmt']:
markersize_max = 24
markersize_min = 2
elif plotlib == 'matplotlib':
elif plotlib in ['matplotlib', 'cartopy']:
markersize_max = 24**2
markersize_min = 2**2
else:
@ -242,7 +239,7 @@ def get_scalebar_length(radius):
return scalebar_length
def scale_bar(ax, ortho=ccrs.PlateCarree(), length=None,
def scale_bar(ax, ortho, length=None,
location=(0.8, 0.1), linewidth=3, fontsize=20):
"""
@ -257,6 +254,8 @@ def scale_bar(ax, ortho=ccrs.PlateCarree(), length=None,
linewidth is the thickness of the scalebar.
"""
#Get the limits of the axis in lat long
import cartopy.crs as ccrs
llx0, llx1, lly0, lly1 = ax.get_extent(ortho)
#Make tmc horizontally centred on the middle of the map,
#vertically at scale bar location
@ -336,7 +335,7 @@ def map_plot(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False, mark_nodata=Fa
if not mark_nodata and ev.extras['clustered'] is True:
lats_nocl.append(ev.lat)
lons_nocl.append(ev.lon)
s_nocl.append(mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth))
s_nocl.append(mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth))
else:
ev_nocl_notcl.append(ev)
@ -400,19 +399,19 @@ def map_plot(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False, mark_nodata=Fa
if len(ev.extras) == 2:
lat_nocl_data.append(ev.lat)
lon_nocl_data.append(ev.lon)
s_nocl_data.append(mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth))
s_nocl_data.append(mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth))
else:
ev_nodatathresh.append(ev)
if mark_nodata:
# this is old
rows_nodatasnr = [(ev.lon, ev.lat, mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth)) for ev in ev_nodatathresh if ev.extras['note'] == 'nodatasnr']
rows_thresh = [(ev.lon, ev.lat, mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth)) for ev in ev_nodatathresh if ev.extras['note'] == 'thresh']
rows_nodatasnr = [(ev.lon, ev.lat, mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth)) for ev in ev_nodatathresh if ev.extras['note'] == 'nodatasnr']
rows_thresh = [(ev.lon, ev.lat, mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth)) for ev in ev_nodatathresh if ev.extras['note'] == 'thresh']
m.gmt.psxy(in_rows=rows_nodatasnr, S='c', *m.jxyr)
m.gmt.psxy(in_rows=rows_thresh, S='d', *m.jxyr)
m.gmt.psxy(in_columns=(lon_nocl_data, lat_nocl_data, s_nocl_data), S='c', G='grey', *m.jxyr)
else:
rows = [(ev.lon, ev.lat, mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth)) for ev in ev_nodatathresh if ev.extras['clustered'] is False]
rows = [(ev.lon, ev.lat, mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth)) for ev in ev_nodatathresh if ev.extras['clustered'] is False]
m.gmt.psxy(in_rows=rows, S='c', W='0.5p,grey', *m.jxyr)
# events without MT and without cluster number but entered DBSCAN
@ -429,7 +428,7 @@ def map_plot(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False, mark_nodata=Fa
* pmt.magnitude_to_moment(ev.magnitude)
m6 = pmt.to6(mt)
data = (ev.lon, ev.lat, 10) + tuple(m6) + (1,0,0)
s = 'd%sp' % mag_scale_log(ev.magnitude, log_tuple, mag_max,mag_min, plotlib=cl_cnf.plotlib, method=scale_meth)
s = 'd%sp' % mag_scale_log(ev.magnitude, log_tuple, mag_max,mag_min, plotlib=cl_cnf.map_plotlib, method=scale_meth)
if not cc_cnf and not mark_nodata:
if ev.extras['origins'][0] == True:
@ -481,7 +480,7 @@ def map_plot(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False, mark_nodata=Fa
cluster_color_dict[cl]=g_col
lonsnomt = [ev.lon for ev in pl_ev]
latsnomt = [ev.lat for ev in pl_ev]
sizenomt = [mag_scale_log(ev.magnitude, log_tuple, mag_max, mag_min,plotlib=cl_cnf.plotlib,method=scale_meth) for ev in pl_ev]
sizenomt = [mag_scale_log(ev.magnitude, log_tuple, mag_max, mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth) for ev in pl_ev]
m.gmt.psxy(in_columns=(lonsnomt, latsnomt, sizenomt),
G=g_col, S=symbol, W='0.5p,%s' % g_col,
*m.jxyr)
@ -495,7 +494,7 @@ def map_plot(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False, mark_nodata=Fa
g_col = util_clusty.color2rgb(pl_ev[0].extras['color'])
lonsnomt = [ev.lon for ev in pl_ev]
latsnomt = [ev.lat for ev in pl_ev]
sizenomt = [mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth) for ev in pl_ev]
sizenomt = [mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth) for ev in pl_ev]
m.gmt.psxy(in_columns=(lonsnomt, latsnomt, sizenomt),
G=g_col, S='c', W='0.5p,%s' % g_col,
*m.jxyr)
@ -511,7 +510,7 @@ def map_plot(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False, mark_nodata=Fa
* pmt.magnitude_to_moment(ev.magnitude)
m6 = pmt.to6(mt)
data = (ev.lon, ev.lat, 10) + tuple(m6) + (1,0,0)
s = 'd%sp' % mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth)
s = 'd%sp' % mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth)
m.gmt.psmeca(
in_rows=[data],
G=g_col,
@ -533,16 +532,16 @@ def map_plot(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False, mark_nodata=Fa
for i_ma, ma in enumerate(num.arange(lower,upper, step)):
if i_ma == 0:
leg = 'S 0.1i c %sp black 1p 0.3i M %.1f\n' % (mag_scale_log(ma, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth),ma)
leg = 'S 0.1i c %sp black 1p 0.3i M %.1f\n' % (mag_scale_log(ma, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth),ma)
else:
leg = leg + 'S 0.1i c %sp black 1p 0.3i M %.1f\n' % (mag_scale_log(ma, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth),ma)
leg = leg + 'S 0.1i c %sp black 1p 0.3i M %.1f\n' % (mag_scale_log(ma, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth),ma)
leg = leg + 'D 0 1p\n'
mag_leg = (mag_min+mag_max)/2
for key in sorted(cluster_color_dict.keys()):
item = cluster_color_dict[key]
leg = leg + 'S 0.1i c %sp %s - 0.3i %s\n' % (mag_scale_log(mag_leg, log_tuple, mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth), item, key)
leg = leg + 'S 0.1i c %sp %s - 0.3i %s\n' % (mag_scale_log(mag_leg, log_tuple, mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth), item, key)
with open('leg.txt', 'w') as f:
f.write(leg)
@ -595,7 +594,7 @@ def map_plot_carto_local(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False):
if ev.extras['clustered'] is True:
norths_nocl.append(ev.north_shift)
easts_nocl.append(ev.east_shift)
s_nocl.append(mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth))
s_nocl.append(mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth))
else:
ev_nocl_notcl.append(ev)
print('Total:', len(catalog))
@ -650,7 +649,7 @@ def map_plot_carto_local(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False):
if ev_nocl_notcl:
easts_nocl_notcl = [ev.east_shift for ev in ev_nocl_notcl if ev.extras['clustered'] is False]
norths_nocl_notcl = [ev.north_shift for ev in ev_nocl_notcl if ev.extras['clustered'] is False]
size_nocl_notcl= [mag_scale_log(ev.magnitude, log_tuple, mag_max, mag_min, plotlib=cl_cnf.plotlib,method=scale_meth)\
size_nocl_notcl= [mag_scale_log(ev.magnitude, log_tuple, mag_max, mag_min, plotlib=cl_cnf.map_plotlib,method=scale_meth)\
for ev in ev_nocl_notcl if ev.extras['clustered'] is False]
ax.scatter(easts_nocl_notcl,norths_nocl_notcl, s=size_nocl_notcl, marker='o',
@ -664,7 +663,7 @@ def map_plot_carto_local(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False):
mmt = ev.moment_tensor
markersize = mag_scale_log(ev.magnitude, log_tuple, mag_max,mag_min,
plotlib=cl_cnf.plotlib,method=scale_meth)
plotlib=cl_cnf.map_plotlib,method=scale_meth)
if ev.extras['clustered']:
ggcol = 'grey'
@ -703,7 +702,7 @@ def map_plot_carto_local(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False):
hex_color = pl_ev[0].extras['color']
easts_nomt = [ev.east_shift for ev in pl_ev]
norths_nomt = [ev.north_shift for ev in pl_ev]
sizenomt = [mag_scale_log(ev.magnitude, log_tuple, mag_max, mag_min, plotlib=cl_cnf.plotlib,method=scale_meth)\
sizenomt = [mag_scale_log(ev.magnitude, log_tuple, mag_max, mag_min, plotlib=cl_cnf.map_plotlib,method=scale_meth)\
for ev in pl_ev]
ax.scatter(easts_nomt, norths_nomt, s=sizenomt, marker=symbol,
@ -723,7 +722,7 @@ def map_plot_carto_local(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False):
easts_nomt = [ev.east_shift for ev in pl_ev]
norths_nomt = [ev.north_shift for ev in pl_ev]
sizenomt = [mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth) for ev in pl_ev]
sizenomt = [mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth) for ev in pl_ev]
ax.scatter(easts_nomt, norths_nomt, s=sizenomt, marker='o', c=hex_col,
lw=0.5, zorder=4)
@ -731,7 +730,7 @@ def map_plot_carto_local(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False):
# clustered events with an MT
for ev in ev_mt:
mmt = ev.moment_tensor
markersize = mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth)
markersize = mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth)
beachball.plot_beachball_mpl(
mmt, ax,
@ -761,7 +760,7 @@ def map_plot_carto_local(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False):
for i_ma, ma in enumerate(num.arange(lower,upper, step)):
markersize = mag_scale_log(ma, log_tuple,mag_max,mag_min,
plotlib=cl_cnf.plotlib,method=scale_meth)
plotlib=cl_cnf.map_plotlib,method=scale_meth)
mag_handle = plt.plot((0,0.5), ls='', marker="o", markerfacecolor='None',
markeredgecolor='black', ms=markersize**0.5, color='k', label='%.1f' % ma)[0]
@ -786,6 +785,10 @@ def map_plot_carto_local(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False):
def map_plot_carto(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False):
import cartopy
import cartopy.crs as ccrs
from cartopy.mpl.ticker import LongitudeFormatter, LatitudeFormatter
faults = cl_cnf.map_faults_path
@ -821,7 +824,7 @@ def map_plot_carto(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False):
if ev.extras['clustered'] is True:
lats_nocl.append(ev.lat)
lons_nocl.append(ev.lon)
s_nocl.append(mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth))
s_nocl.append(mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth))
else:
ev_nocl_notcl.append(ev)
@ -895,7 +898,7 @@ def map_plot_carto(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False):
if ev_nocl_notcl:
lons_nocl_notcl = [ev.lon for ev in ev_nocl_notcl if ev.extras['clustered'] is False]
lats_nocl_notcl = [ev.lat for ev in ev_nocl_notcl if ev.extras['clustered'] is False]
size_nocl_notcl = [mag_scale_log(ev.magnitude, log_tuple, mag_max, mag_min, plotlib=cl_cnf.plotlib,method=scale_meth) for ev in ev_nocl_notcl if ev.extras['clustered'] is False]
size_nocl_notcl = [mag_scale_log(ev.magnitude, log_tuple, mag_max, mag_min, plotlib=cl_cnf.map_plotlib,method=scale_meth) for ev in ev_nocl_notcl if ev.extras['clustered'] is False]
ax.scatter(lons_nocl_notcl,lats_nocl_notcl, s=size_nocl_notcl, marker='o',
facecolors='None', edgecolor='#BEBEBE', lw=0.5, zorder=1)
@ -908,7 +911,7 @@ def map_plot_carto(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False):
mmt = ev.moment_tensor
markersize = mag_scale_log(ev.magnitude, log_tuple, mag_max,mag_min,
plotlib=cl_cnf.plotlib,method=scale_meth)
plotlib=cl_cnf.map_plotlib,method=scale_meth)
if ev.extras['clustered']:
ggcol = 'grey'
@ -948,7 +951,7 @@ def map_plot_carto(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False):
hex_color = pl_ev[0].extras['color']
lonsnomt = [ev.lon for ev in pl_ev]
latsnomt = [ev.lat for ev in pl_ev]
sizenomt = [mag_scale_log(ev.magnitude, log_tuple, mag_max, mag_min, plotlib=cl_cnf.plotlib,method=scale_meth) for ev in pl_ev]
sizenomt = [mag_scale_log(ev.magnitude, log_tuple, mag_max, mag_min, plotlib=cl_cnf.map_plotlib,method=scale_meth) for ev in pl_ev]
ax.scatter(lonsnomt, latsnomt, s=sizenomt, marker=symbol,
c=hex_color, lw=0.5, zorder=3)
@ -966,7 +969,7 @@ def map_plot_carto(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False):
lonsnomt = [ev.lon for ev in pl_ev]
latsnomt = [ev.lat for ev in pl_ev]
sizenomt = [mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth) for ev in pl_ev]
sizenomt = [mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth) for ev in pl_ev]
ax.scatter(lonsnomt, latsnomt, s=sizenomt, marker='o', c=hex_col,
lw=0.5, zorder=4)
@ -974,7 +977,7 @@ def map_plot_carto(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False):
# clustered events with an MT
for ev in ev_mt:
mmt = ev.moment_tensor
markersize = mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth)
markersize = mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth)
beachball.plot_beachball_mpl(
mmt, ax,
@ -1005,7 +1008,7 @@ def map_plot_carto(catalog, method, cc_cnf, cl_cnf, work_dir, fn=False):
for i_ma, ma in enumerate(num.arange(lower,upper, step)):
markersize = mag_scale_log(ma, log_tuple,mag_max,mag_min,
plotlib=cl_cnf.plotlib,method=scale_meth)
plotlib=cl_cnf.map_plotlib,method=scale_meth)
mag_handle = plt.plot((0,0.5), ls='', marker="o", markerfacecolor='None',
markeredgecolor='black', ms=markersize**0.5, color='k', label='%.1f' % ma)[0]
@ -3035,7 +3038,7 @@ def map_plot_freqmerge(catalog, method, cl_cnf):
else:
lats_nocl.append(ev.lat)
lons_nocl.append(ev.lon)
s_nocl.append(mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,libmethod=scale_meth))
s_nocl.append(mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,libmethod=scale_meth))
# map dimensions:
lats_all = sorted([ev.lat for ev in catalog]) # if ev.extras['cluster_number'] != -1]
@ -3096,7 +3099,7 @@ def map_plot_freqmerge(catalog, method, cl_cnf):
* pmt.magnitude_to_moment(ev.magnitude)
m6 = pmt.to6(mt)
data = (ev.lon, ev.lat, 10) + tuple(m6) + (1,0,0)
s = 'd%sp' % mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth)
s = 'd%sp' % mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth)
m.gmt.psmeca(
in_rows=[data],
G=g_col,
@ -3113,13 +3116,13 @@ def map_plot_freqmerge(catalog, method, cl_cnf):
g_col = util_clusty.color2rgb(ev.extras['color'])
for i in range(origins):
if ev.extras['origins'][i] == True:
s = '%s%sp' % (symbol_list[i], mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth))
s = '%s%sp' % (symbol_list[i], mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth))
#elif ev.extras['origins'][1] == True:
# s = '%s%sp' % (symbol_list[], mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth))
# s = '%s%sp' % (symbol_list[], mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth))
#elif ev.extras['origins'][2] == True:
# s = '%s%sp' % (symbol_list[], mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth))
# s = '%s%sp' % (symbol_list[], mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth))
#elif ev.extras['origins'][3] == True:
# s = '%s%sp' % (symbol_list[], mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth))
# s = '%s%sp' % (symbol_list[], mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth))
m.gmt.psxy(in_columns=([ev.lon], [ev.lat]),
G=g_col, S=s, W='0.5p,%s' % g_col,
*m.jxyr)
@ -3134,7 +3137,7 @@ def map_plot_freqmerge(catalog, method, cl_cnf):
* pmt.magnitude_to_moment(ev.magnitude)
m6 = pmt.to6(mt)
data = (ev.lon, ev.lat, 10) + tuple(m6) + (1,0,0)
s = 'd%sp' % mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.plotlib,method=scale_meth)
s = 'd%sp' % mag_scale_log(ev.magnitude, log_tuple,mag_max,mag_min,plotlib=cl_cnf.map_plotlib,method=scale_meth)
if ev.extras['origins'][0] == True:
m.gmt.psmeca(
in_rows=[data],

8
src/clusty.py

@ -911,9 +911,9 @@ def main():
if cl_cnf.plot_map:
if cc_cnf.coordinate_system == 'spherical':
if cl_cnf.plotlib in ['gmt','GMT']:
if cl_cnf.map_plotlib in ['gmt','GMT']:
cl.map_plot(result_catalog, method_string, cc_cnf=cc_cnf, cl_cnf=cl_cnf, work_dir=basic_cnf.work_dir)
elif cl_cnf.plotlib in ['matplotlib','cartopy']:
elif cl_cnf.map_plotlib in ['matplotlib','cartopy']:
cl.map_plot_carto(result_catalog, method_string, cc_cnf=cc_cnf, cl_cnf=cl_cnf, work_dir=basic_cnf.work_dir)
elif cc_cnf.coordinate_system in ['cartesian','plane','local']:
cl.map_plot_carto_local(result_catalog, method_string, cc_cnf=cc_cnf, cl_cnf=cl_cnf, work_dir=basic_cnf.work_dir)
@ -1103,9 +1103,9 @@ def main():
fn = '%s/results/cluster_map_%s.pdf' % (work_dir,method)
if cl_cnf.plot_map:
if cc_cnf.coordinate_system == 'spherical':
if cl_cnf.plotlib in ['gmt','GMT']:
if cl_cnf.map_plotlib in ['gmt','GMT']:
cl.map_plot_freqmerge(cat_merged, method_string, cc_cnf=False, cl_cnf=cl_cnf, work_dir=basic_cnf.work_dir)
elif cl_cnf.plotlib in ['matplotlib','cartopy']:
elif cl_cnf.map_plotlib in ['matplotlib','cartopy']:
logger.info('Multiple catalogs not implemented in matplotlib/cartopy')
#cl.map_plot_carto(cat_merged, method_string, cc_cnf=False, cl_cnf=cl_cnf, work_dir=basic_cnf.work_dir)
elif cc_cnf.coordinate_system in ['cartesian','plane','local']:

2
src/config.py

@ -75,7 +75,7 @@ class clustering_settings(Object):
plot_map = Bool.T(default=True)
focus_map_plot = Float.T(default=1.0,
help='radius relative to largest distance between events, exclude outliers by setting to value below 1.0')
plotlib = String.T(default='gmt', help='\'gmt\' option needs gmt5, chose \'matplotlib\' for cartopy-based maps')
map_plotlib = String.T(default='gmt', help='\'gmt\' option needs gmt5, chose \'matplotlib\' or \'cartopy\' for cartopy-based maps')
wf_plot = Tuple.T(default=())
wf_plot_stats = List.T(optional=True)
wf_cl_snuffle = Tuple.T(default=())

Loading…
Cancel
Save