Skip to content

Fix old references from gmt to pygmt #940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 30 additions & 29 deletions pygmt/clib/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def __enter__(self):
"""
Create a GMT API session and check the libgmt version.

Calls :meth:`~gmt.clib.Session.create`.
Calls :meth:`pygmt.clib.Session.create`.

Raises
------
Expand All @@ -197,7 +197,7 @@ def __exit__(self, exc_type, exc_value, traceback):
"""
Destroy the currently open GMT API session.

Calls :meth:`~gmt.clib.Session.destroy`.
Calls :meth:`pygmt.clib.Session.destroy`.
"""
self.destroy()

Expand Down Expand Up @@ -296,10 +296,10 @@ def create(self, name):

.. warning::

Usage of :class:`~gmt.clib.Session` as a context manager in a
Usage of :class:`pygmt.clib.Session` as a context manager in a
``with`` block is preferred over calling
:meth:`~gmt.clib.Session.create` and
:meth:`~gmt.clib.Session.destroy` manually.
:meth:`pygmt.clib.Session.create` and
:meth:`pygmt.clib.Session.destroy` manually.

Calls ``GMT_Create_Session`` and generates a new ``GMTAPI_CTRL``
struct, which is a :class:`ctypes.c_void_p` pointer. Sets the
Expand Down Expand Up @@ -387,10 +387,10 @@ def destroy(self):

.. warning::

Usage of :class:`~gmt.clib.Session` as a context manager in a
Usage of :class:`pygmt.clib.Session` as a context manager in a
``with`` block is preferred over calling
:meth:`~gmt.clib.Session.create` and
:meth:`~gmt.clib.Session.destroy` manually.
:meth:`pygmt.clib.Session.create` and
:meth:`pygmt.clib.Session.destroy` manually.

Calls ``GMT_Destroy_Session`` to terminate and free the memory of a
registered ``GMTAPI_CTRL`` session (the pointer for this struct is
Expand Down Expand Up @@ -631,15 +631,16 @@ def _parse_constant(self, constant, valid, valid_modifiers=None):

If valid modifiers are not given, then will assume that modifiers are
not allowed. In this case, will raise a
:class:`~gmt.exceptions.GMTInvalidInput` exception if given a modifier.
:class:`pygmt.exceptions.GMTInvalidInput` exception if given a
modifier.

Parameters
----------
constant : str
The name of a valid GMT API constant, with an optional modifier.
valid : list of str
A list of valid values for the constant. Will raise a
:class:`~gmt.exceptions.GMTInvalidInput` exception if the given
:class:`pygmt.exceptions.GMTInvalidInput` exception if the given
value is not on the list.
"""
parts = constant.split("|")
Expand Down Expand Up @@ -739,7 +740,7 @@ def put_vector(self, dataset, column, vector):
Use this function to attach numpy array data to a GMT dataset and pass
it to GMT modules. Wraps ``GMT_Put_Vector``.

The dataset must be created by :meth:`~gmt.clib.Session.create_data`
The dataset must be created by :meth:`pygmt.clib.Session.create_data`
first. Use ``family='GMT_IS_DATASET|GMT_VIA_VECTOR'``.

Not at all numpy dtypes are supported, only: float64, float32, int64,
Expand All @@ -755,7 +756,7 @@ def put_vector(self, dataset, column, vector):
----------
dataset : :class:`ctypes.c_void_p`
The ctypes void pointer to a ``GMT_Dataset``. Create it with
:meth:`~gmt.clib.Session.create_data`.
:meth:`pygmt.clib.Session.create_data`.
column : int
The column number of this vector in the dataset (starting from 0).
vector : numpy 1d-array
Expand Down Expand Up @@ -802,7 +803,7 @@ def put_strings(self, dataset, family, strings):
Use this function to attach string type numpy array data to a GMT
dataset and pass it to GMT modules. Wraps ``GMT_Put_Strings``.

The dataset must be created by :meth:`~gmt.clib.Session.create_data`
The dataset must be created by :meth:`pygmt.clib.Session.create_data`
first.

.. warning::
Expand All @@ -815,7 +816,7 @@ def put_strings(self, dataset, family, strings):
----------
dataset : :class:`ctypes.c_void_p`
The ctypes void pointer to a ``GMT_Dataset``. Create it with
:meth:`~gmt.clib.Session.create_data`.
:meth:`pygmt.clib.Session.create_data`.
family : str
The family type of the dataset. Can be either ``GMT_IS_VECTOR`` or
``GMT_IS_MATRIX``.
Expand Down Expand Up @@ -862,7 +863,7 @@ def put_matrix(self, dataset, matrix, pad=0):
Use this function to attach numpy array data to a GMT dataset and pass
it to GMT modules. Wraps ``GMT_Put_Matrix``.

