@@ -1748,16 +1748,17 @@ def virtualfile_from_stringio(
1748
1748
seg .header = None
1749
1749
seg .text = None
1750
1750
1751
+ # TODO(PyGMT>=0.20.0): Remove the deprecated parameter 'extra_arrays'.
1751
1752
def virtualfile_in (
1752
1753
self ,
1753
1754
check_kind = None ,
1754
1755
data = None ,
1755
1756
x = None ,
1756
1757
y = None ,
1757
1758
z = None ,
1758
- extra_arrays = None ,
1759
1759
required_z = False ,
1760
1760
required_data = True ,
1761
+ extra_arrays = None ,
1761
1762
):
1762
1763
"""
1763
1764
Store any data inside a virtual file.
@@ -1771,20 +1772,25 @@ def virtualfile_in(
1771
1772
check_kind : str or None
1772
1773
Used to validate the type of data that can be passed in. Choose
1773
1774
from 'raster', 'vector', or None. Default is None (no validation).
1774
- data : str or pathlib.Path or xarray.DataArray or {table-like} or None
1775
+ data : str or pathlib.Path or xarray.DataArray or {table-like} or dict or None
1775
1776
Any raster or vector data format. This could be a file name or
1776
1777
path, a raster grid, a vector matrix/arrays, or other supported
1777
1778
data input.
1778
1779
x/y/z : 1-D arrays or None
1779
1780
x, y, and z columns as numpy arrays.
1780
- extra_arrays : list of 1-D arrays
1781
- Optional. A list of numpy arrays in addition to x, y, and z.
1782
- All of these arrays must be of the same size as the x/y/z arrays.
1783
1781
required_z : bool
1784
1782
State whether the 'z' column is required.
1785
1783
required_data : bool
1786
1784
Set to True when 'data' is required, or False when dealing with
1787
1785
optional virtual files. [Default is True].
1786
+ extra_arrays : list of 1-D arrays
1787
+ A list of numpy arrays in addition to x, y, and z. All of these arrays must
1788
+ be of the same size as the x/y/z arrays.
1789
+
1790
+ .. deprecated:: v0.16.0
1791
+ The parameter 'extra_arrays' will be removed in v0.20.0. Prepare and pass
1792
+ a dictionary of arrays instead to the `data` parameter. E.g.,
1793
+ ``data={"x": x, "y": y, "size": size}``.
1788
1794
1789
1795
Returns
1790
1796
-------
@@ -1863,10 +1869,16 @@ def virtualfile_in(
1863
1869
if z is not None :
1864
1870
_data .append (z )
1865
1871
if extra_arrays :
1872
+ msg = (
1873
+ "The parameter 'extra_arrays' will be removed in v0.20.0. "
1874
+ "Prepare and pass a dictionary of arrays instead to the `data` "
1875
+ "parameter. E.g., `data={'x': x, 'y': y, 'size': size}`"
1876
+ )
1877
+ warnings .warn (message = msg , category = FutureWarning , stacklevel = 1 )
1866
1878
_data .extend (extra_arrays )
1867
1879
case "vectors" :
1868
1880
if hasattr (data , "items" ) and not hasattr (data , "to_frame" ):
1869
- # pandas.DataFrame or xarray.Dataset types.
1881
+ # Dictionary, pandas.DataFrame or xarray.Dataset types.
1870
1882
# pandas.Series will be handled below like a 1-D numpy.ndarray.
1871
1883
_data = [array for _ , array in data .items ()]
1872
1884
else :
0 commit comments