We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4dea40c commit e4ee800Copy full SHA for e4ee800
pygmt/datasets/earth_mask.py
@@ -89,4 +89,7 @@ def load_earth_mask(resolution="01d", region=None, registration=None):
89
region=region,
90
registration=registration,
91
)
92
- return grid.astype("int8")
+ # `return grid.astype("int8")` doesn't work because grid encoding is lost.
93
+ # See https://github.com/GenericMappingTools/pygmt/issues/2629.
94
+ grid.data = grid.data.astype("int8")
95
+ return grid
pygmt/tests/test_datasets_earth_mask.py
@@ -37,6 +37,7 @@ def test_earth_mask_01d():
37
assert data.attrs["horizontal_datum"] == "WGS84"
38
assert data.shape == (181, 361)
39
assert data.gmt.registration == 0
40
+ assert data.gmt.gtype == 1
41
assert data.dtype == "int8"
42
npt.assert_allclose(data.lat, np.arange(-90, 91, 1))
43
npt.assert_allclose(data.lon, np.arange(-180, 181, 1))
@@ -52,6 +53,8 @@ def test_earth_mask_01d_with_region():
52
53
data = load_earth_mask(resolution="01d", region=[-7, 4, 13, 19])
54
assert data.shape == (7, 12)
55
56
57
+ assert data.dtype == "int8"
58
npt.assert_allclose(data.lat, np.arange(13, 20, 1))
59
npt.assert_allclose(data.lon, np.arange(-7, 5, 1))
60
npt.assert_allclose(data[1, 5], 1)
0 commit comments