Main jc - #44
Closed
JingChen-Thu wants to merge 6 commits into
Closed
Main jc#44JingChen-Thu wants to merge 6 commits into
JingChen-Thu wants to merge 6 commits into
Conversation
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>
Contributor
There was a problem hiding this comment.
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
rotateparameter toATTModel.grid_data_crust1(...)and pass it through to CRUST1.0 gridding. - Implement reverse-rotation of the (lat, lon) grid inside
CrustModel.griddata(...)whenrotateis provided. - Default
Checker.zetato 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 acceptsrotate, 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 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]") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
新添加的区域旋转功能在 8月份的课程上需要用到,是否能先加到main版本里面。这样用户使用 conda install pytomoatt 之后,能正常运行例子。