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

Wrap grdgradient #1269

Merged
merged 30 commits into from
May 25, 2021
Merged

Wrap grdgradient #1269

merged 30 commits into from
May 25, 2021

Conversation

willschlitzer
Copy link
Contributor

@willschlitzer willschlitzer commented May 11, 2021

This pull request wraps the GMT module grdgradient.

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 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

@willschlitzer willschlitzer added the feature Brand new feature label May 11, 2021
@willschlitzer willschlitzer added this to the 0.4.0 milestone May 11, 2021
@willschlitzer willschlitzer self-assigned this May 11, 2021
@willschlitzer
Copy link
Contributor Author

Ping @GenericMappingTools/pygmt-contributors, I'm never used anything like grdgradient before and am not really sure what it does, so while I think it is communicating with the GMT API, could I have feedback on if this module is operating as expected?

@willschlitzer willschlitzer changed the title WIP: Wrap grdgradient Wrap grdgradient May 14, 2021
@willschlitzer willschlitzer marked this pull request as ready for review May 14, 2021 06:51
pygmt/src/grdgradient.py Outdated Show resolved Hide resolved
pygmt/src/grdgradient.py Outdated Show resolved Hide resolved
pygmt/tests/test_grdgradient.py Show resolved Hide resolved
pygmt/tests/test_grdgradient.py Outdated Show resolved Hide resolved
npt.assert_allclose(temp_grid.min(), -0.0045060496)
npt.assert_allclose(temp_grid.max(), 0.0575332976)


Copy link
Member

Choose a reason for hiding this comment

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

I can't seem to reproduce your error above when running pytest pygmt/tests/test_grdgradient.py, so maybe you're right that there isn't any problem. My pygmt.show_versions() is as below for reference, just did a fresh install yesterday. I only see a difference in xarray and ghostscript versions but those shouldn't matter much I think.

PyGMT information:
  version: v0.3.2.dev145+ga2cdce2c.d20210520
System information:
  python: 3.9.4 | packaged by conda-forge | (default, May 10 2021, 22:13:33)  [GCC 9.3.0]
  executable: /home/username/miniconda3/envs/pygmt/bin/python
  machine: Linux-5.4.0-73-generic-x86_64-with-glibc2.31
Dependency information:
  numpy: 1.20.2
  pandas: 1.2.4
  xarray: 0.18.2
  netCDF4: 1.5.6
  packaging: 20.9
  ghostscript: 9.54.0
  gmt: 6.2.0rc1
GMT library information:
  binary dir: /home/username/miniconda3/envs/pygmt/bin
  cores: 6
  grid layout: rows
  library path: /home/username/miniconda3/envs/pygmt/lib/libgmt.so
  padding: 2
  plugin dir: /home/username/miniconda3/envs/pygmt/lib/gmt/plugins
  share dir: /home/username/miniconda3/envs/pygmt/share/gmt
  version: 6.2.0rc1

pygmt/src/grdgradient.py Outdated Show resolved Hide resolved
pygmt/tests/test_grdgradient.py Outdated Show resolved Hide resolved
@weiji14 weiji14 added the final review call This PR requires final review and approval from a second reviewer label May 24, 2021
@weiji14
Copy link
Member

weiji14 commented May 25, 2021

I'll merge this in first @willschlitzer before all the GMT 6.2.0rc2 chaos ensues (have tested that grdgradient works locally on GMT 6.2.0rc2). Thanks again!

@weiji14 weiji14 merged commit 1cbaebd into master May 25, 2021
@weiji14 weiji14 deleted the wrap-grdgradient branch May 25, 2021 04:23
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label May 25, 2021
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
Add `grdgradient` function for computing directional gradients from a grid.
Original GMT grdgradient function can be found at
https://docs.generic-mapping-tools.org/6.1/grdgradient.html

* aliased azimuth (A), direction (D), and radiance (E)
* add test_grdgradient.py

Co-authored-by: Wei Ji <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Brand new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants