def injection_legend(leg_file): args = {'D': 'x0.1/7.5+w4/2/TC', 'C': '0.1i/0.1i', 'F': '+gwhite+p'} with LibGMT() as lib: file_context = dummy_context(leg_file) with file_context as fname: arg_str = ' '.join([fname, build_arg_string(args)]) lib.call_module('pslegend', arg_str) return
def plot_date_text(dto): pt = '176.21 -38.515' with open('tmp_text.csv', 'w') as f: f.write('{} @:14:Date: {}@::'.format(pt, dto.strftime('%d-%m-%Y'))) with LibGMT() as lib: file_context = dummy_context('tmp_text.csv') with file_context as fname: lib.call_module('pstext', fname) os.remove('tmp_text.csv') return
def plot_NM5_7_4(): pts5_7 = '/home/chet/gmt/data/NZ/wells/NM05_NM07_pts.gmt' args5_7 = {'D': '0.25/0.15', 'F': '+jCB+f8p,red'} pt4 = '/home/chet/gmt/data/NZ/wells/NM04_pt.gmt' args4 = {'D': '0.35/-0.35'} with LibGMT() as lib: for pts, kwargs in zip([pts5_7, pt4], [args5_7, args4]): file_context = dummy_context(pts) with file_context as fname: arg_str = ' '.join([fname, build_arg_string(kwargs)]) lib.call_module('pstext', arg_str) return
def plot_Nga_section_line(start_pt, end_pt, fig): fig.plot(x=np.asarray([start_pt[0], end_pt[0]]), y=np.asarray([start_pt[1], end_pt[1]]), W='1.0,black,-') labels_file = '/home/chet/gmt/data/NZ/misc/section_labels.txt' with LibGMT() as lib: label_args = {'F': '+f16p,black,-'} file_context = dummy_context(labels_file) with file_context as fname: arg_str = ' '.join([fname, build_arg_string(label_args)]) lib.call_module('pstext', arg_str) return
def plot_fm_depth(catalog, center_pt, end_pt, region, scale, Y, B_list, fig, old_cat): if old_cat: color = 'grey' tmp_file = gmt_project(old_cat, center_pt, end_pt, fm_file='/home/chet/gmt/tmp/tmp_old.psmeca') args = {'S': 'a2.0', 'G': color, 'C': '0.5P0.1', 'J': scale, 'R': '{}/{}/{}/{}'.format(region[0], region[1], region[2], region[3]), 'Y': Y} with LibGMT() as lib: file_context = dummy_context(tmp_file) with file_context as fname: arg_str = ' '.join([fname, build_arg_string(args)]) lib.call_module('psmeca', arg_str) color = 'blue' tmp_filen = gmt_project(catalog, center_pt, end_pt, fm_file='/home/chet/gmt/tmp/tmp.psmeca') args = {'S': 'a2.0', 'G': color, 'C': '0.5P0.1'} with LibGMT() as lib: file_context = dummy_context(tmp_filen) with file_context as fname: arg_str = ' '.join([fname, build_arg_string(args)]) lib.call_module('psmeca', arg_str) fig.basemap(B=B_list) else: color = 'blue' tmp_file = gmt_project(catalog, center_pt, end_pt, fm_file='/home/chet/gmt/tmp/tmp.psmeca') args = {'S': 'a2.0', 'G': color, 'C': '0.5P0.1', 'J': scale, 'R': '{}/{}/{}/{}'.format(region[0], region[1], region[2], region[3]), 'Y': Y} with LibGMT() as lib: file_context = dummy_context(tmp_file) with file_context as fname: arg_str = ' '.join([fname, build_arg_string(args)]) lib.call_module('psmeca', arg_str) fig.basemap(B=B_list) return
def plot_fm_map(catalog, fm_file, color, old_cat=False): # Write temporary outfile for psmeca plotting tmp_file = '/home/chet/gmt/tmp/tmp.psmeca' if old_cat: tmp_file = '/home/chet/gmt/tmp/tmp_old.psmeca' format_arnold_to_gmt(fm_file, catalog, outfile=tmp_file, names=False, id_type='detection') args = {'S': 'a2.0', 'G': color, 'C': '0.5P0.1'} with LibGMT() as lib: file_context = dummy_context(tmp_file) with file_context as fname: arg_str = ' '.join([fname, build_arg_string(args)]) lib.call_module('psmeca', arg_str) return
def plot_background_datasets(fig, region): fig.plot(region=region, projection='M13', Y='10', data='/home/chet/gmt/data/NZ/resistivity/RT_Boundary_Risk_2000.gmt', color='lightgray') fig.plot( data='/home/chet/gmt/data/NZ/resistivity/NM_Boundary_Bosely2010.gmt', color='lightgray') # Water fig.plot(data='/home/chet/gmt/data/NZ/water/taupo_lakes.gmt', color='cornflowerblue') fig.plot(data='/home/chet/gmt/data/NZ/water/taupo_river_polygons.gmt', color='cornflowerblue') # Faults fig.plot(data='/home/chet/gmt/data/NZ/faults/NZ_active_faults.gmt', W='0.85') # AFZ label with LibGMT() as lib: label_args = {'F': '+f10p+a50'} file_context = dummy_context('/home/chet/gmt/data/NZ/faults/afz_text.txt') with file_context as fname: arg_str = ' '.join([fname, build_arg_string(label_args)]) lib.call_module('pstext', arg_str) fig.basemap(L='x11.5/1/-38/1', frame=['0.02', 'wsEN']) return