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

Add gallery example for grdclip #1396

Merged
merged 13 commits into from
Aug 4, 2021
Merged

Add gallery example for grdclip #1396

merged 13 commits into from
Aug 4, 2021

Conversation

michaelgrund
Copy link
Member

Description of proposed changes

Since noone worked on this issue during the scipy-sprint here's a gallery example adressing #1384.

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

Since noone worked on this issue during the scipy-sprint here's a gallery example adressing #1384.
@michaelgrund michaelgrund added the documentation Improvements or additions to documentation label Jul 26, 2021
@michaelgrund
Copy link
Member Author

/format

@michaelgrund michaelgrund marked this pull request as draft July 26, 2021 20:38
@michaelgrund michaelgrund marked this pull request as ready for review July 27, 2021 16:19
@michaelgrund michaelgrund added this to the 0.5.0 milestone Jul 27, 2021
@michaelgrund michaelgrund changed the title WIP: Add gallery example for grdclip Add gallery example for grdclip Jul 28, 2021
examples/gallery/images/grdclip.py Outdated Show resolved Hide resolved
Comment on lines 14 to 15
# Load sample grid (1 arc minute global relief) and use area around the Hawaiian Islands
grid = pygmt.datasets.load_earth_relief(resolution="01m", region=[-162, -153, 18, 23])
Copy link
Member

Choose a reason for hiding this comment

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

The 1 arc minute global relief data is NOT cached in the CI. We should either cache the 01m data or use a lower resolution earth relief.

Copy link
Member Author

@michaelgrund michaelgrund Jul 29, 2021

Choose a reason for hiding this comment

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

I would prefer to use a high resolution as the 1 arc minute global relief, otherwise the map looks bad. Will add the 01m data to cache in a separate PR (#1398).

Copy link
Member

Choose a reason for hiding this comment

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

Or can we use a different location? I like the Hawaii example, but caching the 1 arc minute data (258MB) isn't very feasible... How about another island like Iceland (or another medium-ish sized one).

Copy link
Member

Choose a reason for hiding this comment

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

Or can we use a different location? I like the Hawaii example, but caching the 1 arc minute data (258MB) isn't very feasible... How about another island like Iceland (or another medium-ish sized one).

Sounds a better solution.

Copy link
Member Author

@michaelgrund michaelgrund Jul 31, 2021

Choose a reason for hiding this comment

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

I changed it to the 3 arc minute grid (27 MB) for the area around Iceland. Is that fine or still to large for caching?

Copy link
Member

Choose a reason for hiding this comment

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

The current cache size is 30.5MB (https://github.com/GenericMappingTools/pygmt/actions/runs/1064597430), so adding 27MB would make it 50.5MB. I'm still a bit hesitant to add it... How about adding just the tile that is downloaded. Running gmt grdcut @earth_relief_03m -R-28/-10/62/68 -Gtemp.nc gives me the tile name "N00W090.earth_relief_03m_p" in .gmt/server/earth/earth_relief/earth_relief_03m_p so maybe try just caching that?

Copy link
Member Author

@michaelgrund michaelgrund Aug 2, 2021

Choose a reason for hiding this comment

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

The current cache size is 30.5MB (https://github.com/GenericMappingTools/pygmt/actions/runs/1064597430), so adding 27MB would make it 50.5MB. I'm still a bit hesitant to add it... How about adding just the tile that is downloaded. Running gmt grdcut @earth_relief_03m -R-28/-10/62/68 -Gtemp.nc gives me the tile name "N00W090.earth_relief_03m_p" in .gmt/server/earth/earth_relief/earth_relief_03m_p so maybe try just caching that?

Does adding "N00W090.earth_relief_03m_p" allow to automatically use only this tile for plotting or is there anything else to consider @weiji14 ?

Copy link
Member

@core-man core-man Aug 2, 2021

Choose a reason for hiding this comment

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

See another similar case:

"@N35E135.earth_relief_03s_g.nc",

So, I think we could only cache such a single tile. See some notes for this case in #985 (comment).

Copy link
Member Author

Choose a reason for hiding this comment

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

See another similar case:

"@N35E135.earth_relief_03s_g.nc",

I think we could only cache such a single tile.

I already recognized this one 😉 . My question is: Is that tile automatically used by pygmt.datasets.load_earth_relief() when the corresponding region is defined?

Copy link
Member

Choose a reason for hiding this comment

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

Is that tile automatically used by pygmt.datasets.load_earth_relief() when the corresponding region is defined?

Yes.

examples/gallery/images/grdclip.py Outdated Show resolved Hide resolved
@seisman seisman modified the milestones: 0.5.0, 0.4.1 Jul 28, 2021
michaelgrund added a commit that referenced this pull request Jul 29, 2021
As discussed in #1396 this PR adds the 1 arc minute global relief data to cache.
@core-man core-man mentioned this pull request Jul 31, 2021
23 tasks
@seisman seisman added the final review call This PR requires final review and approval from a second reviewer label Aug 3, 2021
Copy link
Member

@core-man core-man left a comment

Choose a reason for hiding this comment

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

Great~~~We have one more gallery~ 😄

@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Aug 4, 2021
@seisman seisman merged commit b13cd4c into master Aug 4, 2021
@seisman seisman deleted the gallery-grdclip branch August 4, 2021 15:19
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants