Skip to content

Commit

Permalink
Set OGC:CRS84 projection on blue_marble image
Browse files Browse the repository at this point in the history
Set the projection system so that the xarray.DataArray image is plotted as a Geographic image rather than a Cartesian image by GMT.
  • Loading branch information
weiji14 committed Sep 30, 2024
1 parent f13d12b commit 471c6e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pygmt/datasets/earth_daynight.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,7 @@ def load_blue_marble(
region=region,
registration="pixel",
)
# If rioxarray is installed, set the coordinate reference system
if hasattr(image, "rio"):
image = image.rio.write_crs(input_crs="OGC:CRS84")
return image

Check warning on line 88 in pygmt/datasets/earth_daynight.py

View check run for this annotation

Codecov / codecov/patch

pygmt/datasets/earth_daynight.py#L86-L88

Added lines #L86 - L88 were not covered by tests
2 changes: 1 addition & 1 deletion pygmt/tests/test_grdimage_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_grdimage_image_dataarray(xr_image):
Plot a 3-band RGB image using xarray.DataArray input.
"""
fig = Figure()
fig.grdimage(grid=xr_image, region="d")
fig.grdimage(grid=xr_image)
return fig


Expand Down

0 comments on commit 471c6e8

Please sign in to comment.