Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new example demonstrating how to build an initial velocity model for teleseismic tomography by combining the CRUST1.0 crustal model with the ak135 mantle model. The example includes a Python script that loads these community models, interpolates them onto a computational grid, and smoothly blends them at intermediate depths.
Key Changes
- Python script to generate combined CRUST1.0 + ak135 velocity models with configurable depth transitions
- YAML configuration file defining the computational domain and inversion parameters for a real-world teleseismic tomography case
- Shell script to execute the model generation workflow with proper references to source publications
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
examples/scripts_of_generate_community_model/1_crust1.0_ak135_model.py |
Core Python script that loads CRUST1.0 and ak135 models, performs depth-dependent linear interpolation between them, and applies optional smoothing and monotonicity constraints |
examples/scripts_of_generate_community_model/3_input_params/input_params_real.yaml |
Configuration file defining the computational domain (Thailand region, -50 to 550 km depth), inversion grid parameters, and model update settings |
examples/scripts_of_generate_community_model/run_this_example.sh |
Bash script that executes the model generation with citations to the CRUST1.0 and ak135 publications |
.gitignore |
Updated to exclude generated Jupyter notebooks and figure directories for the new example |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
examples/scripts_of_generate_community_model/1_crust1.0_ak135_model.py
Outdated
Show resolved
Hide resolved
| # %% | ||
| # Step 2. Generate the ATT model based on ak135 model. | ||
|
|
||
| # Load the 1D ak135 model from the .h5 file. |
There was a problem hiding this comment.
Missing documentation: The script references 'ak135.h5' but there's no comment explaining where this file should be obtained or what format it should have (e.g., expected keys in the HDF5 file: 'model' containing a 2D array with columns [depth, velocity]). Consider adding a comment explaining how to obtain or prepare this file.
| # Load the 1D ak135 model from the .h5 file. | |
| # Load the 1D ak135 model from the .h5 file. | |
| # The file 'ak135.h5' should be an HDF5 file containing a dataset named 'model', | |
| # which is a 2D array with columns [depth, velocity] (depth in km, velocity in km/s). | |
| # You can obtain ak135 model data from published sources (e.g., https://www.seismology.ethz.ch/en/research-and-teaching/products-software/ak135-model/) | |
| # and convert it to HDF5 format using Python and h5py. Example: | |
| # import h5py, numpy as np | |
| # data = np.array([[depth1, vel1], [depth2, vel2], ...]) | |
| # with h5py.File('ak135.h5', 'w') as f: f.create_dataset('model', data=data) |
There was a problem hiding this comment.
@JingChen-Thu How do you think to add information about ak135.h5 like this?
There was a problem hiding this comment.
Sure, this will be more informative.
examples/scripts_of_generate_community_model/run_this_example.sh
Outdated
Show resolved
Hide resolved
examples/scripts_of_generate_community_model/3_input_params/input_params_real.yaml
Outdated
Show resolved
Hide resolved
examples/scripts_of_generate_community_model/3_input_params/input_params_real.yaml
Outdated
Show resolved
Hide resolved
| ################################################# | ||
| 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) |
There was a problem hiding this comment.
Typo in comment: "computional domain" should be "computational domain".
examples/scripts_of_generate_community_model/1_crust1.0_ak135_model.py
Outdated
Show resolved
Hide resolved
| # 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]; |
There was a problem hiding this comment.
Documentation bug: The formula uses "lat_inv[i]" but should use "lat_inv[j]" to be consistent with the comment on line 141 which correctly uses index "j" for latitude. The same issue appears on line 147 where "lat_inv[i]" should also be "lat_inv[j]".
| # 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]; | |
| # lat = mid_lat_inv+(lat_inv[j]-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[j]-mid_lat_inv)*trapezoid[0]; |
examples/scripts_of_generate_community_model/3_input_params/input_params_real.yaml
Outdated
Show resolved
Hide resolved
…model.py typo Co-authored-by: Copilot <[email protected]>
…model.py Co-authored-by: Copilot <[email protected]>
…put_params_real.yaml typo Co-authored-by: Copilot <[email protected]>
…put_params_real.yaml typo Co-authored-by: Copilot <[email protected]>
…put_params_real.yaml typo Co-authored-by: Copilot <[email protected]>
typo Co-authored-by: Copilot <[email protected]>
mnagaso
left a comment
There was a problem hiding this comment.
Thank you for adding this example!
Add an example to build initial model for teleseismic tomography based on the crust 1.0 model and ak135 model.