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

Fix tests for Aug 2023 updated remote datasets #2636

Merged
merged 14 commits into from
Aug 31, 2023
12 changes: 6 additions & 6 deletions pygmt/tests/test_datasets_earth_age.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def test_earth_age_01d():
assert data.gmt.registration == 0
npt.assert_allclose(data.lat, np.arange(-90, 91, 1))
npt.assert_allclose(data.lon, np.arange(-180, 181, 1))
npt.assert_allclose(data.min(), 0.167381, rtol=1e-5)
npt.assert_allclose(data.max(), 338.0274, rtol=1e-5)
npt.assert_allclose(data.min(), 0.17, atol=0.01)
npt.assert_allclose(data.max(), 338.02, atol=0.01)


def test_earth_age_01d_with_region():
Expand All @@ -53,8 +53,8 @@ def test_earth_age_01d_with_region():
assert data.gmt.registration == 0
npt.assert_allclose(data.lat, np.arange(-5, 6, 1))
npt.assert_allclose(data.lon, np.arange(-10, 11, 1))
npt.assert_allclose(data.min(), 11.293945, rtol=1e-5)
npt.assert_allclose(data.max(), 125.1189, rtol=1e-5)
npt.assert_allclose(data.min(), 11.29, atol=0.01)
npt.assert_allclose(data.max(), 125.12, atol=0.01)


def test_earth_age_01m_without_region():
Expand Down Expand Up @@ -86,5 +86,5 @@ def test_earth_age_01m_default_registration():
assert data.coords["lat"].data.max() == 5.0
assert data.coords["lon"].data.min() == -10.0
assert data.coords["lon"].data.max() == -9.0
npt.assert_allclose(data.min(), 88.63)
npt.assert_allclose(data.max(), 125.25)
npt.assert_allclose(data.min(), 88.63, atol=0.01)
npt.assert_allclose(data.max(), 125.25, atol=0.01)
12 changes: 6 additions & 6 deletions pygmt/tests/test_datasets_earth_free_air_anomaly.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def test_earth_faa_01d():
assert data.gmt.registration == 0
npt.assert_allclose(data.lat, np.arange(-90, 91, 1))
npt.assert_allclose(data.lon, np.arange(-180, 181, 1))
npt.assert_allclose(data.min(), -275.75)
npt.assert_allclose(data.max(), 308.375)
npt.assert_allclose(data.min(), -275.85, atol=0.025)
npt.assert_allclose(data.max(), 308.35, atol=0.025)


def test_earth_faa_01d_with_region():
Expand All @@ -53,8 +53,8 @@ def test_earth_faa_01d_with_region():
assert data.gmt.registration == 0
npt.assert_allclose(data.lat, np.arange(-5, 6, 1))
npt.assert_allclose(data.lon, np.arange(-10, 11, 1))
npt.assert_allclose(data.min(), -58.75)
npt.assert_allclose(data.max(), 69.524994)
npt.assert_allclose(data.min(), -58.475, atol=0.025)
npt.assert_allclose(data.max(), 69.975, atol=0.025)


def test_earth_faa_01m_without_region():
Expand All @@ -78,5 +78,5 @@ def test_earth_faa_01m_default_registration():
npt.assert_allclose(data.coords["lat"].data.max(), 4.991666666)
npt.assert_allclose(data.coords["lon"].data.min(), -9.99166666)
npt.assert_allclose(data.coords["lon"].data.max(), -9.00833333)
npt.assert_allclose(data.min(), -51)
npt.assert_allclose(data.max(), 113.675)
npt.assert_allclose(data.min(), -49.225, atol=0.025)
npt.assert_allclose(data.max(), 115.0, atol=0.025)
12 changes: 6 additions & 6 deletions pygmt/tests/test_datasets_earth_geoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def test_earth_geoid_01d():
assert data.gmt.registration == 0
npt.assert_allclose(data.lat, np.arange(-90, 91, 1))
npt.assert_allclose(data.lon, np.arange(-180, 181, 1))
npt.assert_allclose(data.min(), -106.45)
npt.assert_allclose(data.max(), 83.619995)
npt.assert_allclose(data.min(), -106.45, atol=0.01)
npt.assert_allclose(data.max(), 83.62, atol=0.01)


