Skip to content

Main jc - #44

Closed
JingChen-Thu wants to merge 6 commits into
mainfrom
main_jc
Closed

JingChen-Thu wants to merge 6 commits into
mainfrom
main_jc

Conversation

@JingChen-Thu

Copy link
Copy Markdown
Contributor

新添加的区域旋转功能在 8月份的课程上需要用到,是否能先加到main版本里面。这样用户使用 conda install pytomoatt 之后,能正常运行例子。

JingChen-Thu and others added 6 commits July 22, 2026 11:54
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 optional region rotation support when gridding CRUST1.0 data into the model, so rotated computational domains can be mapped back to physical lat/lon before sampling CRUST1.0 (needed for the upcoming August course examples). It also makes checkerboard generation resilient to input models that don’t include a zeta field.

Changes:

  • Add a rotate parameter to ATTModel.grid_data_crust1(...) and pass it through to CRUST1.0 gridding.
  • Implement reverse-rotation of the (lat, lon) grid inside CrustModel.griddata(...) when rotate is provided.
  • Default Checker.zeta to zeros when missing from the input HDF5 model.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
pytomoatt/model.py Exposes a new rotate argument on the public model API for CRUST1.0 gridding.
pytomoatt/io/crustmodel.py Implements the reverse-rotation mapping and new rotate handling inside CRUST1.0 interpolation.
pytomoatt/checkerboard.py Prevents crashes when input models lack zeta by filling with zeros.
Comments suppressed due to low confidence (1)

pytomoatt/io/crustmodel.py:51

  • griddata(...) now accepts rotate, but the docstring does not describe the parameter (or its expected shape/units). This makes it hard for callers to discover and correctly use the new feature.
        :param min_max_dep: min and max depth, ``[min_dep, max_dep]``
        :type min_max_dep: list
        :param min_max_lat: Min and max latitude, ``[min_lat, max_lat]``
        :type min_max_lat: list
        :param min_max_lon: Min and max longitude, ``[min_lon, max_lon]``

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pytomoatt/model.py
Comment on lines 108 to 111
:param type: Specify velocity type of ``vp`` or ``vs``, defaults to 'vp'
:type type: str, optional
:param rotate: Rotation parameters [central_lat, central_lon, rotation_angle] in degrees, defaults to None
"""
Comment on lines +91 to +95
# latitude index and ratio
new_lat = tt_2d[ilat, ilon]
idx_lat_left, ratio_lat = degree_to_idx_and_ratio(new_lat)
idx_lat_right = idx_lat_left + 1
if idx_lat_left == -1:
Comment on lines +75 to +79
if rotate is not None:
try:
central_lat, central_lon, rotation_angle = rotate
except (TypeError, ValueError):
self.log.Modellog.error("rotate must be a 3-item sequence: [central_lat, central_lon, rotation_angle]")
@xumi1993 xumi1993 closed this Jul 31, 2026
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.

3 participants