The dataset must be created by :meth:`~gmt.clib.Session.create_data`
The dataset must be created by :meth:`pygmt.clib.Session.create_data`
first. Use ``|GMT_VIA_MATRIX'`` in the family.

Not at all numpy dtypes are supported, only: float64, float32, int64,
Expand All @@ -877,7 +878,7 @@ def put_matrix(self, dataset, matrix, pad=0):
----------
dataset : :class:`ctypes.c_void_p`
The ctypes void pointer to a ``GMT_Dataset``. Create it with
:meth:`~gmt.clib.Session.create_data`.
:meth:`pygmt.clib.Session.create_data`.
matrix : numpy 2d-array
The array that will be attached to the dataset. Must be a 2d C
contiguous array.
Expand Down Expand Up @@ -910,7 +911,7 @@ def write_data(self, family, geometry, mode, wesn, output, data):
Write a GMT data container to a file.

The data container should be created by
:meth:`~gmt.clib.Session.create_data`.
:meth:`pygmt.clib.Session.create_data`.

Wraps ``GMT_Write_Data`` but only allows writing to a file. So the
``method`` argument is omitted.
Expand All @@ -936,7 +937,7 @@ def write_data(self, family, geometry, mode, wesn, output, data):
The output file name.
data : :class:`ctypes.c_void_p`
Pointer to the data container created by
:meth:`~gmt.clib.Session.create_data`.
:meth:`pygmt.clib.Session.create_data`.

Raises
------
Expand Down Expand Up @@ -981,7 +982,7 @@ def open_virtual_file(self, family, geometry, direction, data):

GMT uses a virtual file scheme to pass in data to API modules. Use it
to pass in your GMT data structure (created using
:meth:`~gmt.clib.Session.create_data`) to a module that expects an
:meth:`pygmt.clib.Session.create_data`) to a module that expects an
input or output file.

Use in a ``with`` block. Will automatically close the virtual file when
Expand Down Expand Up @@ -1096,9 +1097,9 @@ def virtualfile_from_vectors(self, *vectors):
virtual file upon exit of the ``with`` block.

Use this instead of creating the data container and virtual file by
hand with :meth:`~gmt.clib.Session.create_data`,
:meth:`~gmt.clib.Session.put_vector`, and
:meth:`~gmt.clib.Session.open_virtual_file`.
hand with :meth:`pygmt.clib.Session.create_data`,
:meth:`pygmt.clib.Session.put_vector`, and
:meth:`pygmt.clib.Session.open_virtual_file`.

If the arrays are C contiguous blocks of memory, they will be passed
without copying to GMT. If they are not (e.g., they are columns of a 2D
Expand Down Expand Up @@ -1206,12 +1207,12 @@ def virtualfile_from_matrix(self, matrix):

**Not meant for creating ``GMT_GRID``**. The grid requires more
metadata than just the data matrix. Use
:meth:`~gmt.clib.Session.virtualfile_from_grid` instead.
:meth:`pygmt.clib.Session.virtualfile_from_grid` instead.

Use this instead of creating the data container and virtual file by
hand with :meth:`~gmt.clib.Session.create_data`,
:meth:`~gmt.clib.Session.put_matrix`, and
:meth:`~gmt.clib.Session.open_virtual_file`
hand with :meth:`pygmt.clib.Session.create_data`,
:meth:`pygmt.clib.Session.put_matrix`, and
:meth:`pygmt.clib.Session.open_virtual_file`

The matrix must be C contiguous in memory. If it is not (e.g., it is a
slice of a larger array), the array will be copied to make sure it is.
Expand Down Expand Up @@ -1288,9 +1289,9 @@ def virtualfile_from_grid(self, grid):
metadata.

Use this instead of creating a data container and virtual file by hand
with :meth:`~gmt.clib.Session.create_data`,
:meth:`~gmt.clib.Session.put_matrix`, and
:meth:`~gmt.clib.Session.open_virtual_file`
with :meth:`pygmt.clib.Session.create_data`,
:meth:`pygmt.clib.Session.put_matrix`, and
:meth:`pygmt.clib.Session.open_virtual_file`

The grid data matrix must be C contiguous in memory. If it is not
(e.g., it is a slice of a larger array), the array will be copied to
Expand Down
4 changes: 2 additions & 2 deletions pygmt/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def savefig(
The KML output generates a companion PNG file.

You can pass in any keyword arguments that
:meth:`~gmt.Figure.psconvert` accepts.
:meth:`pygmt.Figure.psconvert` accepts.

Parameters
----------
Expand Down Expand Up @@ -334,7 +334,7 @@ def _preview(self, fmt, dpi, as_bytes=False, **kwargs):
----------
fmt : str
The image format. Can be any extension that
:meth:`~gmt.Figure.savefig` recognizes.
:meth:`pygmt.Figure.savefig` recognizes.
dpi : int
The image resolution (dots per inch).
as_bytes : bool
Expand Down