Skip to content
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

Let load_earth_relief() support 'region' argument for all resolutions #873

Merged
merged 4 commits into from Feb 12, 2021

Conversation

seisman
Copy link
Member

@seisman seisman commented Feb 12, 2021

Description of proposed changes

In #542, we extended the load_earth_relief() function to support all resolutions, and also allow region argument for high-resolution grids (>=05m). We had some discussions (#542 (comment)) and decided not to allow region for low-resolution grids (<=06m), due to a known issue of xr.DataArray slice operation (#524 (comment)).

However, I feel that it's a wrong decision to disallow region for low-resolution grids, because xr.DataArray slice operation (#524 (comment)) is not commonly used, especially for the GMT's earth relief data, and we have grdcut to do slice operation.

In this PR, we allow load_earth_relief() function to accept the region argument for all grid resolutions.

Fixes #870.

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If adding new functionality, add an example to docstrings or tutorials.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@seisman seisman changed the title WIP: Let load_earth_relief() support 'region' argument for all resolutions Let load_earth_relief() support 'region' argument for all resolutions Feb 12, 2021
@seisman seisman added the enhancement Improving an existing feature label Feb 12, 2021
@seisman seisman added this to the 0.3.0 milestone Feb 12, 2021
@seisman seisman requested a review from a team February 12, 2021 18:46
@seisman seisman marked this pull request as ready for review February 12, 2021 18:46
@seisman seisman mentioned this pull request Feb 12, 2021
5 tasks
Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

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

Implementation looks good, agree that we should allow the region argument for low-resolution grids too, even if it might cause issues when users apply operations (e.g. slicing) on top of those grids. Cheers too for updating the docs!

As an aside, I've made a note at #524 (comment) about how upstream xarray is trending on keep_attrs by default.

@seisman seisman merged commit 805f533 into master Feb 12, 2021
@seisman seisman deleted the earth-relief-region branch February 12, 2021 23:45
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
…GenericMappingTools#873)

* Let load_earth_relief() support 'region' argument for all resolutions

* Improve docstrings of load_earth_relief()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Low-resolution Earth relief grids should support the "region" argument
2 participants