|
5 | 5 | from pygmt.clib import Session
|
6 | 6 | from pygmt.helpers import (
|
7 | 7 | build_arg_string,
|
8 |
| - data_kind, |
9 | 8 | deprecate_parameter,
|
10 |
| - dummy_context, |
11 | 9 | fmt_docstring,
|
12 | 10 | kwargs_to_strings,
|
13 | 11 | use_alias,
|
@@ -60,8 +58,10 @@ def contour(self, x=None, y=None, z=None, data=None, **kwargs):
|
60 | 58 | ----------
|
61 | 59 | x/y/z : 1d arrays
|
62 | 60 | Arrays of x and y coordinates and values z of the data points.
|
63 |
| - data : str or 2d array |
64 |
| - Either a data file name or a 2d numpy array with the tabular data. |
| 61 | + data : str or {table-like} |
| 62 | + Pass in (x, y, z) or (longitude, latitude, elevation) values by |
| 63 | + providing a file name to an ASCII data table, a 2D |
| 64 | + {table-classes} |
65 | 65 | {J}
|
66 | 66 | {R}
|
67 | 67 | annotation : str or int
|
@@ -126,17 +126,11 @@ def contour(self, x=None, y=None, z=None, data=None, **kwargs):
|
126 | 126 | """
|
127 | 127 | kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access
|
128 | 128 |
|
129 |
| - kind = data_kind(data, x, y, z, required_z=True) |
130 |
| - |
131 | 129 | with Session() as lib:
|
132 |
| - # Choose how data will be passed in to the module |
133 |
| - if kind == "file": |
134 |
| - file_context = dummy_context(data) |
135 |
| - elif kind == "matrix": |
136 |
| - file_context = lib.virtualfile_from_matrix(data) |
137 |
| - elif kind == "vectors": |
138 |
| - file_context = lib.virtualfile_from_vectors(x, y, z) |
139 |
| - |
| 130 | + # Choose how data will be passed into the module |
| 131 | + file_context = lib.virtualfile_from_data( |
| 132 | + check_kind="vector", data=data, x=x, y=y, z=z, required_z=True |
| 133 | + ) |
140 | 134 | with file_context as fname:
|
141 | 135 | arg_str = " ".join([fname, build_arg_string(kwargs)])
|
142 | 136 | lib.call_module("contour", arg_str)
|
0 commit comments