Skip to content

Commit 66183ed

Browse files
committed
Import rioxarray to register rio accessor
Xref #3323
1 parent f11decc commit 66183ed

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

pygmt/datasets/earth_day.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55
The images are available in various resolutions.
66
"""
77

8+
import contextlib
89
from collections.abc import Sequence
910
from typing import Literal
1011

1112
import xarray as xr
1213
from pygmt.datasets.load_remote_dataset import _load_remote_dataset
1314

15+
with contextlib.suppress(ImportError):
16+
# rioxarray is needed to register the rio accessor
17+
import rioxarray # noqa: F401
18+
1419
__doctest_skip__ = ["load_blue_marble"]
1520

1621

pygmt/datasets/earth_night.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55
The images are available in various resolutions.
66
"""
77

8+
import contextlib
89
from collections.abc import Sequence
910
from typing import Literal
1011

1112
import xarray as xr
1213
from pygmt.datasets.load_remote_dataset import _load_remote_dataset
1314

15+
with contextlib.suppress(ImportError):
16+
# rioxarray is needed to register the rio accessor
17+
import rioxarray # noqa: F401
18+
1419
__doctest_skip__ = ["load_black_marble"]
1520

1621

0 commit comments

Comments
 (0)