Skip to content

Commit cedfa26

Browse files
committed
Always check if gridline is the default registration for 01d resolution
1 parent a2e508d commit cedfa26

6 files changed

+25
-28
lines changed

pygmt/tests/test_datasets_earth_age.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ def test_earth_age_01d_with_region():
4848
"""
4949
Test loading low-resolution earth age with 'region'.
5050
"""
51-
data = load_earth_age(
52-
resolution="01d", region=[-10, 10, -5, 5], registration="gridline"
53-
)
51+
data = load_earth_age(resolution="01d", region=[-10, 10, -5, 5])
5452
assert data.shape == (11, 21)
5553
assert data.gmt.registration == 0
5654
npt.assert_allclose(data.lat, np.arange(-5, 6, 1))

pygmt/tests/test_datasets_earth_free_air_anomaly.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ def test_earth_faa_01d():
3131
"""
3232
Test some properties of the free air anomaly 01d data.
3333
"""
34-
data = load_earth_free_air_anomaly(resolution="01d", registration="gridline")
34+
data = load_earth_free_air_anomaly(resolution="01d")
3535
assert data.name == "free_air_anomaly"
3636
assert data.attrs["long_name"] == "IGPP Global Earth Free-Air Anomaly"
3737
assert data.attrs["units"] == "mGal"
3838
assert data.attrs["horizontal_datum"] == "WGS84"
3939
assert data.shape == (181, 361)
40+
assert data.gmt.registration == 0
4041
npt.assert_allclose(data.lat, np.arange(-90, 91, 1))
4142
npt.assert_allclose(data.lon, np.arange(-180, 181, 1))
4243
npt.assert_allclose(data.min(), -275.75)
@@ -47,10 +48,9 @@ def test_earth_faa_01d_with_region():
4748
"""
4849
Test loading low-resolution earth free air anomaly with 'region'.
4950
"""
50-
data = load_earth_free_air_anomaly(
51-
resolution="01d", region=[-10, 10, -5, 5], registration="gridline"
52-
)
51+
data = load_earth_free_air_anomaly(resolution="01d", region=[-10, 10, -5, 5])
5352
assert data.shape == (11, 21)
53+
assert data.gmt.registration == 0
5454
npt.assert_allclose(data.lat, np.arange(-5, 6, 1))
5555
npt.assert_allclose(data.lon, np.arange(-10, 11, 1))
5656
npt.assert_allclose(data.min(), -58.75)

pygmt/tests/test_datasets_earth_geoid.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ def test_earth_geoid_01d():
3131
"""
3232
Test some properties of the earth geoid 01d data.
3333
"""
34-
data = load_earth_geoid(resolution="01d", registration="gridline")
34+
data = load_earth_geoid(resolution="01d")
3535
assert data.name == "earth_geoid"
3636
assert data.attrs["units"] == "m"
3737
assert data.attrs["long_name"] == "EGM2008 Global Earth Geoid"
3838
assert data.attrs["horizontal_datum"] == "WGS84"
3939
assert data.shape == (181, 361)
40+
assert data.gmt.registration == 0
4041
npt.assert_allclose(data.lat, np.arange(-90, 91, 1))
4142
npt.assert_allclose(data.lon, np.arange(-180, 181, 1))
4243
npt.assert_allclose(data.min(), -106.45)
@@ -47,10 +48,9 @@ def test_earth_geoid_01d_with_region():
4748
"""
4849
Test loading low-resolution earth geoid with 'region'.
4950
"""
50-
data = load_earth_geoid(
51-
resolution="01d", region=[-10, 10, -5, 5], registration="gridline"
52-
)
51+
data = load_earth_geoid(resolution="01d", region=[-10, 10, -5, 5])
5352
assert data.shape == (11, 21)
53+
assert data.gmt.registration == 0
5454
npt.assert_allclose(data.lat, np.arange(-5, 6, 1))
5555
npt.assert_allclose(data.lon, np.arange(-10, 11, 1))
5656
npt.assert_allclose(data.min(), 4.87)

pygmt/tests/test_datasets_earth_magnetic_anomaly.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ def test_earth_mag_01d():
3131
"""
3232
Test some properties of the magnetic anomaly 01d data.
3333
"""
34-
data = load_earth_magnetic_anomaly(resolution="01d", registration="gridline")
34+
data = load_earth_magnetic_anomaly(resolution="01d")
3535
assert data.name == "magnetic_anomaly"
3636
assert data.attrs["long_name"] == "Earth magnetic anomaly"
3737
assert data.attrs["units"] == "nT"
3838
assert data.attrs["horizontal_datum"] == "WGS84"
3939
assert data.shape == (181, 361)
40+
assert data.gmt.registration == 0
4041
npt.assert_allclose(data.lat, np.arange(-90, 91, 1))
4142
npt.assert_allclose(data.lon, np.arange(-180, 181, 1))
4243
npt.assert_allclose(data.min(), -384)
@@ -47,10 +48,9 @@ def test_earth_mag_01d_with_region():
4748
"""
4849
Test loading low-resolution earth magnetic anomaly with 'region'.
4950
"""
50-
data = load_earth_magnetic_anomaly(
51-
resolution="01d", region=[-10, 10, -5, 5], registration="gridline"
52-
)
51+
data = load_earth_magnetic_anomaly(resolution="01d", region=[-10, 10, -5, 5])
5352
assert data.shape == (11, 21)
53+
assert data.gmt.registration == 0
5454
npt.assert_allclose(data.lat, np.arange(-5, 6, 1))
5555
npt.assert_allclose(data.lon, np.arange(-10, 11, 1))
5656
npt.assert_allclose(data.min(), -180.40002)
@@ -81,14 +81,13 @@ def test_earth_mag4km_01d():
8181
"""
8282
Test some properties of the magnetic anomaly 4km 01d data.
8383
"""
84-
data = load_earth_magnetic_anomaly(
85-
resolution="01d", registration="gridline", mag4km=True
86-
)
84+
data = load_earth_magnetic_anomaly(resolution="01d", mag4km=True)
8785
assert data.name == "magnetic_anomaly"
8886
assert data.attrs["long_name"] == "Earth magnetic anomaly"
8987
assert data.attrs["units"] == "nT"
9088
assert data.attrs["horizontal_datum"] == "WGS84"
9189
assert data.shape == (181, 361)
90+
assert data.gmt.registration == 0
9291
npt.assert_allclose(data.lat, np.arange(-90, 91, 1))
9392
npt.assert_allclose(data.lon, np.arange(-180, 181, 1))
9493
npt.assert_allclose(data.min(), -799.19995)

