File tree 3 files changed +46
-0
lines changed
3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 17
17
# Import modules to make the high-level GMT Python API
18
18
from .session_management import begin as _begin , end as _end
19
19
from .figure import Figure
20
+ from .modules import info
20
21
21
22
22
23
# Get the version number through versioneer
Original file line number Diff line number Diff line change
1
+ """
2
+ Non-plot GMT modules.
3
+ """
4
+
5
+ from .clib import LibGMT
6
+ from .utils import build_arg_string
7
+ from .decorators import fmt_docstring
8
+ from .utils import GMTTempFile
9
+
10
+
11
+ @fmt_docstring
12
+ def info (fname , ** kwargs ):
13
+ """
14
+ Get information about data tables.
15
+
16
+ {gmt_module_docs}
17
+
18
+ Parameters
19
+ ----------
20
+ fname : str
21
+ The file name of the input data table file.
22
+ """
23
+ assert isinstance (fname , str ), 'Only accepts file names.'
24
+
25
+ with GMTTempFile () as tmpfile :
26
+ arg_str = ' ' .join ([fname , build_arg_string (kwargs ),
27
+ "->" + tmpfile .name ])
28
+ with LibGMT () as lib :
29
+ lib .call_module ('info' , arg_str )
30
+ return tmpfile .read ()
Original file line number Diff line number Diff line change
1
+ """
2
+ Tests for gmtinfo
3
+ """
4
+ import os
5
+
6
+ from .. import info
7
+
8
+ TEST_DATA_DIR = os .path .join (os .path .dirname (__file__ ), 'data' )
9
+
10
+
11
+ def test_gmtinfo ():
12
+ "Test gmtinfo"
13
+ data_fname = os .path .join (TEST_DATA_DIR , 'points.txt' )
14
+ output = info (fname = data_fname , C = True )
15
+ assert output == '11.5309 61.7074 -2.9289 7.8648 0.1412 0.9338\n '
You can’t perform that action at this time.
0 commit comments