def test_earth_geoid_01d_with_region():
Expand All @@ -53,8 +53,8 @@ def test_earth_geoid_01d_with_region():
assert data.gmt.registration == 0
npt.assert_allclose(data.lat, np.arange(-5, 6, 1))
npt.assert_allclose(data.lon, np.arange(-10, 11, 1))
npt.assert_allclose(data.min(), 4.87)
npt.assert_allclose(data.max(), 29.89)
npt.assert_allclose(data.min(), 4.87, atol=0.01)
npt.assert_allclose(data.max(), 29.89, atol=0.01)


def test_earth_geoid_01m_without_region():
Expand Down Expand Up @@ -86,5 +86,5 @@ def test_earth_geoid_01m_default_registration():
assert data.coords["lat"].data.max() == 5.0
assert data.coords["lon"].data.min() == -10.0
assert data.coords["lon"].data.max() == -9.0
npt.assert_allclose(data.min(), 20.34)
npt.assert_allclose(data.max(), 30.039999)
npt.assert_allclose(data.min(), 20.34, atol=0.01)
npt.assert_allclose(data.max(), 30.04, atol=0.01)
36 changes: 18 additions & 18 deletions pygmt/tests/test_datasets_earth_magnetic_anomaly.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def test_earth_mag_01d():
assert data.gmt.registration == 0
npt.assert_allclose(data.lat, np.arange(-90, 91, 1))
npt.assert_allclose(data.lon, np.arange(-180, 181, 1))
npt.assert_allclose(data.min(), -384)
npt.assert_allclose(data.max(), 1057.2)
npt.assert_allclose(data.min(), -384.0, atol=0.2)
npt.assert_allclose(data.max(), 1057.2, atol=0.2)


def test_earth_mag_01d_with_region():
Expand All @@ -53,8 +53,8 @@ def test_earth_mag_01d_with_region():
assert data.gmt.registration == 0
npt.assert_allclose(data.lat, np.arange(-5, 6, 1))
npt.assert_allclose(data.lon, np.arange(-10, 11, 1))
npt.assert_allclose(data.min(), -180.40002, rtol=1e-5)
npt.assert_allclose(data.max(), 127.39996, rtol=1e-5)
npt.assert_allclose(data.min(), -180.4, atol=0.2)
npt.assert_allclose(data.max(), 127.4, atol=0.2)


def test_earth_mag_02m_without_region():
Expand Down Expand Up @@ -92,8 +92,8 @@ def test_earth_mag_02m_default_registration():
npt.assert_allclose(data.coords["lat"].data.max(), 4.983333333)
npt.assert_allclose(data.coords["lon"].data.min(), -9.98333333)
npt.assert_allclose(data.coords["lon"].data.max(), -9.01666667)
npt.assert_allclose(data.min(), -231)
npt.assert_allclose(data.max(), 131.79999)
npt.assert_allclose(data.min(), -231.0, atol=0.2)
npt.assert_allclose(data.max(), 131.8, atol=0.2)


def test_earth_mag4km_01d():
Expand All @@ -109,8 +109,8 @@ def test_earth_mag4km_01d():
assert data.gmt.registration == 0
npt.assert_allclose(data.lat, np.arange(-90, 91, 1))
npt.assert_allclose(data.lon, np.arange(-180, 181, 1))
npt.assert_allclose(data.min(), -799.19995)
npt.assert_allclose(data.max(), 3226.4)
npt.assert_allclose(data.min(), -799.2, atol=0.2)
npt.assert_allclose(data.max(), 3226.4, atol=0.2)


def test_earth_mag4km_01d_with_region():
Expand All @@ -126,8 +126,8 @@ def test_earth_mag4km_01d_with_region():
assert data.shape == (11, 21)
npt.assert_allclose(data.lat, np.arange(-5, 6, 1))
npt.assert_allclose(data.lon, np.arange(-10, 11, 1))
npt.assert_allclose(data.min(), -153.19995, rtol=1e-5)
npt.assert_allclose(data.max(), 113.59985, rtol=1e-5)
npt.assert_allclose(data.min(), -153.2, atol=0.2)
npt.assert_allclose(data.max(), 113.6, atol=0.2)


