Skip to content

fix a bug in interpolation of crust1.0 model#34

Merged
xumi1993 merged 20 commits intodevelfrom
devel_jc
Dec 2, 2025
Merged

fix a bug in interpolation of crust1.0 model#34
xumi1993 merged 20 commits intodevelfrom
devel_jc

Conversation

@JingChen-Thu
Copy link
Contributor

No description provided.

@JingChen-Thu
Copy link
Contributor Author

See this issue
#35

@xumi1993

@JingChen-Thu JingChen-Thu requested a review from xumi1993 December 1, 2025 08:38
@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

❌ Patch coverage is 75.80645% with 15 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pytomoatt/io/crustmodel.py 75.40% 15 Missing ⚠️

📢 Thoughts on this report? Let us know!

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 replaces the scipy-based 3D interpolation approach with a custom 2D+1D bilinear interpolation method for the CRUST1.0 model. The change appears to address accuracy issues in the original implementation by performing separate 1D vertical interpolations at grid corners followed by horizontal bilinear interpolation.

Key Changes:

  • Added two helper functions (degree_to_idx and degree_to_idx_and_ratio) to convert geographic coordinates to grid indices
  • Introduced a dictionary-based data structure (points_dict) that organizes model points by horizontal grid location for faster lookup
  • Replaced scipy's griddata with a manual bilinear interpolation algorithm that performs 1D vertical interpolation at four corners, then blends horizontally

💡 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.

xumi1993 and others added 4 commits December 1, 2025 20:58
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@xumi1993
Copy link
Member

xumi1993 commented Dec 2, 2025

I have removed old crust1.0.h5 file and added the crust1.0_points_dict.pkl to pytomoatt/data/ as dictionary. I also change the key name to (lon, lat) with tuple format. It will be easy to check bound of longitude and latitude.

…used for dependency installation in all jobs
@xumi1993 xumi1993 merged commit 75e73b4 into devel Dec 2, 2025
8 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.

4 participants