pygmt/tests/test_datasets_earth_relief.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,9 @@ def test_earth_relief_01d_gebco(data_source):
4747
Test some properties of the earth relief 01d data with GEBCO and GEBOCSI
4848
data.
4949
"""
50-
data = load_earth_relief(
51-
resolution="01d", registration="gridline", data_source=data_source
52-
)
50+
data = load_earth_relief(resolution="01d", data_source=data_source)
5351
assert data.shape == (181, 361)
52+
assert data.gmt.registration == 0
5453
npt.assert_allclose(data.lat, np.arange(-90, 91, 1))
5554
npt.assert_allclose(data.lon, np.arange(-180, 181, 1))
5655
npt.assert_allclose(data.min(), -8598)
@@ -64,10 +63,10 @@ def test_earth_relief_01d_with_region_srtm():
6463
data = load_earth_relief(
6564
resolution="01d",
6665
region=[-10, 10, -5, 5],
67-
registration="gridline",
6866
data_source="igpp",
6967
)
7068
assert data.shape == (11, 21)
69+
assert data.gmt.registration == 0
7170
npt.assert_allclose(data.lat, np.arange(-5, 6, 1))
7271
npt.assert_allclose(data.lon, np.arange(-10, 11, 1))
7372
npt.assert_allclose(data.min(), -5154)
@@ -81,10 +80,10 @@ def test_earth_relief_01d_with_region_gebco():
8180
data = load_earth_relief(
8281
resolution="01d",
8382
region=[-10, 10, -5, 5],
84-
registration="gridline",
8583
data_source="gebco",
8684
)
8785
assert data.shape == (11, 21)
86+
assert data.gmt.registration == 0
8887
npt.assert_allclose(data.lat, np.arange(-5, 6, 1))
8988
npt.assert_allclose(data.lon, np.arange(-10, 11, 1))
9089
npt.assert_allclose(data.min(), -5146)
@@ -95,8 +94,9 @@ def test_earth_relief_30m():
9594
"""
9695
Test some properties of the earth relief 30m data.
9796
"""
98-
data = load_earth_relief(resolution="30m", registration="gridline")
97+
data = load_earth_relief(resolution="30m")
9998
assert data.shape == (361, 721)
99+
assert data.gmt.registration == 0
100100
npt.assert_allclose(data.lat, np.arange(-90, 90.5, 0.5))
101101
npt.assert_allclose(data.lon, np.arange(-180, 180.5, 0.5))
102102
npt.assert_allclose(data.min(), -9454.5)

pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,13 @@ def test_earth_vertical_gravity_gradient_01d():
3333
"""
3434
Test some properties of the earth vgg 01d data.
3535
"""
36-
data = load_earth_vertical_gravity_gradient(
37-
resolution="01d", registration="gridline"
38-
)
36+
data = load_earth_vertical_gravity_gradient(resolution="01d")
3937
assert data.name == "earth_vgg"
4038
assert data.attrs["units"] == "Eotvos"
4139
assert data.attrs["long_name"] == "IGPP Global Earth Vertical Gravity Gradient"
4240
assert data.attrs["horizontal_datum"] == "WGS84"
4341
assert data.shape == (181, 361)
42+
assert data.gmt.registration == 0
4443
npt.assert_allclose(data.lat, np.arange(-90, 91, 1))
4544
npt.assert_allclose(data.lon, np.arange(-180, 181, 1))
4645
npt.assert_allclose(data.min(), -136.34375)
@@ -53,9 +52,10 @@ def test_earth_vertical_gravity_gradient_01d_with_region():
5352
Test loading low-resolution earth vgg with 'region'.
5453
"""
5554
data = load_earth_vertical_gravity_gradient(
56-
resolution="01d", region=[-10, 10, -5, 5], registration="gridline"
55+
resolution="01d", region=[-10, 10, -5, 5]
5756
)
5857
assert data.shape == (11, 21)
58+
assert data.gmt.registration == 0
5959
npt.assert_allclose(data.lat, np.arange(-5, 6, 1))
6060
npt.assert_allclose(data.lon, np.arange(-10, 11, 1))
6161
npt.assert_allclose(data.min(), -16.34375)

0 commit comments

Comments
 (0)