Skip to content

Commit

Permalink
Refactor fixture_xr_image to use load_blue_marble function
Browse files Browse the repository at this point in the history
  • Loading branch information
weiji14 committed Feb 17, 2024
1 parent aa8a474 commit cd4cab6
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions pygmt/tests/test_grdimage_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
Test Figure.grdimage on 3-band RGB images.
"""
import pytest
from pygmt import Figure, which
from pygmt import Figure
from pygmt.datasets import load_blue_marble

rioxarray = pytest.importorskip("rioxarray")

Expand All @@ -13,12 +14,9 @@ def fixture_xr_image():
Load the image data from Blue Marble as an xarray.DataArray with shape {"band": 3,
"y": 180, "x": 360}.
"""
geotiff = which(fname="@earth_day_01d_p", download="c")
with rioxarray.open_rasterio(filename=geotiff) as rda:
if len(rda.band) == 3:
xr_image = rda.load()
assert xr_image.sizes == {"band": 3, "y": 180, "x": 360}
return xr_image
xr_image = load_blue_marble(resolution="01d")
assert xr_image.sizes == {"band": 3, "y": 180, "x": 360}
return xr_image


@pytest.mark.mpl_image_compare
Expand Down

0 comments on commit cd4cab6

Please sign in to comment.