-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set gridline (if available) as the default grid registration for remote datasets #2266
Conversation
if registration is None: | ||
registration = dataset.resolutions[resolution].registrations[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed my mind and now I think your solution in #1929 (comment) is better, because it's more clear that "gridline" is the default registration.
In either case, I also think we should put gridline
before pixel
, because letter g
is in front of letter p
and gridline
and pixel
are internally represented as 0 and 1 in GMT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. I will be back on December 26 and can update the PR then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In either case, I also think we should put
gridline
beforepixel
, because letterg
is in front of letterp
andgridline
andpixel
are internally represented as 0 and 1 in GMT.
I feel these changes should be done in a separate PR so that this PR is smaller and easier to review.
Edit: Done in #2276.
Should I add tests using high-resolution grids to test that the functions default to the appropriate registrations when only one is available? |
Yes, please. The earth_relief_15s grid is good for testing. |
…atasets_earth_relief.py
Co-authored-by: Dongdong Tian <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer explicit documentation on what resolutions default to gridline
and which are pixel
only. Feel free to change the wording if needed.
``"gridline"`` for gridline registration. Default is ``"gridline"`` | ||
when available. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about rewording it explicitly to something like this?
``"gridline"`` for gridline registration. Default is ``"gridline"`` | |
when available. | |
``"gridline"`` for gridline registration. Default is ``"gridline"`` | |
for all resolutions except ``"01m"`` which is ``"pixel"`` only. |
assert data.sizes["lat"] == 121 | ||
assert data.sizes["lon"] == 121 | ||
|
||
|
||
def test_earth_age_05m_without_region(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also update test_earth_age_05m_without_region
to use the 01m
resolution, so that we consistently use 01d
and 01m
in the tests.
Please also make the similar changes in other tests.
@@ -146,3 +130,19 @@ def test_earth_mag4km_05m_with_region(): | |||
assert data.lon.max() == -112 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test_earth_mag4km_05m_with_region():
is still using the 05m
grid.
Co-authored-by: Wei Ji <[email protected]>
Co-authored-by: Wei Ji <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
@seisman and @weiji14 Please feel free to commit any minor changes you suggest to this PR and #2241. I'm going to be away from my computer for a good portion of today, and don't want to hold up @yvonnefroehlich over something minor. |
I've made the commit cedfa26 to make sure the 01d resolution always returns gridline-registered grids. |
This sets the default registration to
"gridline"
if both registration options are available.Fixes #1929
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.Slash Commands
You can write slash commands (
/command
) in the first line of a comment to performspecific operations. Supported slash commands are:
/format
: automatically format and lint the code/test-gmt-dev
: run full tests on the latest GMT development version