1
1
"""
2
2
Functions to load sample data.
3
3
"""
4
- from typing import Callable , NamedTuple
4
+ from typing import Callable , Literal , NamedTuple
5
5
6
6
import pandas as pd
7
7
from pygmt .exceptions import GMTInvalidInput
@@ -70,7 +70,6 @@ def _load_baja_california_bathymetry():
70
70
The data table. The column names are "longitude", "latitude",
71
71
and "bathymetry".
72
72
"""
73
-
74
73
fname = which ("@tut_ship.xyz" , download = "c" )
75
74
return pd .read_csv (
76
75
fname , sep = "\t " , header = None , names = ["longitude" , "latitude" , "bathymetry" ]
@@ -99,10 +98,9 @@ def _load_fractures_compilation():
99
98
Returns
100
99
-------
101
100
data : pandas.DataFrame
102
- The data table. The column names are "length" and
103
- "azimuth" of the fractures.
101
+ The data table. The column names are "length" and "azimuth" of
102
+ the fractures.
104
103
"""
105
-
106
104
fname = which ("@fractures_06.txt" , download = "c" )
107
105
data = pd .read_csv (
108
106
fname , header = None , delim_whitespace = True , names = ["azimuth" , "length" ]
@@ -166,7 +164,6 @@ def _load_rock_sample_compositions():
166
164
The data table with columns "limestone", "water", "air",
167
165
and "permittivity".
168
166
"""
169
-
170
167
fname = which ("@ternary.txt" , download = "c" )
171
168
return pd .read_csv (
172
169
fname ,
@@ -300,7 +297,21 @@ def list_sample_data():
300
297
return {name : dataset .description for name , dataset in datasets .items ()}
301
298
302
299
303
- def load_sample_data (name ):
300
+ def load_sample_data (
301
+ name : Literal [
302
+ "bathymetry" ,
303
+ "earth_relief_holes" ,
304
+ "fractures" ,
305
+ "hotspots" ,
306
+ "japan_quakes" ,
307
+ "mars_shape" ,
308
+ "maunaloa_co2" ,
309
+ "notre_dame_topography" ,
310
+ "ocean_ridge_points" ,
311
+ "rock_compositions" ,
312
+ "usgs_quakes" ,
313
+ ],
314
+ ):
304
315
"""
305
316
Load an example dataset from the GMT server.
306
317
@@ -310,7 +321,7 @@ def load_sample_data(name):
310
321
311
322
Parameters
312
323
----------
313
- name : str
324
+ name
314
325
Name of the dataset to load.
315
326
316
327
Returns
0 commit comments