def test_earth_mag4km_02m_default_registration():
Expand All @@ -146,8 +146,8 @@ def test_earth_mag4km_02m_default_registration():
npt.assert_allclose(data.coords["lat"].data.max(), 5.98333333)
npt.assert_allclose(data.coords["lon"].data.min(), -114.98333333)
npt.assert_allclose(data.coords["lon"].data.max(), -112.01666667)
npt.assert_allclose(data.min(), -132.80005, rtol=1e-5)
npt.assert_allclose(data.max(), 79.59985, rtol=1e-5)
npt.assert_allclose(data.min(), -132.8, atol=0.2)
npt.assert_allclose(data.max(), 79.6, atol=0.2)


def test_earth_mag_01d_wdmam():
Expand All @@ -164,8 +164,8 @@ def test_earth_mag_01d_wdmam():
assert data.shape == (181, 361)
npt.assert_allclose(data.lat, np.arange(-90, 91, 1))
npt.assert_allclose(data.lon, np.arange(-180, 181, 1))
npt.assert_allclose(data.min(), -773.5)
npt.assert_allclose(data.max(), 1751.3)
npt.assert_allclose(data.min(), -794.0, atol=0.2)
npt.assert_allclose(data.max(), 2169.8, atol=0.2)


def test_earth_mag_01d_wdmam_with_region():
Expand All @@ -181,8 +181,8 @@ def test_earth_mag_01d_wdmam_with_region():
assert data.shape == (11, 21)
npt.assert_allclose(data.lat, np.arange(-5, 6, 1))
npt.assert_allclose(data.lon, np.arange(-10, 11, 1))
npt.assert_allclose(data.min(), -103.900024, rtol=1e-5)
npt.assert_allclose(data.max(), 102.19995, rtol=1e-5)
npt.assert_allclose(data.min(), -145.6, atol=0.2)
npt.assert_allclose(data.max(), 107.6, atol=0.2)


def test_earth_mag_03m_wdmam_with_region():
Expand All @@ -198,8 +198,8 @@ def test_earth_mag_03m_wdmam_with_region():
assert data.lat.max() == -58
assert data.lon.min() == 10
assert data.lon.max() == 13
npt.assert_allclose(data.min(), -639.7001)
npt.assert_allclose(data.max(), 629.6)
npt.assert_allclose(data.min(), -790.2, atol=0.2)
npt.assert_allclose(data.max(), 528.0, atol=0.2)


def test_earth_mag_03m_wdmam_without_region():
Expand Down
28 changes: 14 additions & 14 deletions pygmt/tests/test_datasets_earth_relief.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def test_earth_relief_01d_igpp_synbath(data_source):
assert data.shape == (181, 361)
npt.assert_allclose(data.lat, np.arange(-90, 91, 1))
npt.assert_allclose(data.lon, np.arange(-180, 181, 1))
npt.assert_allclose(data.min(), -8600.5)
npt.assert_allclose(data.max(), 5559.0)
npt.assert_allclose(data.min(), -8600.5, atol=0.5)
npt.assert_allclose(data.max(), 5559.0, atol=0.5)
Comment on lines +40 to +41
Copy link
Member

Choose a reason for hiding this comment

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

Did you get the uncertainty for the earth_relief grids from the paper(s)? I'm not seeing them on https://www.generic-mapping-tools.org/remote-datasets/earth-relief.html#technical-information.



@pytest.mark.parametrize("data_source", ["gebco", "gebcosi"])
Expand All @@ -52,8 +52,8 @@ def test_earth_relief_01d_gebco(data_source):
assert data.gmt.registration == 0
seisman marked this conversation as resolved.
Show resolved Hide resolved
npt.assert_allclose(data.lat, np.arange(-90, 91, 1))
npt.assert_allclose(data.lon, np.arange(-180, 181, 1))
npt.assert_allclose(data.min(), -8598)
npt.assert_allclose(data.max(), 5559.0)
npt.assert_allclose(data.min(), -8597.0, atol=1.0)
npt.assert_allclose(data.max(), 5559.0, atol=1.0)
seisman marked this conversation as resolved.
Show resolved Hide resolved


def test_earth_relief_01d_with_region_srtm():
Expand All @@ -69,8 +69,8 @@ def test_earth_relief_01d_with_region_srtm():
assert data.gmt.registration == 0
npt.assert_allclose(data.lat, np.arange(-5, 6, 1))
npt.assert_allclose(data.lon, np.arange(-10, 11, 1))
npt.assert_allclose(data.min(), -5154)
npt.assert_allclose(data.max(), 805.5)
npt.assert_allclose(data.min(), -5154, atol=0.5)
weiji14 marked this conversation as resolved.
Show resolved Hide resolved
npt.assert_allclose(data.max(), 805.5, atol=0.5)


