8
8
from packaging .version import Version
9
9
from pygmt .clib import __gmt_version__
10
10
from pygmt .datasets import load_earth_relief
11
+ from pygmt .enums import GridReg
11
12
from pygmt .exceptions import GMTInvalidInput
12
13
13
14
@@ -25,7 +26,7 @@ def test_earth_relief_01d_igpp_synbath(data_source):
25
26
assert data .attrs ["vertical_datum" ] == "EGM96"
26
27
assert data .attrs ["horizontal_datum" ] == "WGS84"
27
28
assert data .shape == (181 , 361 )
28
- assert data .gmt .registration == 0
29
+ assert data .gmt .registration == GridReg . GRIDLINE
29
30
npt .assert_allclose (data .lat , np .arange (- 90 , 91 , 1 ))
30
31
npt .assert_allclose (data .lon , np .arange (- 180 , 181 , 1 ))
31
32
npt .assert_allclose (data .min (), - 7174.0 , atol = 0.5 )
@@ -45,7 +46,7 @@ def test_earth_relief_01d_gebco(data_source):
45
46
assert data .attrs ["vertical_datum" ] == "EGM96"
46
47
assert data .attrs ["horizontal_datum" ] == "WGS84"
47
48
assert data .shape == (181 , 361 )
48
- assert data .gmt .registration == 0
49
+ assert data .gmt .registration == GridReg . GRIDLINE
49
50
npt .assert_allclose (data .lat , np .arange (- 90 , 91 , 1 ))
50
51
npt .assert_allclose (data .lon , np .arange (- 180 , 181 , 1 ))
51
52
npt .assert_allclose (data .min (), - 7169.0 , atol = 1.0 )
@@ -62,7 +63,7 @@ def test_earth_relief_01d_with_region_srtm():
62
63
data_source = "igpp" ,
63
64
)
64
65
assert data .shape == (11 , 21 )
65
- assert data .gmt .registration == 0
66
+ assert data .gmt .registration == GridReg . GRIDLINE
66
67
npt .assert_allclose (data .lat , np .arange (- 5 , 6 , 1 ))
67
68
npt .assert_allclose (data .lon , np .arange (- 10 , 11 , 1 ))
68
69
npt .assert_allclose (data .min (), - 5118.0 , atol = 0.5 )
@@ -79,7 +80,7 @@ def test_earth_relief_01d_with_region_gebco():
79
80
data_source = "gebco" ,
80
81
)
81
82
assert data .shape == (11 , 21 )
82
- assert data .gmt .registration == 0
83
+ assert data .gmt .registration == GridReg . GRIDLINE
83
84
npt .assert_allclose (data .lat , np .arange (- 5 , 6 , 1 ))
84
85
npt .assert_allclose (data .lon , np .arange (- 10 , 11 , 1 ))
85
86
npt .assert_allclose (data .min (), - 5118.0 , atol = 1.0 )
@@ -92,7 +93,7 @@ def test_earth_relief_30m():
92
93
"""
93
94
data = load_earth_relief (resolution = "30m" )
94
95
assert data .shape == (361 , 721 )
95
- assert data .gmt .registration == 0
96
+ assert data .gmt .registration == GridReg . GRIDLINE
96
97
npt .assert_allclose (data .lat , np .arange (- 90 , 90.5 , 0.5 ))
97
98
npt .assert_allclose (data .lon , np .arange (- 180 , 180.5 , 0.5 ))
98
99
npt .assert_allclose (data .min (), - 8279.5 , atol = 0.5 )
@@ -110,7 +111,7 @@ def test_earth_gebcosi_15m_with_region():
110
111
data_source = "gebcosi" ,
111
112
)
112
113
assert data .shape == (16 , 8 )
113
- assert data .gmt .registration == 1
114
+ assert data .gmt .registration == GridReg . PIXEL
114
115
npt .assert_allclose (data .lat , np .arange (- 87.875 , - 84 , 0.25 ))
115
116
npt .assert_allclose (data .lon , np .arange (85.125 , 87 , 0.25 ))
116
117
npt .assert_allclose (data .min (), - 492 , atol = 1.0 )
@@ -183,7 +184,7 @@ def test_earth_relief_15s_default_registration():
183
184
"""
184
185
data = load_earth_relief (resolution = "15s" , region = [- 10 , - 9.5 , 4 , 5 ])
185
186
assert data .shape == (240 , 120 )
186
- assert data .gmt .registration == 1
187
+ assert data .gmt .registration == GridReg . PIXEL
187
188
npt .assert_allclose (data .coords ["lat" ].data .min (), 4.002083 )
188
189
npt .assert_allclose (data .coords ["lat" ].data .max (), 4.997917 )
189
190
npt .assert_allclose (data .coords ["lon" ].data .min (), - 9.997917 )
@@ -203,7 +204,7 @@ def test_earth_relief_03s_default_registration():
203
204
"""
204
205
data = load_earth_relief (resolution = "03s" , region = [- 10 , - 9.8 , 4.9 , 5 ])
205
206
assert data .shape == (121 , 241 )
206
- assert data .gmt .registration == 0
207
+ assert data .gmt .registration == GridReg . GRIDLINE
207
208
npt .assert_allclose (data .coords ["lat" ].data .min (), 4.9 )
208
209
npt .assert_allclose (data .coords ["lat" ].data .max (), 5 )
209
210
npt .assert_allclose (data .coords ["lon" ].data .min (), - 10 )
0 commit comments