Skip to content

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

Merged
seisman merged 4 commits into
masterfrom
earth-relief-region
Feb 12, 2021
Merged

Let load_earth_relief() support 'region' argument for all resolutions#873
seisman merged 4 commits into
masterfrom
earth-relief-region

Conversation

@seisman

@seismanseisman commented Feb 12, 2021

Copy link
Copy Markdown
Member

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

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

@weiji14weiji14 left a comment

Copy link
Copy Markdown
Member

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 masterFeb 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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancementImproving 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

@seisman@weiji14