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 function to import seafloor crustal age dataset #1471

Merged
merged 18 commits into from
Oct 18, 2021
Merged

Conversation

willschlitzer
Copy link
Contributor

@willschlitzer willschlitzer commented Aug 28, 2021

This pull request adds a function to import the seafloor crustal age dataset, similar to load_earth_relief().

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 Aug 28, 2021
@willschlitzer willschlitzer added this to the 0.5.0 milestone Aug 28, 2021
@willschlitzer willschlitzer self-assigned this Aug 28, 2021
@willschlitzer willschlitzer changed the title WIP: Add function to import seafloor crustal age dataset Add function to import seafloor crustal age dataset Sep 10, 2021
@willschlitzer willschlitzer marked this pull request as ready for review September 10, 2021 01:32
@willschlitzer willschlitzer marked this pull request as draft September 22, 2021 10:52
@willschlitzer
Copy link
Contributor Author

Converting to draft to save resources when pushing changes.

@willschlitzer
Copy link
Contributor Author

@GenericMappingTools/pygmt-admin How can I find the names of the specific grids to load in helpers/testing.py for the 5 min resolution for the region specified in test_seafloor_crust_age_05m_with_region()?

@seisman
Copy link
Member

seisman commented Sep 22, 2021

@GenericMappingTools/pygmt-admin How can I find the names of the specific grids to load in helpers/testing.py for the 5 min resolution for the region specified in test_seafloor_crust_age_05m_with_region()?

You can simply run gmt grdinfo @earth_age_05m -Rw/e/s/n (wesn is the region you're interested in), then you should be able to see the 05m tile under your ~/.gmt/server/earth/earth_age/earth_age_05m_p directory.

@willschlitzer willschlitzer marked this pull request as ready for review September 25, 2021 07:21
@willschlitzer willschlitzer requested a review from a team October 5, 2021 18:58
pygmt/datasets/seafloor_crust_age.py Outdated Show resolved Hide resolved
pygmt/datasets/seafloor_crust_age.py Outdated Show resolved Hide resolved
doc/api/index.rst Outdated Show resolved Hide resolved
pygmt/tests/test_datasets_seafloor_crust_age.py Outdated Show resolved Hide resolved
pygmt/helpers/testing.py Outdated Show resolved Hide resolved
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
@willschlitzer willschlitzer mentioned this pull request Oct 7, 2021
35 tasks
@weiji14 weiji14 added the final review call This PR requires final review and approval from a second reviewer label Oct 16, 2021
@willschlitzer
Copy link
Contributor Author

Looking at the deployment overview, I'm not able to figure out why it is running into errors. I'll hold off on merging this pull request.

@weiji14
Copy link
Member

weiji14 commented Oct 17, 2021

Looking at the deployment overview, I'm not able to figure out why it is running into errors. I'll hold off on merging this pull request.

This is an unrelated problem, see #1575 (comment). A bit surprised it hasn't been fixed yet, but we can merge this regardless I think (preferably after a second approval).

@weiji14 weiji14 merged commit 65995f6 into main Oct 18, 2021
@weiji14 weiji14 deleted the seafloor-age branch October 18, 2021 21:39
@maxrjones
Copy link
Member

I have been running into test failures locally for pygmt/tests/test_datasets_earth_age.py::test_earth_age_01d_with_region and pygmt/tests/test_datasets_earth_age.py::test_earth_age_05m_with_region, without any luck figuring out what's going on. Would anyone be able to check whether they can reproduce these failures?

@willschlitzer
Copy link
Contributor Author

I have been running into test failures locally for pygmt/tests/test_datasets_earth_age.py::test_earth_age_01d_with_region and pygmt/tests/test_datasets_earth_age.py::test_earth_age_05m_with_region, without any luck figuring out what's going on. Would anyone be able to check whether they can reproduce these failures?

Just ran make test as well the singular run of test_datasets_earth_age.py on my local machine and didn't have any failures. Is it saying what the failure is?

@maxrjones
Copy link
Member

I have been running into test failures locally for pygmt/tests/test_datasets_earth_age.py::test_earth_age_01d_with_region and pygmt/tests/test_datasets_earth_age.py::test_earth_age_05m_with_region, without any luck figuring out what's going on. Would anyone be able to check whether they can reproduce these failures?

Just ran make test as well the singular run of test_datasets_earth_age.py on my local machine and didn't have any failures. Is it saying what the failure is?

Thanks for checking. It's just a tiny difference in the minimum values, so not too concerning but still frustrating:

    def test_earth_age_01d_with_region():
        """
        Test loading low-resolution earth age with 'region'.
        """
>       npt.assert_allclose(data.min(), 11.293945)
E       AssertionError: 
E       Not equal to tolerance rtol=1e-07, atol=0
E       
E       Mismatched elements: 1 / 1 (100%)
E       Max absolute difference: 2.21984863e-06
E       Max relative difference: 1.96552102e-07
E        x: array(11.293947, dtype=float32)
E        y: array(11.293945)

    def test_earth_age_05m_with_region():
        """
        Test loading a subregion of high-resolution earth age.
        """

>       npt.assert_allclose(data.data.min(), 0.040000916)
E       AssertionError: 
E       Not equal to tolerance rtol=1e-07, atol=0
E       
E       Mismatched elements: 1 / 1 (100%)
E       Max absolute difference: 1.31828011e-06
E       Max relative difference: 3.2956248e-05
E        x: array(0.040002, dtype=float32)
E        y: array(0.040001)

@weiji14
Copy link
Member

weiji14 commented Nov 5, 2021

I have been running into test failures locally for pygmt/tests/test_datasets_earth_age.py::test_earth_age_01d_with_region and pygmt/tests/test_datasets_earth_age.py::test_earth_age_05m_with_region, without any luck figuring out what's going on. Would anyone be able to check whether they can reproduce these failures?

Nope, can't reproduce it locally, and the GitHub Actions CI seems ok. Here's my pygmt.show_versions() for reference:

PyGMT information:
  version: v0.5.0
System information:
  python: 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 19:20:46)  [GCC 9.4.0]
  executable: /home/username/miniconda3/envs/pygmt/bin/python
  machine: Linux-5.10.0-8-amd64-x86_64-with-glibc2.31
Dependency information:
  numpy: 1.21.3
  pandas: 1.3.4
  xarray: 0.20.0
  netCDF4: 1.5.8
  packaging: 21.2
  ghostscript: 9.54.0
  gmt: 6.2.0
GMT library information:
  binary dir: /home/username/miniconda3/envs/pygmt/bin
  cores: 2
  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.0

Maybe try running gmt clear all and see if that helps?

@willschlitzer willschlitzer removed the final review call This PR requires final review and approval from a second reviewer label Dec 4, 2021
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
…ols#1471)

New function to download the Earth seafloor age datasets
at various resolutions. This is the `@earth_age` grids on the
GMT remote data server.

* add earth_age.py
* Add test_datasets_earth_age.py
* add seafloor age datasets to helpers/testing.py
* add load_earth_age to index.rst
* add 05m grid tile for caching

Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
This pull request was closed.
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.

5 participants