initial upload
This commit is contained in:
BIN
examples/realcase1_regional_tomography_California/.DS_Store
vendored
Normal file
BIN
examples/realcase1_regional_tomography_California/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -0,0 +1,186 @@
|
||||
version: 3
|
||||
|
||||
#################################################
|
||||
# computational domian #
|
||||
#################################################
|
||||
domain:
|
||||
min_max_dep: [-5, 45] # depth in km
|
||||
min_max_lat: [-2.0, 2.4] # latitude in degree
|
||||
min_max_lon: [-0.8, 0.8] # longitude in degree
|
||||
n_rtp: [51, 89, 33] # 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: true # swap source and receiver
|
||||
|
||||
#################################################
|
||||
# initial model file path #
|
||||
#################################################
|
||||
model:
|
||||
init_model_path: 2_models/model_init_N51_89_33.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_inv # 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: true
|
||||
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: true # 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: true # 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: true # 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
|
||||
|
||||
###################################################
|
||||
# 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 uniform inversion grid
|
||||
n_inv_dep_lat_lon: [3, 11, 11] # number of inversion grid in depth, latitude, and longitude direction
|
||||
min_max_dep_inv: [-5 , 5] # inversion grid for vel in depth (km)
|
||||
min_max_lat_inv: [0, 1] # inversion grid for vel in latitude (degree)
|
||||
min_max_lon_inv: [0, 1] # inversion grid for vel in longitude (degree)
|
||||
|
||||
# settings for flexible inversion grid
|
||||
dep_inv: [-5, -2, 0, 3, 7, 12, 17, 23, 30, 38, 47, 57] # inversion grid for vel in depth (km)
|
||||
lat_inv: [-2.5, -2.2, -1.9, -1.6, -1.3, -1.0, -0.7, -0.4, -0.1, 0.2, 0.5, 0.8, 1.1, 1.4, 1.7, 2.0, 2.3, 2.6] # inversion grid for vel in latitude (degree)
|
||||
lon_inv: [-1.2, -0.9, -0.6, -0.3, 0, 0.3, 0.6, 0.9, 1.2] # 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: true
|
||||
|
||||
# ---------- 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: true # '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: false # '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 : true # update azimuthal anisotropy (xi, eta) or not. default: false
|
||||
30
examples/realcase1_regional_tomography_California/README.md
Normal file
30
examples/realcase1_regional_tomography_California/README.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# Real case of regional tomography in central California near Parkfield
|
||||
|
||||
This is a real case to invert traveltimes for velocity heterogeneity and azimuthal anisotropy in central California near Parkfield
|
||||
|
||||
Reference:
|
||||
|
||||
[1] J. Chen, G. Chen, M. Nagaso, and P. Tong, Adjoint-state traveltime tomography for azimuthally anisotropic media in spherical coordinates. Geophys. J. Int., 234 (2023), pp. 712-736.
|
||||
https://doi.org/10.1093/gji/ggad093
|
||||
|
||||
[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:
|
||||
|
||||

|
||||
|
||||
|
||||
222
examples/realcase1_regional_tomography_California/plot_output.py
Normal file
222
examples/realcase1_regional_tomography_California/plot_output.py
Normal file
@@ -0,0 +1,222 @@
|
||||
# %%
|
||||
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 = [51,89,33]
|
||||
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)
|
||||
initial_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")
|
||||
|
||||
# rotate back to original coordinates
|
||||
central_lat = 35.6
|
||||
central_lon = -120.45
|
||||
rotation_angle = -30
|
||||
sr.rotate(central_lat, central_lon, rotation_angle, reverse=True)
|
||||
|
||||
# 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)
|
||||
|
||||
# %%
|
||||
# study region
|
||||
|
||||
import sys
|
||||
sys.path.append('../utils')
|
||||
import functions_for_data as ffd
|
||||
|
||||
lat1 = -1.8; lat2 = 2.2;
|
||||
lon1 = -0.7; lon2 = 0.7;
|
||||
|
||||
lat_lon_rotate = np.array([[lon1,lat1],[lon1,lat2],[lon2,lat2],[lon2,lat1],[lon1,lat1]])
|
||||
lat_lon = ffd.rtp_rotation_reverse(lat_lon_rotate[:,1],lat_lon_rotate[:,0],central_lat,central_lon,rotation_angle)
|
||||
studt_lat = lat_lon[0]
|
||||
studt_lon = lat_lon[1]
|
||||
|
||||
# %%
|
||||
# load topography
|
||||
region = [-122.8,-118.5,33.5,38]
|
||||
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 = [-122.8,-118.5,33.5,38]
|
||||
frame = ["xa1","ya1","nSWe"]
|
||||
projection = "M10c"
|
||||
|
||||
# topography
|
||||
pygmt.makecpt(cmap="globe", series=[-4000,4000], background = True)
|
||||
fig.grdimage(grid=grid_topo, shading = grid_gra, projection=projection, frame=frame,region=region)
|
||||
# study region
|
||||
fig.plot(x = studt_lon, y = studt_lat, pen = "1.5p,red")
|
||||
# earthquakes
|
||||
fig.plot(x = earthquakes[0,:], y = earthquakes[1,:], style = "c0.02c", fill = "red",label = "Earthquake")
|
||||
# stations
|
||||
fig.plot(x = stations[0,:], y = stations[1,:], style = "t0.2c", fill = "blue", pen = "white", label = "Station")
|
||||
|
||||
|
||||
fig.basemap(region=[0,1,0,1], frame=["wesn+gwhite"], projection="X4c/2c")
|
||||
fig.plot(x=0.1, y=0.3, style='c0.2c', fill='red')
|
||||
fig.text(text="Earthquake", x=0.2, y=0.3, font="16p,Helvetica", justify="LM")
|
||||
fig.plot(x=0.1, y=0.7, style='t0.4c', fill='blue', pen='black')
|
||||
fig.text(text="Station", x=0.2, y=0.7, font="16p,Helvetica", justify="LM")
|
||||
|
||||
|
||||
# ------------------ Sub fig 2. colorbar ------------------
|
||||
fig.shift_origin(xshift= 2, yshift= -2)
|
||||
|
||||
pygmt.makecpt(cmap="globe", series=[-4000,4000], background = True)
|
||||
fig.colorbar(frame = ["a%f"%(4000),"y+lElevation (m)"], position="+e+w4c/0.3c+h")
|
||||
fig.shift_origin(yshift=-2)
|
||||
|
||||
pygmt.makecpt(cmap="../utils/svel13_chen.cpt", series=[-8, 8], background=True, reverse=False)
|
||||
fig.colorbar(frame = ["a%f"%(4),"y+ldlnVp (%)"], position="+e+w4c/0.3c+h")
|
||||
fig.shift_origin(yshift=-2)
|
||||
|
||||
pygmt.makecpt(cmap="cool", series=[0, 0.08], background=True, reverse=False)
|
||||
fig.colorbar(frame = ["a%f"%(0.04),"y+lAnisotropy"], position="+ef+w4c/0.3c+h")
|
||||
|
||||
|
||||
|
||||
# ------------------ Sub fig 3. model ------------------
|
||||
fig.shift_origin(xshift = 10, yshift=8)
|
||||
|
||||
region_oblique = [-0.7,0.7,-2.2,1.8]
|
||||
projection = "OA%s/%s/%s/4c"%(central_lon,central_lat,rotation_angle-90.0)
|
||||
perspective = "30/90"
|
||||
spacing = "1m"
|
||||
|
||||
depth_list = [4,8,16]
|
||||
|
||||
for idepth, depth in enumerate(depth_list):
|
||||
|
||||
# initial model
|
||||
vel_init = initial_model.interp_dep(depth, field='vel')
|
||||
|
||||
# output model
|
||||
vel_inv = inv_model.interp_dep(depth, field='vel') # velocity
|
||||
epsilon_inv = inv_model.interp_dep(depth, field='epsilon') # magnitude of anisotropy
|
||||
|
||||
# fast velocity directions
|
||||
samp_interval = 3
|
||||
ani_thd = 0.015
|
||||
length = 20
|
||||
width = 0.1
|
||||
|
||||
ani_inv_phi = inv_model.interp_dep(depth, field='phi', samp_interval=samp_interval)
|
||||
ani_inv_epsilon = inv_model.interp_dep(depth, field='epsilon', samp_interval=samp_interval)
|
||||
ani_inv = np.hstack([ani_inv_phi, ani_inv_epsilon[:,2].reshape(-1, 1)*length, np.ones((ani_inv_epsilon.shape[0],1))*width]) # lon, lat, angle, length, width
|
||||
idx = np.where(ani_inv_epsilon[:,2] > ani_thd)
|
||||
ani = ani_inv[idx[0],:]
|
||||
|
||||
# --------- plot velocity ------------
|
||||
if idepth == 0:
|
||||
frame = ["xa100","ya1","nSwE"]
|
||||
elif idepth == len(depth_list)-1:
|
||||
frame = ["xa100","ya1","NsWe"]
|
||||
else:
|
||||
frame = ["xa100","ya1","nswe"]
|
||||
|
||||
fig.basemap(region=region_oblique, frame=frame, projection=projection, perspective=perspective)
|
||||
pygmt.makecpt(cmap="../utils/svel13_chen.cpt", series=[-8, 8], background=True, reverse=False)
|
||||
|
||||
x = vel_init[:,0]; y = vel_init[:,1]; value = (vel_inv[:,2] - vel_init[:,2])/vel_init[:,2] * 100
|
||||
y,x = ffd.rtp_rotation_reverse(y,x,central_lat,central_lon,rotation_angle)
|
||||
grid = pygmt.surface(x=x, y=y, z=value, spacing=spacing,region=region)
|
||||
fig.grdimage(frame=frame,grid = grid,projection=projection, region=region_oblique,perspective=perspective) # nan_transparent may work
|
||||
|
||||
# tectonic setting
|
||||
fig.coast(region=region_oblique, frame=frame, projection=projection, perspective=perspective, shorelines="1p,black") # coastlines
|
||||
(SAFy,SAFx) = line_read("tectonics/SAF")
|
||||
fig.plot(x = SAFx, y = SAFy, pen = '3.0p,black', perspective = perspective) # SAF
|
||||
if idepth == 0:
|
||||
fig.text(text = "SMB", x = -120.45 , y = 35.0, font = "16p,Helvetica-Bold,black", angle = 150, fill = "lightblue", perspective = perspective) # SMB
|
||||
fig.text(text = "FT", x = -120.6 , y = 36.50, font = "16p,Helvetica-Bold,black", angle = 150, fill = "lightblue", perspective = perspective) # Franciscan terrane
|
||||
fig.text(text = "ST", x = -121.1 , y = 36.0, font = "16p,Helvetica-Bold,black", angle = 150, fill = "lightblue", perspective = perspective) # Salinian terrane
|
||||
fig.text(text = "TR", x = -119.30 , y = 34.70, font = "16p,Helvetica-Bold,black", angle = 150, fill = "lightblue", perspective = perspective) # Coast Ranges
|
||||
|
||||
# depth label
|
||||
fig.text(text="%d km"%(depth), x = -119.8 , y = 34.0, font = "16p,Helvetica-Bold,black", angle = 180, fill = "white", perspective = perspective) # Coast Ranges
|
||||
|
||||
|
||||
# --------- plot anisotropy ------------
|
||||
fig.shift_origin(yshift=-12)
|
||||
|
||||
fig.basemap(region=region_oblique, frame=frame, projection=projection, perspective=perspective)
|
||||
pygmt.makecpt(cmap="cool", series=[0, 0.08], background=True)
|
||||
value = epsilon_inv[:,2]
|
||||
grid = pygmt.surface(x=x, y=y, z=value, spacing=spacing,region=region)
|
||||
fig.grdimage(frame=frame,grid = grid,projection=projection, region=region_oblique,perspective=perspective) # nan_transparent may work
|
||||
|
||||
# tectonic setting
|
||||
fig.coast(region=region_oblique, frame=frame, projection=projection, perspective=perspective, shorelines="1p,black") # coastlines
|
||||
(line_y,line_x) = line_read("tectonics/SAF_creeping")
|
||||
fig.plot(x = line_x, y = line_y, pen = '3.0p,black',perspective = perspective)
|
||||
(line_y,line_x) = line_read("tectonics/SAF_transition")
|
||||
fig.plot(x = line_x, y = line_y, pen = '3.0p,red',perspective = perspective)
|
||||
(line_y,line_x) = line_read("tectonics/SAF_locked")
|
||||
fig.plot(x = line_x, y = line_y, pen = '3.0p,blue',perspective = perspective)
|
||||
|
||||
# anisotropy
|
||||
if len(ani) > 0:
|
||||
# rotate back to original coordinates
|
||||
x = ani[:,0]; y = ani[:,1]
|
||||
y,x = ffd.rtp_rotation_reverse(y,x,central_lat,central_lon,rotation_angle)
|
||||
ani[:,0] = x; ani[:,1] = y; # no need to modify the angle, because the porjection angle and rotate angle are the same
|
||||
fig.plot(ani, style='j', fill='yellow1', pen='0.5p,black',perspective=perspective)
|
||||
|
||||
fig.shift_origin(xshift=6,yshift=12)
|
||||
|
||||
|
||||
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/14065341/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/14065341/files/model_init_N51_89_33.h5?download=1'
|
||||
|
||||
path = "2_models/model_init_N51_89_33.h5"
|
||||
|
||||
# check file existence
|
||||
if not os.path.exists(path):
|
||||
try:
|
||||
os.mkdir("2_models")
|
||||
except:
|
||||
pass
|
||||
print("Downloading model_init_N51_89_33.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_N51_89_33.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,68 @@
|
||||
-122.73566 37.96894
|
||||
-122.70941 37.93895
|
||||
-122.65033 37.88999
|
||||
-122.62177 37.83209
|
||||
-122.59009 37.79618
|
||||
-122.56673 37.74661
|
||||
-122.51982 37.71281
|
||||
-122.47924 37.65959
|
||||
-122.40956 37.58436
|
||||
-122.38051 37.54962
|
||||
-122.32748 37.48461
|
||||
-122.23632 37.38344
|
||||
-122.18852 37.34638
|
||||
-122.15621 37.31470
|
||||
-122.11902 37.26828
|
||||
-122.01512 37.19501
|
||||
-121.92424 37.12444
|
||||
-121.88689 37.10485
|
||||
-121.86086 37.08276
|
||||
-121.78342 37.04335
|
||||
-121.70450 36.97942
|
||||
-121.65426 36.93801
|
||||
-121.57487 36.88348
|
||||
-121.47861 36.81956
|
||||
-121.43712 36.78821
|
||||
-121.40534 36.76781
|
||||
-121.36812 36.75009
|
||||
-121.33557 36.71495
|
||||
-121.27255 36.67184
|
||||
-121.16342 36.57248
|
||||
-121.09358 36.51578
|
||||
-121.02139 36.44378
|
||||
-120.93316 36.35578
|
||||
-120.79679 36.21978
|
||||
-120.63636 36.07582
|
||||
-120.52406 35.97185
|
||||
-120.43583 35.90791
|
||||
-120.33957 35.81993
|
||||
-120.29568 35.74979
|
||||
-120.26271 35.71512
|
||||
-120.23380 35.67390
|
||||
-120.19772 35.63300
|
||||
-120.12299 35.56383
|
||||
-120.02674 35.48387
|
||||
-119.98846 35.44344
|
||||
-119.88017 35.32590
|
||||
-119.78610 35.24387
|
||||
-119.67380 35.14792
|
||||
-119.53743 35.04400
|
||||
-119.40726 34.94926
|
||||
-119.34920 34.92597
|
||||
-119.31423 34.90995
|
||||
-119.24588 34.88266
|
||||
-119.20791 34.87552
|
||||
-119.16832 34.87107
|
||||
-119.12954 34.86300
|
||||
-119.09076 34.86210
|
||||
-118.97416 34.84129
|
||||
-118.93565 34.84176
|
||||
-118.85999 34.82469
|
||||
-118.78894 34.79661
|
||||
-118.72217 34.76987
|
||||
-118.68535 34.75631
|
||||
-118.56902 34.72084
|
||||
-118.49005 34.70185
|
||||
-118.39037 34.66204
|
||||
-118.22995 34.61434
|
||||
-118.06150 34.54260
|
||||
@@ -0,0 +1,10 @@
|
||||
-121.36812 36.75009
|
||||
-121.33557 36.71495
|
||||
-121.27255 36.67184
|
||||
-121.16342 36.57248
|
||||
-121.09358 36.51578
|
||||
-121.02139 36.44378
|
||||
-120.93316 36.35578
|
||||
-120.79679 36.21978
|
||||
-120.63636 36.07582
|
||||
-120.52406 35.97185
|
||||
@@ -0,0 +1,10 @@
|
||||
-120.26271 35.71512
|
||||
-120.23380 35.67390
|
||||
-120.19772 35.63300
|
||||
-120.12299 35.56383
|
||||
-120.02674 35.48387
|
||||
-119.98846 35.44344
|
||||
-119.88017 35.32590
|
||||
-119.78610 35.24387
|
||||
-119.67380 35.14792
|
||||
-119.53743 35.04400
|
||||
@@ -0,0 +1,5 @@
|
||||
-120.52406 35.97185
|
||||
-120.43583 35.90791
|
||||
-120.33957 35.81993
|
||||
-120.29568 35.74979
|
||||
-120.26271 35.71512
|
||||
Reference in New Issue
Block a user