initial upload
This commit is contained in:
BIN
examples/realcase2_teleseismic_tomography_Thailand/.DS_Store
vendored
Normal file
BIN
examples/realcase2_teleseismic_tomography_Thailand/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -0,0 +1,187 @@
|
||||
version: 3
|
||||
|
||||
#################################################
|
||||
# computational domian #
|
||||
#################################################
|
||||
domain:
|
||||
min_max_dep: [-50, 550] # depth in km
|
||||
min_max_lat: [10.5, 22.5] # latitude in degree
|
||||
min_max_lon: [95.5, 107.5] # longitude in degree
|
||||
n_rtp: [121, 121, 121] # number of nodes in depth,latitude,longitude direction
|
||||
|
||||
#################################################
|
||||
# traveltime data file path #
|
||||
#################################################
|
||||
source:
|
||||
src_rec_file: 1_src_rec_files/src_rec_file.dat # source receiver file path
|
||||
swap_src_rec: false # swap source and receiver
|
||||
|
||||
#################################################
|
||||
# initial model file path #
|
||||
#################################################
|
||||
model:
|
||||
init_model_path: 2_models/model_init_N121_121_121.h5 # path to initial model file
|
||||
|
||||
#################################################
|
||||
# parallel computation settings #
|
||||
#################################################
|
||||
parallel: # parameters for parallel computation
|
||||
n_sims: 8 # number of simultanoues runs (parallel the sources)
|
||||
ndiv_rtp: [1, 1, 1] # number of subdivision on each direction (parallel the computional domain)
|
||||
|
||||
############################################
|
||||
# output file setting #
|
||||
############################################
|
||||
output_setting:
|
||||
output_dir: OUTPUT_FILES/OUTPUT_FILES_real # path to output director (default is ./OUTPUT_FILES/)
|
||||
output_source_field: false # True: output the traveltime field and adjoint field of all sources at each iteration. Default: false. File: 'out_data_sim_group_X'.
|
||||
output_kernel: false
|
||||
output_final_model: true # True: output merged final model. This file can be used as the input model for TomoATT. Default: true. File: 'model_final.h5'.
|
||||
output_middle_model: false # True: output merged intermediate models during inversion. This file can be used as the input model for TomoATT. Default: false. File: 'middle_model_step_XXXX.h5'
|
||||
output_in_process: false # True: output at each inv iteration, otherwise, only output step 0, Niter-1, Niter. Default: true. File: 'out_data_sim_group_0'.
|
||||
output_in_process_data: false # True: output src_rec_file at each inv iteration, otherwise, only output step 0, Niter-2, Niter-1. Default: true. File: 'src_rec_file_step_XXXX.dat'
|
||||
single_precision_output: false # True: output results in single precision. Default: false.
|
||||
verbose_output_level: 0 # output internal parameters, (to do)
|
||||
output_file_format: 0 # 0: hdf5, 1: ascii
|
||||
|
||||
# output files:
|
||||
# File: 'out_data_grid.h5'. Keys: ['Mesh']['elem_conn'], element index;
|
||||
# ['Mesh']['node_coords_p'], phi coordinates of nodes;
|
||||
# ['Mesh']['node_coords_t'], theta coordinates of nodes;
|
||||
# ['Mesh']['node_coords_r'], r coordinates of nodes;
|
||||
# ['Mesh']['node_coords_x'], phi coordinates of elements;
|
||||
# ['Mesh']['node_coords_y'], theta coordinates of elements;
|
||||
# ['Mesh']['node_coords_z'], r coordinates of elements;
|
||||
# File: 'out_data_sim_group_0'. Keys: ['model']['vel_inv_XXXX'], velocity model at iteration XXXX;
|
||||
# ['model']['xi_inv_XXXX'], xi model at iteration XXXX;
|
||||
# ['model']['eta_inv_XXXX'], eta model at iteration XXXX
|
||||
# ['model']['Ks_inv_XXXX'], sensitivity kernel related to slowness at iteration XXXX
|
||||
# ['model']['Kxi_inv_XXXX'], sensitivity kernel related to xi at iteration XXXX
|
||||
# ['model']['Keta_inv_XXXX'], sensitivity kernel related to eta at iteration XXXX
|
||||
# ['model']['Ks_density_inv_XXXX'], kernel density of Ks at iteration XXXX
|
||||
# ['model']['Kxi_density_inv_XXXX'], kernel density of Kxi at iteration XXXX
|
||||
# ['model']['Keta_density_inv_XXXX'], kernel density of Keta at iteration XXXX
|
||||
# ['model']['Ks_over_Kden_inv_XXXX'], slowness kernel over kernel density at iteration XXXX
|
||||
# ['model']['Kxi_over_Kden_inv_XXXX'], xi kernel over kernel density at iteration XXXX
|
||||
# ['model']['Keta_over_Kden_inv_XXXX'], eta kernel over kernel density at iteration XXXX
|
||||
# ['model']['Ks_update_inv_XXXX'], slowness kernel over kernel density at iteration XXXX, smoothed by inversion grid
|
||||
# ['model']['Kxi_update_inv_XXXX'], xi kernel over kernel density at iteration XXXX, smoothed by inversion grid
|
||||
# ['model']['Keta_update_inv_XXXX'], eta kernel over kernel density at iteration XXXX, smoothed by inversion grid
|
||||
# ['1dinv']['vel_1dinv_inv_XXXX'], 2d velocity model at iteration XXXX, in 1d inversion mode
|
||||
# ['1dinv']['r_1dinv'], r coordinates (depth), in 1d inversion mode
|
||||
# ['1dinv']['t_1dinv'], t coordinates (epicenter distance), in 1d inversion mode
|
||||
# File: 'src_rec_file_step_XXXX.dat' or 'src_rec_file_forward.dat'. The synthetic traveltime data file.
|
||||
# File: 'final_model.h5'. Keys: ['eta'], ['xi'], ['vel'], the final model.
|
||||
# File: 'middle_model_step_XXXX.h5'. Keys: ['eta'], ['xi'], ['vel'], the model at step XXXX.
|
||||
# File: 'inversion_grid.txt'. The location of inversion grid nodes
|
||||
# File: 'objective_function.txt'. The objective function value at each iteration
|
||||
# File: 'out_data_sim_group_X'. Keys: ['src_YYYY']['time_field_inv_XXXX'], traveltime field of source YYYY at iteration XXXX;
|
||||
# ['src_YYYY']['adjoint_field_inv_XXXX'], adjoint field of source YYYY at iteration XXXX;
|
||||
# ['1dinv']['time_field_1dinv_YYYY_inv_XXXX'], 2d traveltime field of source YYYY at iteration XXXX, in 1d inversion mode
|
||||
# ['1dinv']['adjoint_field_1dinv_YYYY_inv_XXXX'], 2d adjoint field of source YYYY at iteration XXXX, in 1d inversion mode
|
||||
|
||||
|
||||
#################################################
|
||||
# inversion or forward modeling #
|
||||
#################################################
|
||||
# run mode
|
||||
# 0 for forward simulation only,
|
||||
# 1 for inversion
|
||||
# 2 for earthquake relocation
|
||||
# 3 for inversion + earthquake relocation
|
||||
# 4 for 1d model inversion
|
||||
run_mode: 1
|
||||
|
||||
have_tele_data: true # An error will be reported if false but source out of study region is used. Default: false.
|
||||
ignore_velocity_discontinuity: true # An error will be reported if false but there is velocity discontinuity (v[ix,iy,iz+1] > v[ix,iy,iz] * 1.2 or v[ix,iy,iz+1] < v[ix,iy,iz] * 0.8) in the input model. Default: false.
|
||||
|
||||
###################################################
|
||||
# model update parameters setting #
|
||||
###################################################
|
||||
model_update:
|
||||
max_iterations: 80 # maximum number of inversion iterations
|
||||
|
||||
step_length: 0.01 # the initial step length of model perturbation. 0.01 means maximum 1% perturbation for each iteration.
|
||||
|
||||
# parameters for optim_method 0 (gradient_descent)
|
||||
optim_method_0:
|
||||
# if step_method:1. if the angle between the current and the previous gradients is greater than step_length_gradient_angle, step size -> step length * step_length_change[0].
|
||||
# otherwise, step size -> step length * step_length_change[1].
|
||||
step_length_gradient_angle: 120 # default: 120.0
|
||||
step_length_change: [0.5, 1.41] # default: [0.5,1.2]
|
||||
Kdensity_coe: 0.3 # default: 0.0, range: 0.0 - 1.0
|
||||
|
||||
# parameters for smooth method 0 (multigrid model parametrization)
|
||||
# inversion grid can be viewed in OUTPUT_FILES/inversion_grid.txt
|
||||
n_inversion_grid: 5 # number of inversion grid sets
|
||||
|
||||
uniform_inv_grid_dep: false # true if use uniform inversion grid for dep, false if use flexible inversion grid
|
||||
uniform_inv_grid_lat: false # true if use uniform inversion grid for lat, false if use flexible inversion grid
|
||||
uniform_inv_grid_lon: false # true if use uniform inversion grid for lon, false if use flexible inversion grid
|
||||
|
||||
# settings for flexible inversion grid
|
||||
dep_inv: [-50, -25, 0, 50, 100, 150, 200, 275, 350, 425, 500, 600,700] # inversion grid for vel in depth (km)
|
||||
lat_inv: [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23] # inversion grid for vel in latitude (degree)
|
||||
lon_inv: [95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108] # inversion grid for vel in longitude (degree)
|
||||
trapezoid: [1, 0, 50] # usually set as [1.0, 0.0, 50.0] (default)
|
||||
|
||||
# if we want to use another inversion grid for inverting anisotropy, set invgrid_ani: true (default: false)
|
||||
invgrid_ani: false
|
||||
|
||||
# ---------- flexible inversion grid setting for anisotropy ----------
|
||||
# settings for flexible inversion grid for anisotropy
|
||||
dep_inv_ani: [-5, -2, 0, 3, 7, 12, 17, 23, 30, 38, 47, 57] # inversion grid for ani in depth (km)
|
||||
lat_inv_ani: [-2.8, -2.3, -1.8, -1.3, -0.8, -0.3, 0.2, 0.7, 1.2, 1.7, 2.2, 2.7] # inversion grid for ani in latitude (degree)
|
||||
lon_inv_ani: [-1.2, -0.9, -0.6, -0.3, 0, 0.3, 0.6, 0.9, 1.2] # inversion grid for ani in longitude (degree)
|
||||
trapezoid_ani: [1, 0, 50] # usually set as [1.0, 0.0, 50.0] (default)
|
||||
|
||||
|
||||
# Carefully change trapezoid and trapezoid_ani, if you really want to use trapezoid inversion grid, increasing the inversion grid spacing with depth to account for the worse data coverage in greater depths.
|
||||
# The trapezoid_ inversion grid with index (i,j,k) in longitude, latitude, and depth is defined as:
|
||||
# if dep_inv[k] < trapezoid[1], lon = lon_inv[i];
|
||||
# lat = lat_inv[j];
|
||||
# dep = dep_inv[k];
|
||||
# if trapezoid[1] <= dep_inv[k] < trapezoid[2], lon = mid_lon_inv+(lon_inv[i]-mid_lon_inv)*(dep_inv[k]-trapezoid[1])/(trapezoid[2]-trapezoid[1])*trapezoid[0];
|
||||
# lat = mid_lat_inv+(lat_inv[i]-mid_lat_inv)*(dep_inv[k]-trapezoid[1])/(trapezoid[2]-trapezoid[1])*trapezoid[0];
|
||||
# dep = dep_inv[k];
|
||||
# if trapezoid[2] <= dep_inv[k], lon = mid_lon_inv+(lon_inv[i]-mid_lon_inv)*trapezoid[0];
|
||||
# lat = mid_lat_inv+(lat_inv[i]-mid_lat_inv)*trapezoid[0];
|
||||
# dep = dep_inv[k];
|
||||
# The shape of trapezoid inversion gird (x) looks like:
|
||||
#
|
||||
# lon_inv[0] [1] [2] [3] [4]
|
||||
# |<-------- (lon_inv[end] - lon_inv[0]) ---->|
|
||||
# dep_inv[0] | x x x x x |
|
||||
# | |
|
||||
# dep_inv[1] | x x x x x |
|
||||
# | |
|
||||
# dep_inv[2] = trapezoid[1] / x x x x x \
|
||||
# / \
|
||||
# dep_inv[3] / x x x x x \
|
||||
# / \
|
||||
# dep_inv[4] = trapezoid[2] / x x x x x \
|
||||
# | |
|
||||
# dep_inv[5] | x x x x x |
|
||||
# | |
|
||||
# dep_inv[6] | x x x x x |
|
||||
# |<---- trapezoid[0]* (lon_inv[end] - lon_inv[0]) ------>|
|
||||
|
||||
# -------------- using absolute traveltime data --------------
|
||||
abs_time:
|
||||
use_abs_time: false # 'true' for using absolute traveltime data to update model parameters; 'false' for not using (no need to set parameters in this section)
|
||||
|
||||
# -------------- using common source differential traveltime data --------------
|
||||
cs_dif_time:
|
||||
use_cs_time: true # 'true' for using common source differential traveltime data to update model parameters; 'false' for not using (no need to set parameters in this section)
|
||||
|
||||
# -------------- using common receiver differential traveltime data --------------
|
||||
cr_dif_time:
|
||||
use_cr_time: false # 'true' for using common receiver differential traveltime data to update model parameters; 'false' for not using (no need to set parameters in this section)
|
||||
|
||||
# -------------- inversion parameters --------------
|
||||
update_slowness : true # update slowness (velocity) or not. default: true
|
||||
update_azi_ani : false # update azimuthal anisotropy (xi, eta) or not. default: false
|
||||
|
||||
use_sta_correction: true
|
||||
# initial_sta_correction_file: 4_initial_station_correct/station_correction_file_step_0010.dat # the path of initial station correction
|
||||
step_length_sta_correction: 0.01 # step length relate to the update of station correction terms
|
||||
29
examples/realcase2_teleseismic_tomography_Thailand/README.md
Normal file
29
examples/realcase2_teleseismic_tomography_Thailand/README.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Real case of teleseismic tomography in Thailand and adjacent areas
|
||||
|
||||
This is a real case to invert common-source differential arrival times for velocity heterogeneity in Thailand and adjacent areas
|
||||
|
||||
Reference:
|
||||
|
||||
[1] J. Chen, S. Wu, M. Xu, M. Nagaso, J. Yao, K. Wang, T. Li, Y. Bai, and P. Tong, Adjoint-state teleseismic traveltime tomography: method and application to Thailand in Indochina Peninsula. J.Geophys. Res. Solid Earth, 128(2023), e2023JB027348.
|
||||
https://doi.org/10.1029/2023JB027348
|
||||
|
||||
[2] J. Chen, M. Nagaso, M. Xu, and P. Tong, TomoATT: An open-source package for Eikonal equation-based adjoint-state traveltime tomography for seismic velocity and azimuthal anisotropy, submitted.
|
||||
https://doi.org/10.48550/arXiv.2412.00031
|
||||
|
||||
Python modules are required to initiate the inversion and to plot final results:
|
||||
- h5py
|
||||
- PyTomoAT
|
||||
- Pygmt
|
||||
- gmt
|
||||
|
||||
Run this example:
|
||||
|
||||
1. Run bash script `bash run_this_example.sh` to execute the test.
|
||||
|
||||
2. After inversion, run `plot_output.py` to plot the results.
|
||||
|
||||
The imaging results:
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -0,0 +1,260 @@
|
||||
# %%
|
||||
import pygmt
|
||||
pygmt.config(FONT="16p", IO_SEGMENT_MARKER="<<<")
|
||||
|
||||
import os
|
||||
|
||||
# %%
|
||||
from pytomoatt.model import ATTModel
|
||||
from pytomoatt.data import ATTData
|
||||
import numpy as np
|
||||
|
||||
# %%
|
||||
# read model files
|
||||
|
||||
Ngrid = [121,121,121]
|
||||
data_file = '2_models/model_init_N%d_%d_%d.h5'%(Ngrid[0],Ngrid[1],Ngrid[2])
|
||||
par_file = '3_input_params/input_params_real.yaml'
|
||||
model = ATTModel.read(data_file, par_file)
|
||||
init_model = model.to_xarray()
|
||||
|
||||
data_file = 'OUTPUT_FILES/OUTPUT_FILES_real/final_model.h5'
|
||||
model = ATTModel.read(data_file, par_file)
|
||||
inv_model = model.to_xarray()
|
||||
|
||||
# %%
|
||||
# # read earthquakes and stations
|
||||
|
||||
# from pytomoatt.src_rec import SrcRec
|
||||
|
||||
# # read src_rec_file
|
||||
# sr = SrcRec.read("1_src_rec_files/src_rec_file.dat")
|
||||
|
||||
# # get the coordinates of the stations and earthquakes
|
||||
# stations = sr.receivers[['stlo','stla','stel']].values.T
|
||||
# earthquakes = sr.sources[['evlo','evla','evdp']].values.T
|
||||
|
||||
# print(stations.shape)
|
||||
# print(earthquakes.shape)
|
||||
|
||||
# %%
|
||||
# read earthquakes and stations
|
||||
|
||||
import sys
|
||||
sys.path.append('../utils')
|
||||
import functions_for_data as ffd
|
||||
|
||||
ev, st = ffd.read_src_rec_file('1_src_rec_files/src_rec_file.dat')
|
||||
# earthquake location
|
||||
ev_lon, ev_lat, ev_dep , _ = ffd.data_lon_lat_dep_wt_ev(ev)
|
||||
# station location
|
||||
st_lon, st_lat, _, _ = ffd.data_lon_lat_ele_wt_st(ev,st)
|
||||
|
||||
# %%
|
||||
# load topography
|
||||
region = [97,106,12,21]
|
||||
grid_topo = pygmt.datasets.load_earth_relief(resolution="01m", region=region)
|
||||
grid_gra = pygmt.grdgradient(grid = grid_topo, azimuth = 0)
|
||||
|
||||
# %%
|
||||
def line_read(file):
|
||||
doc=open(file,'r')
|
||||
file = doc.readlines()
|
||||
doc.close()
|
||||
lat = []; lon = [];
|
||||
for info in file:
|
||||
tmp = info.split()
|
||||
lon.append(float(tmp[0]))
|
||||
lat.append(float(tmp[1]))
|
||||
return((lat,lon))
|
||||
|
||||
# %%
|
||||
# plot imgaing results
|
||||
|
||||
fig = pygmt.Figure()
|
||||
try:
|
||||
os.mkdir("img")
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
# ------------------ Sub fig 1. topography ------------------
|
||||
region = [97,106,12,21]
|
||||
projection = "B101.5/16.5/12/21/10c"
|
||||
frame = ["xa2+lLongitude", "ya2+lLatitude", "nSWe"]
|
||||
spacing = [0.1, 0.1]
|
||||
|
||||
# topography
|
||||
pygmt.makecpt(cmap="globe", series=[-4000,4000], background = True)
|
||||
fig.grdimage(grid=grid_topo, shading = grid_gra, projection=projection, frame=frame,region=region)
|
||||
|
||||
# station
|
||||
fig.plot(x = st_lon, y = st_lat, style = "t0.4c", fill = "blue", pen = "1p,white", label = "Station")
|
||||
|
||||
|
||||
# tectonic setting
|
||||
(lat,lon) = line_read('tectonics/Khorat_new.txt') # Khorat Plateau
|
||||
fig.plot(x = lon, y = lat, pen = "1p,black")
|
||||
fig.text(text = "Khorat", x = 103.5, y = 17.5, font = "15p,Helvetica-Bold,black", angle = 0)
|
||||
fig.text(text = "Plateau", x = 103.5, y = 16.5, font = "15p,Helvetica-Bold,black", angle = 0)
|
||||
(lat,lon) = line_read('tectonics/WangChaoFault.txt') # Wang-Chao Fault
|
||||
fig.plot(x = lon, y = lat, pen = "1p,black,-")
|
||||
fig.text(text = "WCF", x = 100, y = 16, font = "20p,Helvetica-Bold,white=1p", angle = 315)
|
||||
(lat,lon) = line_read('tectonics/3PagodasFault.txt') # Three Pagodas Fault
|
||||
fig.plot(x = lon, y = lat, pen = "1p,black,-")
|
||||
fig.text(text = "TPF", x = 98.5, y = 14.5, font = "20p,Helvetica-Bold,white=1p", angle = 315)
|
||||
(lat,lon) = line_read('tectonics/DBPF.txt') # Dien Bien Phu Fault
|
||||
fig.plot(x = lon, y = lat, pen = "1p,black,-")
|
||||
fig.text(text = "DBPF", x = 102, y = 19.5, font = "20p,Helvetica-Bold,white=1p", angle = 55)
|
||||
(lat,lon) = line_read('tectonics/SongMaSuture.txt') # Song Ma Suture
|
||||
fig.plot(x = lon, y = lat, pen = "1p,black,-")
|
||||
fig.text(text = "Shan-Thai", x = 99, y = 20, font = "18p,Helvetica-Bold,black=0.5p,white", angle = 0)
|
||||
fig.text(text = "Block", x = 99, y = 19.3, font = "18p,Helvetica-Bold,black=0.5p,white", angle = 0)
|
||||
fig.text(text = "Indochina Block", x = 103.5, y = 15, font = "18p,Helvetica-Bold,black=0.5p,white", angle = 315)
|
||||
|
||||
|
||||
fig.shift_origin(xshift= 1, yshift=-1.5)
|
||||
fig.colorbar(frame = ["a%f"%(4000),"y+lElevation (m)"], position="+w4c/0.3c+h")
|
||||
fig.shift_origin(xshift=-1, yshift=+1.5)
|
||||
|
||||
fig.shift_origin(xshift=0, yshift=-13)
|
||||
|
||||
|
||||
# ------------------ Sub fig 2. earthquakes ------------------
|
||||
|
||||
region = "g"
|
||||
projection = "E101/16/90/10c" # centerlon/centerlat/distnace_range/fig_size
|
||||
frame = ["ya180"]
|
||||
spacing = [0.1, 5]
|
||||
|
||||
fig.basemap(region=region, projection=projection, frame=frame)
|
||||
fig.coast(region=region, projection=projection, frame=frame, water="white", land="gray", A=10000)
|
||||
|
||||
fig.plot(x=101.5, y=16.5, pen="1p,black,-", style="E-60d")
|
||||
fig.plot(x=101.5, y=16.5, pen="1p,black,-", style="E-120d")
|
||||
fig.plot(x=101.5, y=16.5, pen="1p,black,-", style="E-180d")
|
||||
fig.text(x = [101.5, 101.5, 101.5], y = [-8.0, -38.0, -68], text = ['30', '60', '90'], font="13p")
|
||||
|
||||
fig.plot(x=[97,97,106,106,97], y=[11,21,21,11,11], pen="1p,red")
|
||||
pygmt.makecpt(cmap="jet", series=[0, 100], background=True)
|
||||
fig.plot(x = ev_lon, y = ev_lat, size = [0.4]*len(ev_lon), fill = ev_dep, style = "a", cmap = True, pen = "0.5p,white")
|
||||
|
||||
|
||||
fig.shift_origin(xshift= 1, yshift=-1)
|
||||
fig.colorbar(frame = ["a%f"%(50),"y+lFocal depth (km)"], position="+w4c/0.3c+h")
|
||||
fig.shift_origin(xshift=-1, yshift=+1)
|
||||
|
||||
fig.shift_origin(xshift= 13, yshift= 13)
|
||||
|
||||
|
||||
# ------------------ Sub fig 3. depth and vertical profile ------------------
|
||||
|
||||
region = [97,106,12,21]
|
||||
projection = "B101.5/16.5/12/21/10c"
|
||||
frame = ["xa2+lLongitude", "ya2+lLatitude", "nSWe"]
|
||||
spacing = [0.1, 0.1]
|
||||
|
||||
depth_list = [100,200,300,400]
|
||||
start_list = [ [97, 19], [97, 17.2], [101.8, 12] ]
|
||||
end_list = [ [106, 15], [106, 13.2], [101.8, 21] ]
|
||||
|
||||
# depth profiles
|
||||
for idepth, depth in enumerate(depth_list):
|
||||
|
||||
# read models
|
||||
vel_init = init_model.interp_dep(depth, field='vel')
|
||||
vel_inv = inv_model.interp_dep(depth, field='vel')
|
||||
|
||||
if idepth == 3:
|
||||
fig.shift_origin(xshift=-39, yshift=-13)
|
||||
|
||||
pygmt.makecpt(cmap="../utils/svel13_chen.cpt", series=[-2, 2], background=True)
|
||||
x = vel_inv[:,0]; y = vel_inv[:,1]; value = (vel_inv[:,2] - vel_init[:,2])/vel_init[:,2]*100
|
||||
grid = pygmt.surface(x=x, y=y, z=value, spacing=spacing,region=region)
|
||||
fig.grdimage(frame=frame,grid = grid,projection=projection, region=region) # nan_transparent may work
|
||||
|
||||
(lat,lon) = line_read('tectonics/Khorat_new.txt') # Khorat Plateau
|
||||
fig.plot(x = lon, y = lat, pen = "1p,black")
|
||||
|
||||
# vertical profile location
|
||||
fig.plot(x = [start_list[0][0],end_list[0][0]], y = [start_list[0][1],end_list[0][1],], pen = "2p,green,-")
|
||||
fig.text(text = "A", x = start_list[0][0] + 0.5, y = start_list[0][1], font = "18p,Helvetica-Bold,black", fill = "lightblue", angle = 0)
|
||||
fig.text(text = "A@+'@+", x = end_list[0][0] - 0.5, y = end_list[0][1] + 0.5, font = "18p,Helvetica-Bold,black", fill = "lightblue", angle = 0)
|
||||
|
||||
fig.plot(x = [start_list[1][0],end_list[1][0]], y = [start_list[1][1],end_list[1][1],], pen = "2p,green,-")
|
||||
fig.text(text = "B", x = start_list[1][0] + 0.5, y = start_list[1][1], font = "18p,Helvetica-Bold,black", fill = "lightblue", angle = 0)
|
||||
fig.text(text = "B@+'@+", x = end_list[1][0] - 0.5, y = end_list[1][1] + 0.5, font = "18p,Helvetica-Bold,black", fill = "lightblue", angle = 0)
|
||||
|
||||
fig.plot(x = [start_list[2][0],end_list[2][0]], y = [start_list[2][1],end_list[2][1],], pen = "2p,green,-")
|
||||
fig.text(text = "C", x = start_list[2][0] - 0.5, y = start_list[2][1] + 0.5, font = "18p,Helvetica-Bold,black", fill = "lightblue", angle = 0)
|
||||
fig.text(text = "C@+'@+", x = end_list[2][0] - 0.5, y = end_list[2][1] - 0.5, font = "18p,Helvetica-Bold,black", fill = "lightblue", angle = 0)
|
||||
|
||||
# depth label
|
||||
fig.text(text="%d km"%(depth), x = 98 , y = 12.5, font = "14p,Helvetica-Bold,black", fill = "white")
|
||||
|
||||
|
||||
fig.shift_origin(xshift=13)
|
||||
|
||||
fig.shift_origin(yshift=6)
|
||||
|
||||
# vertical profiles
|
||||
for iprof in range(len(start_list)):
|
||||
|
||||
# generate topography data
|
||||
Npoints = 100
|
||||
point_x = np.linspace(start_list[iprof][0],end_list[iprof][0],Npoints)
|
||||
point_y = np.linspace(start_list[iprof][1],end_list[iprof][1],Npoints)
|
||||
points = np.hstack((point_x.reshape(-1,1),point_y.reshape(-1,1)))
|
||||
topo = np.array(pygmt.grdtrack(points=points, grid=grid_topo)[2])
|
||||
topo_dis = [0]
|
||||
for ip in range(1, Npoints):
|
||||
dis = ffd.cal_dis(point_y[0], point_x[0], point_y[ip], point_x[ip])
|
||||
topo_dis.append(dis)
|
||||
topo_dis = np.array(topo_dis)
|
||||
|
||||
# read models
|
||||
vel_init_sec = init_model.interp_sec(start_list[iprof], end_list[iprof], field='vel', val=10)
|
||||
vel_inv_sec = inv_model.interp_sec(start_list[iprof], end_list[iprof], field='vel', val=10)
|
||||
|
||||
|
||||
# plot topography
|
||||
max_dis = np.max(vel_init_sec[:,2])
|
||||
|
||||
region = [0,max_dis,0,2000]
|
||||
projection = "X%f/1c"%(max_dis/400*4)
|
||||
frame = ["ya2000+lElevation (m)", "sW"]
|
||||
|
||||
fig.shift_origin(yshift=4)
|
||||
fig.basemap(region=region, projection=projection, frame=frame)
|
||||
fig.plot(x = topo_dis, y = topo, pen = "1p,black", frame = frame, projection = projection, region = region)
|
||||
fig.shift_origin(yshift=-4)
|
||||
|
||||
# plot model
|
||||
region = [0,max_dis,0,400]
|
||||
projection = "X%f/-4c"%(max_dis/400*4)
|
||||
frame = ["xa300+lDistance (km)", "ya100+lDepth (km)", "nSWe"]
|
||||
spacing = [10, 5]
|
||||
|
||||
x_sec = vel_inv_sec[:,2]; y_sec = vel_inv_sec[:,3]; value_sec = (vel_inv_sec[:,4] - vel_init_sec[:,4])/vel_init_sec[:,4]*100
|
||||
grid = pygmt.surface(x=x_sec, y=y_sec, z=value_sec, spacing=spacing,region=region)
|
||||
fig.grdimage(frame=frame,grid = grid,projection=projection, region=region) # nan_transparent may work
|
||||
|
||||
label_list = ['A', 'B', 'C']
|
||||
fig.text(text = "%s"%(label_list[iprof]), x = 50, y = 50 , font = "18p,Helvetica-Bold,black", fill = "lightblue", angle = 0)
|
||||
fig.text(text = "%s@+'@+"%(label_list[iprof]), x = np.max(x) - 50, y = 50, font = "18p,Helvetica-Bold,black", fill = "lightblue", angle = 0)
|
||||
|
||||
|
||||
if (iprof == 0):
|
||||
fig.shift_origin(xshift=0, yshift=-6.5)
|
||||
elif (iprof == 1):
|
||||
fig.shift_origin(xshift=13, yshift=6.5)
|
||||
|
||||
fig.shift_origin(xshift= 2, yshift=-2.5)
|
||||
fig.colorbar(frame = ["a%f"%(2),"y+ldlnVp (%)"], position="+w4c/0.3c+h")
|
||||
fig.shift_origin(xshift=-2, yshift=+2.5)
|
||||
|
||||
fig.show()
|
||||
|
||||
fig.savefig("img/imaging_result.png")
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
# %%
|
||||
# download src_ref_files from Zenodo
|
||||
import os
|
||||
import requests
|
||||
|
||||
url = 'https://zenodo.org/records/14092478/files/src_rec_file.dat?download=1'
|
||||
|
||||
path = "1_src_rec_files/src_rec_file.dat"
|
||||
|
||||
# check file existence
|
||||
if not os.path.exists(path):
|
||||
try:
|
||||
os.mkdir("1_src_rec_files")
|
||||
except:
|
||||
pass
|
||||
print("Downloading src_rec_file.dat from Zenodo...")
|
||||
response = requests.get(url, stream=True)
|
||||
with open(path, 'wb') as out_file:
|
||||
out_file.write(response.content)
|
||||
print("Download complete.")
|
||||
else:
|
||||
print("src_rec_file.dat already exists.")
|
||||
|
||||
# %%
|
||||
# download initial model from Zenodo
|
||||
|
||||
url = 'https://zenodo.org/records/14092478/files/model_init_N121_121_121.h5?download=1'
|
||||
|
||||
path = "2_models/model_init_N121_121_121.h5"
|
||||
|
||||
# check file existence
|
||||
if not os.path.exists(path):
|
||||
try:
|
||||
os.mkdir("2_models")
|
||||
except:
|
||||
pass
|
||||
print("Downloading model_init_N121_121_121.h5 from Zenodo...")
|
||||
response = requests.get(url, stream=True)
|
||||
with open(path, 'wb') as out_file:
|
||||
out_file.write(response.content)
|
||||
print("Download complete.")
|
||||
else:
|
||||
print("model_init_N121_121_121.h5 already exists.")
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Step 1: Generate necessary input files
|
||||
python prepare_input_files.py
|
||||
|
||||
# Step 2: Run inversion
|
||||
# # for WSL
|
||||
# mpirun -n 8 --allow-run-as-root --oversubscribe ../../build/bin/TOMOATT -i 3_input_params/input_params_real.yaml
|
||||
# for Linux
|
||||
# mpirun -n 8 ../../build/bin/TOMOATT -i 3_input_params/input_params_real.yaml
|
||||
# for conda install
|
||||
mpirun -n 8 TOMOATT -i 3_input_params/input_params_real.yaml
|
||||
|
||||
# # Step 3 (Optional): Plot the results
|
||||
# python plot_output.py
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
97.716435 15.996933
|
||||
97.909999 15.704275
|
||||
98.075912 15.388543
|
||||
98.283303 15.065462
|
||||
98.504520 14.792299
|
||||
98.753389 14.414982
|
||||
99.306431 13.919170
|
||||
99.569126 13.657715
|
||||
99.831821 13.344572
|
||||
@@ -0,0 +1,12 @@
|
||||
100.26019 17.132888
|
||||
100.51411 17.490642
|
||||
100.79624 17.903402
|
||||
101.10658 18.261329
|
||||
101.47335 18.591967
|
||||
101.75549 19.004727
|
||||
102.00940 19.362481
|
||||
102.29154 19.802702
|
||||
102.51724 20.242749
|
||||
102.74295 20.627877
|
||||
102.91223 21.122673
|
||||
103.02508 21.919356
|
||||
@@ -0,0 +1,74 @@
|
||||
101.3217 15.25436
|
||||
101.3610 15.02633
|
||||
101.4085 14.66495
|
||||
101.6319 14.56644
|
||||
101.6012 14.38869
|
||||
101.4514 14.26901
|
||||
101.7127 14.13520
|
||||
101.9088 14.04399
|
||||
102.1729 14.00737
|
||||
102.4503 14.00100
|
||||
102.7636 14.00578
|
||||
103.0485 14.13474
|
||||
103.3082 14.27712
|
||||
103.5336 14.33471
|
||||
103.7845 14.37077
|
||||
103.9997 14.34649
|
||||
104.2485 14.32079
|
||||
104.4734 14.33280
|
||||
104.6885 14.37674
|
||||
104.9102 14.34013
|
||||
105.1688 14.31806
|
||||
105.3968 14.38630
|
||||
105.5182 14.48660
|
||||
105.5693 14.77796
|
||||
105.8248 14.91528
|
||||
106.1238 14.87758
|
||||
106.3348 14.64013
|
||||
106.4688 14.60983
|
||||
106.7040 14.63849
|
||||
106.9841 14.69472
|
||||
107.1072 14.88782
|
||||
106.9818 15.16007
|
||||
106.8467 15.43551
|
||||
106.7018 15.70776
|
||||
106.4761 15.91474
|
||||
106.7336 16.04609
|
||||
106.9007 16.14401
|
||||
106.9118 16.31668
|
||||
106.7038 16.57524
|
||||
106.4385 16.64211
|
||||
106.2010 16.67623
|
||||
106.0120 16.46044
|
||||
105.8274 16.65030
|
||||
105.8194 16.91355
|
||||
105.5656 17.01331
|
||||
105.2865 17.09928
|
||||
104.9742 17.44792
|
||||
104.8155 17.65625
|
||||
104.6904 17.84917
|
||||
104.4882 18.06029
|
||||
104.2648 18.23726
|
||||
104.2338 18.42014
|
||||
104.0404 18.69778
|
||||
103.8294 18.71916
|
||||
103.6035 18.82287
|
||||
103.4194 18.79012
|
||||
103.1891 18.75828
|
||||
102.9576 18.78853
|
||||
102.7519 18.78060
|
||||
102.4620 18.70688
|
||||
102.2884 18.31131
|
||||
102.3415 17.97336
|
||||
102.3233 17.61750
|
||||
102.3959 17.36994
|
||||
102.5198 17.16424
|
||||
102.4485 16.89594
|
||||
102.2198 17.03361
|
||||
102.0690 16.82544
|
||||
101.9004 16.52085
|
||||
101.7902 16.17219
|
||||
101.5551 16.16099
|
||||
101.3962 15.84821
|
||||
101.3255 15.53741
|
||||
101.3217 15.25436
|
||||
@@ -0,0 +1,7 @@
|
||||
103.42006 21.261522
|
||||
103.75862 21.015416
|
||||
104.12539 20.687015
|
||||
104.54859 20.386247
|
||||
104.94357 20.140313
|
||||
105.33856 19.811998
|
||||
105.67712 19.565892
|
||||
@@ -0,0 +1,35 @@
|
||||
97.160627 18.667449
|
||||
97.439913 18.296889
|
||||
97.702608 18.010759
|
||||
97.979130 17.718541
|
||||
98.283303 17.463175
|
||||
98.550606 17.271720
|
||||
98.765678 17.102918
|
||||
99.057562 16.870374
|
||||
99.306431 16.669104
|
||||
99.555300 16.377656
|
||||
99.831821 16.064504
|
||||
100.03921 15.742171
|
||||
100.21895 15.443462
|
||||
100.39869 15.086120
|
||||
100.56460 14.752446
|
||||
100.78582 14.447648
|
||||
100.96556 14.282677
|
||||
101.60156 13.889472
|
||||
101.90573 13.651846
|
||||
102.20990 13.442356
|
||||
102.51408 13.201059
|
||||
102.80719 12.957404
|
||||
103.10972 12.693070
|
||||
103.48190 12.438190
|
||||
103.78607 12.172426
|
||||
104.09025 11.987404
|
||||
104.36677 11.761654
|
||||
104.62946 11.466553
|
||||
104.91981 11.204539
|
||||
105.18250 10.882527
|
||||
105.43137 10.599681
|
||||
105.72172 10.344518
|
||||
106.01207 10.087398
|
||||
106.30241 9.8312565
|
||||
106.50981 9.6872272
|
||||
Reference in New Issue
Block a user