Skip to content

Commit 97e28c4

Browse files
authored
Fixes #734: make noise a lazy import so datasets module is usable without it (#858)
1 parent 61f5676 commit 97e28c4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

xrspatial/datasets/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
da = None
77

88
import datashader as ds
9-
import noise
109
import numpy as np
1110
import pandas as pd
1211
import xarray as xr
@@ -81,6 +80,13 @@ def make_terrain(
8180
2D array of generated terrain values.
8281
"""
8382

83+
try:
84+
import noise
85+
except ImportError:
86+
raise ImportError(
87+
"make_terrain requires the 'noise' package: pip install noise"
88+
)
89+
8490
if da is None:
8591
raise Exception("make terrain requires dask.Array (pip install dask)")
8692

0 commit comments

Comments
 (0)