Thanks to visit codestin.com
Credit goes to github.com

Skip to content

add an example to build model based on crust1.0 and ak135 for telesei…#52

Merged
mnagaso merged 8 commits intodevelfrom
devel_jc
Nov 26, 2025
Merged

add an example to build model based on crust1.0 and ak135 for telesei…#52
mnagaso merged 8 commits intodevelfrom
devel_jc

Conversation

@JingChen-Thu
Copy link
Contributor

Add an example to build initial model for teleseismic tomography based on the crust 1.0 model and ak135 model.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

# %%
# Step 2. Generate the ATT model based on ak135 model.

# Load the 1D ak135 model from the .h5 file.
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# 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)

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JingChen-Thu How do you think to add information about ak135.h5 like this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, this will be more informative.

#################################################
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)
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in comment: "computional domain" should be "computational domain".

Copilot uses AI. Check for mistakes.
Comment on lines +144 to +147
# 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];
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]".

Suggested change
# 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];

Copilot uses AI. Check for mistakes.
@mnagaso mnagaso self-requested a review November 26, 2025 02:30
Copy link
Contributor

@mnagaso mnagaso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding this example!

@mnagaso mnagaso merged commit 4849c05 into devel Nov 26, 2025
10 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments