Skip to content

Commit 5e0644e

Browse files
committed
Read earth_relief grids via xr.open_dataset to get node_offset attribute
1 parent 516e799 commit 5e0644e

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

pygmt/datasets/earth_relief.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,12 @@ def load_earth_relief(resolution="01d"):
3737
"""
3838
_is_valid_resolution(resolution)
3939
fname = which("@earth_relief_{}".format(resolution), download="u")
40-
grid = xr.open_dataarray(fname)
40+
grid = xr.open_dataset(fname).to_array(name="elevation").squeeze(drop=True)
4141
# Add some metadata to the grid
42-
grid.name = "elevation"
4342
grid.attrs["long_name"] = "elevation relative to the geoid"
4443
grid.attrs["units"] = "meters"
4544
grid.attrs["vertical_datum"] = "EMG96"
4645
grid.attrs["horizontal_datum"] = "WGS84"
47-
# Remove the actual range because it gets outdated when indexing the grid,
48-
# which causes problems when exporting it to netCDF for usage on the
49-
# command-line.
50-
grid.attrs.pop("actual_range")
51-
for coord in grid.coords:
52-
grid[coord].attrs.pop("actual_range")
5346
return grid
5447

5548

0 commit comments

Comments
 (0)