Skip to content

Commit 2febc8f

Browse files
Split up functions for loading datasets (#1955)
1 parent 880b344 commit 2febc8f

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

pygmt/datasets/samples.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,27 @@ def load_sample_data(name):
6666
if name not in names:
6767
raise GMTInvalidInput(f"Invalid dataset name '{name}'.")
6868

69-
load_func = {
69+
# Dictionary of public load functions for backwards compatibility
70+
load_func_old = {
7071
"bathymetry": load_sample_bathymetry,
71-
"earth_relief_holes": _load_earth_relief_holes,
7272
"fractures": load_fractures_compilation,
7373
"hotspots": load_hotspots,
7474
"japan_quakes": load_japan_quakes,
7575
"mars_shape": load_mars_shape,
7676
"ocean_ridge_points": load_ocean_ridge_points,
77-
"notre_dame_topography": _load_notre_dame_topography,
7877
"usgs_quakes": load_usgs_quakes,
7978
}
8079

81-
data = load_func[name](suppress_warning=True)
80+
# Dictionary of private load functions
81+
load_func = {
82+
"earth_relief_holes": _load_earth_relief_holes,
83+
"notre_dame_topography": _load_notre_dame_topography,
84+
}
85+
86+
if name in load_func_old:
87+
data = load_func_old[name](suppress_warning=True)
88+
elif name in load_func:
89+
data = load_func[name]()
8290

8391
return data
8492

@@ -350,7 +358,7 @@ def load_mars_shape(**kwargs):
350358
return data
351359

352360

353-
def _load_notre_dame_topography(**kwargs): # pylint: disable=unused-argument
361+
def _load_notre_dame_topography():
354362
"""
355363
Load Table 5.11 in Davis: Statistics and Data Analysis in Geology.
356364
@@ -363,7 +371,7 @@ def _load_notre_dame_topography(**kwargs): # pylint: disable=unused-argument
363371
return pd.read_csv(fname, sep=r"\s+", header=None, names=["x", "y", "z"])
364372

365373

366-
def _load_earth_relief_holes(**kwargs): # pylint: disable=unused-argument
374+
def _load_earth_relief_holes():
367375
"""
368376
Loads the remote file @earth_relief_20m_holes.grd.
369377

0 commit comments

Comments
 (0)