From b4f1ac49c013c36eae538990e48650504a76d92b Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 18 Nov 2022 10:02:35 -0500 Subject: [PATCH 1/7] add gebcosi --- pygmt/datasets/earth_relief.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pygmt/datasets/earth_relief.py b/pygmt/datasets/earth_relief.py index 980f405337a..9c4524a8fa9 100644 --- a/pygmt/datasets/earth_relief.py +++ b/pygmt/datasets/earth_relief.py @@ -141,11 +141,15 @@ def load_earth_relief( f"{registration}-registered Earth relief data for " f"resolution '{resolution}' is not supported." ) - earth_relief_sources = {"igpp": "earth_relief_", "gebco": "earth_gebco_"} + earth_relief_sources = { + "igpp": "earth_relief_", + "gebco": "earth_gebco_", + "gebcosi": "earth_gebcosi_", + } if data_source not in earth_relief_sources: raise GMTInvalidInput( f"Invalid earth relief 'data_source' {data_source}, " - "valid values are 'igpp' and 'gebco'." + "valid values are 'igpp', 'gebco', and 'gebcosi'." ) if data_source != "igpp": with Session() as lib: From fc28a7efab8b789e8531de8d504404904fc9ca20 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 18 Nov 2022 10:13:00 -0500 Subject: [PATCH 2/7] add gebcosi data source to test_earth_relief_01d_gebco --- pygmt/tests/test_datasets_earth_relief.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pygmt/tests/test_datasets_earth_relief.py b/pygmt/tests/test_datasets_earth_relief.py index 3529e555df4..be3f2e68ce9 100644 --- a/pygmt/tests/test_datasets_earth_relief.py +++ b/pygmt/tests/test_datasets_earth_relief.py @@ -8,7 +8,7 @@ from pygmt.exceptions import GMTInvalidInput -@pytest.mark.parametrize("data_source", ["igpp", "gebco"]) +@pytest.mark.parametrize("data_source", ["igpp", "gebco", "gebcosi"]) def test_earth_relief_fails(data_source): """ Make sure earth relief fails for invalid resolutions. @@ -35,12 +35,14 @@ def test_earth_relief_01d_igpp(): npt.assert_allclose(data.max(), 5559.0) -def test_earth_relief_01d_gebco(): +@pytest.mark.parametrize("data_source", ["gebco", "gebcosi"]) +def test_earth_relief_01d_gebco(data_source): """ - Test some properties of the earth relief 01d data with GEBCO data. + Test some properties of the earth relief 01d data with GEBCO and GEBOCSI + data. """ data = load_earth_relief( - resolution="01d", registration="gridline", data_source="gebco" + resolution="01d", registration="gridline", data_source=data_source ) assert data.shape == (181, 361) npt.assert_allclose(data.lat, np.arange(-90, 91, 1)) From acf6716448b30ee6961adafd41ee28ccb51d74ab Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 18 Nov 2022 10:34:59 -0500 Subject: [PATCH 3/7] add test_earth_gebcosi_15m_with_region --- pygmt/tests/test_datasets_earth_relief.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pygmt/tests/test_datasets_earth_relief.py b/pygmt/tests/test_datasets_earth_relief.py index be3f2e68ce9..e5189113536 100644 --- a/pygmt/tests/test_datasets_earth_relief.py +++ b/pygmt/tests/test_datasets_earth_relief.py @@ -114,6 +114,23 @@ def test_earth_relief_05m_with_region(): assert data.sizes["lon"] == 481 +def test_earth_gebcosi_15m_with_region(): + """ + Test loading a subregion of 15 arc-minute resolution earth_gebcosi grid. + """ + data = load_earth_relief( + resolution="15m", + region=[85, 87, -88, -84], + registration="pixel", + data_source="gebcosi", + ) + assert data.shape == (16, 8) + npt.assert_allclose(data.lat, np.arange(-87.875, -84, 0.25)) + npt.assert_allclose(data.lon, np.arange(85.125, 87, 0.25)) + npt.assert_allclose(data.min(), -531) + npt.assert_allclose(data.max(), 474) + + def test_earth_relief_05m_without_region(): """ Test loading high-resolution earth relief without passing 'region'. From e7e3eeb1bc38c731f139858df72c3ccf156476dd Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 18 Nov 2022 10:38:17 -0500 Subject: [PATCH 4/7] add GEBCOSI dataset cache files --- pygmt/helpers/testing.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pygmt/helpers/testing.py b/pygmt/helpers/testing.py index 386d3bc7ad7..15deded3fc1 100644 --- a/pygmt/helpers/testing.py +++ b/pygmt/helpers/testing.py @@ -156,6 +156,8 @@ def download_test_data(): datasets = [ # Earth relief grids "@earth_gebco_01d_g", + "@earth_gebcosi_01d_g", + "earth_gebcosi_15m_p", "@earth_relief_01d_p", "@earth_relief_01d_g", "@earth_relief_30m_p", From 2ac4bf599b1e14648dc5dcfbadb850f9354ead47 Mon Sep 17 00:00:00 2001 From: actions-bot <58130806+actions-bot@users.noreply.github.com> Date: Wed, 23 Nov 2022 14:45:25 +0000 Subject: [PATCH 5/7] [format-command] fixes --- pygmt/tests/test_datasets_earth_relief.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/tests/test_datasets_earth_relief.py b/pygmt/tests/test_datasets_earth_relief.py index 2e0eb4bd12f..23006e80ac9 100644 --- a/pygmt/tests/test_datasets_earth_relief.py +++ b/pygmt/tests/test_datasets_earth_relief.py @@ -131,8 +131,8 @@ def test_earth_gebcosi_15m_with_region(): npt.assert_allclose(data.lon, np.arange(85.125, 87, 0.25)) npt.assert_allclose(data.min(), -531) npt.assert_allclose(data.max(), 474) - - + + def test_earth_relief_30s_synbath(): """ Test some properties of the earth relief 30s data with SYNBATH data. From 7902785d7e68b43e9801137f7cb4efe620d64adb Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 25 Nov 2022 09:19:42 -0500 Subject: [PATCH 6/7] Apply suggestions from code review Co-authored-by: Dongdong Tian --- pygmt/helpers/testing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/helpers/testing.py b/pygmt/helpers/testing.py index be0bdedbe23..57c916f5f83 100644 --- a/pygmt/helpers/testing.py +++ b/pygmt/helpers/testing.py @@ -157,7 +157,7 @@ def download_test_data(): # Earth relief grids "@earth_gebco_01d_g", "@earth_gebcosi_01d_g", - "earth_gebcosi_15m_p", + "@earth_gebcosi_15m_p", "@earth_relief_01d_p", "@earth_relief_01d_g", "@earth_relief_30m_p", From eec094994f515a7328a99484d39ed82ccd9f231c Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 25 Nov 2022 09:27:38 -0500 Subject: [PATCH 7/7] add synbath and gebcosi to docstring --- pygmt/datasets/earth_relief.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pygmt/datasets/earth_relief.py b/pygmt/datasets/earth_relief.py index 5695aeaa588..922467e784d 100644 --- a/pygmt/datasets/earth_relief.py +++ b/pygmt/datasets/earth_relief.py @@ -76,10 +76,17 @@ def load_earth_relief( - **igpp** : IGPP Global Earth Relief [Default option]. See :gmt-datasets:`earth-relief.html`. + - **synbath** : IGPP Global Earth Relief dataset that uses + stastical properties of young seafloor to provide more realistic + relief of young areas with small seamounts. + - **gebco** : GEBCO Global Earth Relief with only observed relief and inferred relief via altimetric gravity. See :gmt-datasets:`earth-gebco.html`. + - **gebcosi** : GEBCO Global Earth Relief that gives sub-ice (si) + elevations. + Returns ------- grid : :class:`xarray.DataArray`