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 load_earth_free_air_anomaly function for Earth free-air anomaly dataset #2238

Merged
merged 11 commits into from
Dec 15, 2022

Conversation

willschlitzer
Copy link
Contributor

This adds load_earth_free_air_anomaly to load the IGPP Global Earth Free-Air Anomaly dataset.

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

@willschlitzer willschlitzer added the feature Brand new feature label Dec 9, 2022
@willschlitzer willschlitzer added this to the 0.8.0 milestone Dec 9, 2022
@willschlitzer willschlitzer self-assigned this Dec 9, 2022
@willschlitzer willschlitzer changed the title WIP: Add load_earth_free_air_anomaly function for Earth free-air anomaly dataset Add load_earth_free_air_anomaly function for Earth free-air anomaly dataset Dec 9, 2022
@willschlitzer willschlitzer marked this pull request as ready for review December 9, 2022 12:56
pygmt/datasets/load_remote_dataset.py Outdated Show resolved Hide resolved
Comment on lines +11 to +28
def test_earth_faa_fails():
"""
Make sure earth_free_air_anomaly fails for invalid resolutions.
"""
resolutions = "1m 1d bla 60d 001m 03".split()
resolutions.append(60)
for resolution in resolutions:
with pytest.raises(GMTInvalidInput):
load_earth_free_air_anomaly(resolution=resolution)


def test_earth_faa_incorrect_registration():
"""
Test loading earth_free_air_anomaly with incorrect registration type.
"""
with pytest.raises(GMTInvalidInput):
load_earth_free_air_anomaly(registration="improper_type")

Copy link
Member

Choose a reason for hiding this comment

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

These tests are common to all Earth datasets. Perhaps we can move all these tests in a new test file like test_datasets_load_remote_dataset.py instead.

Copy link
Member

Choose a reason for hiding this comment

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

This can be done in a separate PR if necessary.

pygmt/datasets/earth_free_air_anomaly.py Outdated Show resolved Hide resolved
pygmt/helpers/testing.py Outdated Show resolved Hide resolved
pygmt/helpers/testing.py Outdated Show resolved Hide resolved
pygmt/helpers/testing.py Show resolved Hide resolved
@seisman
Copy link
Member

seisman commented Dec 14, 2022

@willschlitzer This PR looks good to me, but need to resolve the conflicts before adding the "final review call" label.

@willschlitzer willschlitzer added the final review call This PR requires final review and approval from a second reviewer label Dec 14, 2022
pygmt/datasets/earth_free_air_anomaly.py Outdated Show resolved Hide resolved
@willschlitzer willschlitzer merged commit f125b12 into main Dec 15, 2022
@willschlitzer willschlitzer deleted the load-remote-dataset/free-air-anomaly branch December 15, 2022 13:47
@willschlitzer willschlitzer removed the final review call This PR requires final review and approval from a second reviewer label Dec 15, 2022
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
…ataset (GenericMappingTools#2238)

* Add earth_free_air_anomaly.py
* Add load_earth_free_air_anomaly to API index
* Add tests and cache files for load_earth_free_air_anomaly

Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Michael Grund <[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