Skip to content

Add a tutorial for grdhisteq - #1821

Merged
seisman merged 12 commits into
mainfrom
grdhisteq-tutorial
Apr 9, 2022
Merged

seisman merged 12 commits into
mainfrom
grdhisteq-tutorial

Conversation

@maxrjones

Copy link
Copy Markdown
Member

Description of proposed changes

This PR adds a tutorial showing how to find data values that divide a grid into equal patches of area and write grids with statistics based on cumulative distribution functions.

Fixes #

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 wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • 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

@maxrjones maxrjones added the documentation Improvements or additions to documentation label Mar 15, 2022
@seisman seisman added this to the 0.6.1 milestone Mar 16, 2022
region = [-119.825, -119.4, 37.6, 37.825]

grid = pygmt.datasets.load_earth_relief(resolution="03s", region=region)
grid_dist = pygmt.grd2xyz(grid=grid, outcols=2, output_type="numpy")[:, 0]

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.

Not directly related to this PR, but running grd2xyz gives me unexpected output:

>>> pygmt.grd2xyz(grid=grid, outcols=2, output_type="numpy")
array([[1536.,   nan,   nan],
       [1539.,   nan,   nan],
       [1542.,   nan,   nan],
       ...,
       [2793.,   nan,   nan],
       [2800.,   nan,   nan],
       [2802.,   nan,   nan]])

So it looks like a bug, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, this is a PyGMT issue related to how the temp file output is read into a pandas.DataFrame.

@seisman seisman Mar 16, 2022 •

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.

Two comments here:

  1. pygmt.grd2xyz(grid=grid, outtput_type="pandas")["elevation"] is more readable
  2. Should we limit the use of outcols to output_type="file" only, otherwise we have to parse outcols and process the output columns.

@weiji14 weiji14 mentioned this pull request Mar 30, 2022
25 of 30 tasks
Co-authored-by: Wei Ji <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
@seisman seisman added the final review call This PR requires final review and approval from a second reviewer label Apr 8, 2022

@weiji14 weiji14 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.

Thanks for adding this tutorial Meghan, and happy last day! Hope you get a nice break before starting your next adventure 😃

@michaelgrund michaelgrund 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.

Execpt the two minor changes everything looks great. Thanks for this tutorial @meghanrjones.

@seisman
seisman merged commit 687097c into main Apr 9, 2022
@seisman
seisman deleted the grdhisteq-tutorial branch April 9, 2022 01:11
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Apr 9, 2022
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
Co-authored-by: Wei Ji <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Michael Grund <[email protected]>

This branch was previously deployed

1 inactive deployment
Preview — a13e9f92 Deployed Apr 8, 2022 by vercel[bot]
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.

4 participants