def test_earth_relief_01d_with_region_gebco():
Expand All @@ -86,8 +86,8 @@ def test_earth_relief_01d_with_region_gebco():
assert data.gmt.registration == 0
npt.assert_allclose(data.lat, np.arange(-5, 6, 1))
npt.assert_allclose(data.lon, np.arange(-10, 11, 1))
npt.assert_allclose(data.min(), -5146)
npt.assert_allclose(data.max(), 806)
npt.assert_allclose(data.min(), -5151.0, atol=1.0)
npt.assert_allclose(data.max(), 806.0, atol=1.0)


def test_earth_relief_30m():
Expand All @@ -99,8 +99,8 @@ def test_earth_relief_30m():
assert data.gmt.registration == 0
npt.assert_allclose(data.lat, np.arange(-90, 90.5, 0.5))
npt.assert_allclose(data.lon, np.arange(-180, 180.5, 0.5))
npt.assert_allclose(data.min(), -9454.5)
npt.assert_allclose(data.max(), 5887.5)
npt.assert_allclose(data.min(), -9454.5, atol=0.5)
npt.assert_allclose(data.max(), 5887.5, atol=0.5)


def test_earth_gebcosi_15m_with_region():
Expand All @@ -117,8 +117,8 @@ def test_earth_gebcosi_15m_with_region():
assert data.gmt.registration == 1
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)
npt.assert_allclose(data.min(), -531, atol=1.0)
npt.assert_allclose(data.max(), 474, atol=1.0)


def test_earth_relief_30s_synbath():
weiji14 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -244,8 +244,8 @@ def test_earth_relief_15s_default_registration():
npt.assert_allclose(data.coords["lat"].data.max(), 4.997917)
npt.assert_allclose(data.coords["lon"].data.min(), -9.997917)
npt.assert_allclose(data.coords["lon"].data.max(), -9.502083)
npt.assert_allclose(data.min(), -3897)
npt.assert_allclose(data.max(), -74)
npt.assert_allclose(data.min(), -3897, atol=0.5)
npt.assert_allclose(data.max(), -74, atol=0.5)
weiji14 marked this conversation as resolved.
Show resolved Hide resolved


def test_earth_relief_03s_default_registration():
weiji14 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
12 changes: 6 additions & 6 deletions pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def test_earth_vertical_gravity_gradient_01d():
assert data.gmt.registration == 0
npt.assert_allclose(data.lat, np.arange(-90, 91, 1))
npt.assert_allclose(data.lon, np.arange(-180, 181, 1))
npt.assert_allclose(data.min(), -136.34375)
npt.assert_allclose(data.max(), 104.59375)
npt.assert_allclose(data.min(), -137.125, atol=1 / 32)
npt.assert_allclose(data.max(), 104.59375, atol=1 / 32)
assert data[1, 1].isnull()


Expand All @@ -58,8 +58,8 @@ def test_earth_vertical_gravity_gradient_01d_with_region():
assert data.gmt.registration == 0
npt.assert_allclose(data.lat, np.arange(-5, 6, 1))
npt.assert_allclose(data.lon, np.arange(-10, 11, 1))
npt.assert_allclose(data.min(), -16.34375)
npt.assert_allclose(data.max(), 19.78125)
npt.assert_allclose(data.min(), -15.6875, atol=1 / 32)
npt.assert_allclose(data.max(), 19.875, atol=1 / 32)


def test_earth_vertical_gravity_gradient_01m_without_region():
Expand Down Expand Up @@ -95,5 +95,5 @@ def test_earth_vertical_gravity_gradient_01m_default_registration():
npt.assert_allclose(data.coords["lat"].data.max(), 4.991666666)
npt.assert_allclose(data.coords["lon"].data.min(), -9.99166666)
npt.assert_allclose(data.coords["lon"].data.max(), -9.00833333)
npt.assert_allclose(data.min(), -40.25)
npt.assert_allclose(data.max(), 81.75)
npt.assert_allclose(data.min(), -37.5625, atol=1 / 32)
npt.assert_allclose(data.max(), 82.59375, atol=1 / 32)
Loading