Skip to content

Commit

Permalink
Rewrap docstrings to 88 characters (#2926)
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman authored Jan 2, 2024
1 parent 29f87b7 commit da36673
Show file tree
Hide file tree
Showing 78 changed files with 335 additions and 405 deletions.
13 changes: 6 additions & 7 deletions pygmt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
PyGMT is a library for processing geospatial and geophysical data and making
publication-quality maps and figures. It provides a Pythonic interface for the
Generic Mapping Tools (GMT), a command-line program widely used across the
Earth, Ocean, and Planetary sciences and beyond. Besides making GMT more
accessible to new users, PyGMT aims to provide integration with the PyData
ecosystem as well as support for rich display in Jupyter notebooks.
publication-quality maps and figures. It provides a Pythonic interface for the Generic
Mapping Tools (GMT), a command-line program widely used across the Earth, Ocean, and
Planetary sciences and beyond. Besides making GMT more accessible to new users, PyGMT
aims to provide integration with the PyData ecosystem as well as support for rich
display in Jupyter notebooks.
Main Features
-------------
Expand Down Expand Up @@ -93,8 +93,7 @@ def print_clib_info(file=sys.stdout):

def show_versions(file=sys.stdout):
"""
Print various dependency versions which are useful when submitting bug
reports.
Print various dependency versions which are useful when submitting bug reports.
This includes information about:
Expand Down
3 changes: 1 addition & 2 deletions pygmt/accessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ def registration(self, value):
@property
def gtype(self):
"""
Coordinate system type of the grid, either 0 (Cartesian) or 1
(Geographic).
Coordinate system type of the grid, either 0 (Cartesian) or 1 (Geographic).
"""
return self._gtype

Expand Down
4 changes: 2 additions & 2 deletions pygmt/clib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""
Low-level wrapper for the GMT C API.
The pygmt.clib.Session class wraps the GMT C shared library (libgmt) with a
Pythonic interface. Access to the C library is done through ctypes.
The pygmt.clib.Session class wraps the GMT C shared library (libgmt) with a Pythonic
interface. Access to the C library is done through ctypes.
"""

from pygmt.clib.session import Session
Expand Down
3 changes: 1 addition & 2 deletions pygmt/clib/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ def dataarray_to_matrix(grid):

def vectors_to_arrays(vectors):
"""
Convert 1-D vectors (lists, arrays, or pandas.Series) to C contiguous 1-D
arrays.
Convert 1-D vectors (lists, arrays, or pandas.Series) to C contiguous 1-D arrays.
Arrays must be in C contiguous order for us to pass their memory pointers
to GMT. If any are not, convert them to C order (which requires copying the
Expand Down
4 changes: 2 additions & 2 deletions pygmt/clib/loading.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""
Utility functions to load libgmt as ctypes.CDLL.
The path to the shared library can be found automatically by ctypes or set
through the GMT_LIBRARY_PATH environment variable.
The path to the shared library can be found automatically by ctypes or set through the
GMT_LIBRARY_PATH environment variable.
"""
import ctypes
import os
Expand Down
26 changes: 13 additions & 13 deletions pygmt/clib/session.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Defines the Session class to create and destroy a GMT API session and provides
access to the API functions.
Defines the Session class to create and destroy a GMT API session and provides access to
the API functions.
Uses ctypes to wrap most of the core functions from the C API.
"""
Expand Down Expand Up @@ -369,11 +369,11 @@ def create(self, name):
@ctp.CFUNCTYPE(ctp.c_int, ctp.c_void_p, ctp.c_char_p)
def print_func(file_pointer, message): # noqa: ARG001
"""
Callback function that the GMT C API will use to print log and
error messages.
Callback function that the GMT C API will use to print log and error
messages.
We'll capture the messages and print them to stderr so that they
will show up on the Jupyter notebook.
We'll capture the messages and print them to stderr so that they will show
up on the Jupyter notebook.
"""
message = message.decode().strip()
self._error_log.append(message)
Expand Down Expand Up @@ -497,8 +497,8 @@ def get_default(self, name):

def get_common(self, option):
"""
Inquire if a GMT common option has been set and return its current
value if possible.
Inquire if a GMT common option has been set and return its current value if
possible.
Parameters
----------
Expand Down Expand Up @@ -720,9 +720,9 @@ def _parse_pad(self, family, kwargs):
"""
Parse and return an appropriate value for pad if none is given.
Pad is a bit tricky because, for matrix types, pad control the matrix
ordering (row or column major). Using the default pad will set it to
column major and mess things up with the numpy arrays.
Pad is a bit tricky because, for matrix types, pad control the matrix ordering
(row or column major). Using the default pad will set it to column major and
mess things up with the numpy arrays.
"""
pad = kwargs.get("pad", None)
if pad is None:
Expand Down Expand Up @@ -783,8 +783,8 @@ def _parse_constant(self, constant, valid, valid_modifiers=None):

def _check_dtype_and_dim(self, array, ndim):
"""
Check that a numpy array has the given number of dimensions and is a
valid data type.
Check that a numpy array has the given number of dimensions and is a valid data
type.
Parameters
----------
Expand Down
4 changes: 2 additions & 2 deletions pygmt/datasets/earth_age.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Function to download the Earth seafloor crustal age dataset from the GMT data
server, and load as :class:`xarray.DataArray`.
Function to download the Earth seafloor crustal age dataset from the GMT data server,
and load as :class:`xarray.DataArray`.
The grids are available in various resolutions.
"""
Expand Down
4 changes: 2 additions & 2 deletions pygmt/datasets/earth_free_air_anomaly.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Function to download the IGPP Earth Free-Air Anomaly dataset from the GMT data
server, and load as :class:`xarray.DataArray`.
Function to download the IGPP Earth Free-Air Anomaly dataset from the GMT data server,
and load as :class:`xarray.DataArray`.
The grids are available in various resolutions.
"""
Expand Down
4 changes: 2 additions & 2 deletions pygmt/datasets/earth_geoid.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Function to download the EGM2008 Earth Geoid dataset from the GMT data server,
and load as :class:`xarray.DataArray`.
Function to download the EGM2008 Earth Geoid dataset from the GMT data server, and load
as :class:`xarray.DataArray`.
The grids are available in various resolutions.
"""
Expand Down
4 changes: 2 additions & 2 deletions pygmt/datasets/earth_magnetic_anomaly.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Function to download the Earth magnetic anomaly datasets from the GMT data
server, and load as :class:`xarray.DataArray`.
Function to download the Earth magnetic anomaly datasets from the GMT data server, and
load as :class:`xarray.DataArray`.
The grids are available in various resolutions.
"""
Expand Down
4 changes: 2 additions & 2 deletions pygmt/datasets/earth_mask.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Function to download the GSHHG Earth Mask dataset from the GMT data server, and
load as :class:`xarray.DataArray`.
Function to download the GSHHG Earth Mask dataset from the GMT data server, and load as
:class:`xarray.DataArray`.
The grids are available in various resolutions.
"""
Expand Down
7 changes: 3 additions & 4 deletions pygmt/datasets/earth_relief.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Function to download the Earth relief datasets from the GMT data server, and
load as :class:`xarray.DataArray`.
Function to download the Earth relief datasets from the GMT data server, and load as
:class:`xarray.DataArray`.
The grids are available in various resolutions.
"""
Expand All @@ -22,8 +22,7 @@ def load_earth_relief(
use_srtm=False,
):
r"""
Load the Earth relief datasets (topography and bathymetry) in various
resolutions.
Load the Earth relief datasets (topography and bathymetry) in various resolutions.
.. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_gebco.jpg
:width: 80 %
Expand Down
7 changes: 3 additions & 4 deletions pygmt/datasets/earth_vertical_gravity_gradient.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Function to download the IGPP Earth Vertical Gravity Gradient dataset from the
GMT data server, and load as :class:`xarray.DataArray`.
Function to download the IGPP Earth Vertical Gravity Gradient dataset from the GMT data
server, and load as :class:`xarray.DataArray`.
The grids are available in various resolutions.
"""
Expand All @@ -19,8 +19,7 @@ def load_earth_vertical_gravity_gradient(
registration: Literal["gridline", "pixel", None] = None,
):
r"""
Load the IGPP Earth Vertical Gravity Gradient dataset in various
resolutions.
Load the IGPP Earth Vertical Gravity Gradient dataset in various resolutions.
.. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_vgg.jpg
:width: 80 %
Expand Down
4 changes: 2 additions & 2 deletions pygmt/datasets/load_remote_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

class Resolution(NamedTuple):
"""
The available grid registrations for a given resolution and whether it is a
tiled grid.
The available grid registrations for a given resolution and whether it is a tiled
grid.
Attributes
----------
Expand Down
11 changes: 5 additions & 6 deletions pygmt/datasets/samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ def _load_japan_quakes():

def _load_ocean_ridge_points():
"""
Load a table of ocean ridge points for the entire world as a
pandas.DataFrame.
Load a table of ocean ridge points for the entire world as a pandas.DataFrame.
Returns
-------
Expand Down Expand Up @@ -92,8 +91,8 @@ def _load_usgs_quakes():

def _load_fractures_compilation():
"""
Load a table of fracture lengths and azimuths as hypothetically digitized
from geological maps as a pandas.DataFrame.
Load a table of fracture lengths and azimuths as hypothetically digitized from
geological maps as a pandas.DataFrame.
Returns
-------
Expand All @@ -108,8 +107,8 @@ def _load_fractures_compilation():

def _load_hotspots():
"""
Load a table with the locations, names, and suggested symbol sizes of
hotspots as a pandas.DataFrame.
Load a table with the locations, names, and suggested symbol sizes of hotspots as a
pandas.DataFrame.
The data are from Mueller, Royer, and Lawver, 1993, Geology, vol. 21,
pp. 275-278. The main 5 hotspots used by Doubrovine et al. [2012]
Expand Down
4 changes: 2 additions & 2 deletions pygmt/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ def _activate_figure(self):

def _preprocess(self, **kwargs):
"""
Call the ``figure`` module before each plotting command to ensure we're
plotting to this particular figure.
Call the ``figure`` module before each plotting command to ensure we're plotting
to this particular figure.
"""
self._activate_figure()
return kwargs
Expand Down
4 changes: 2 additions & 2 deletions pygmt/helpers/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,8 +829,8 @@ def deprecate_parameter(oldname, newname, deprecate_version, remove_version):

def deprecator(module_func):
"""
The decorator that creates the new function to work with both old and
new parameters.
The decorator that creates the new function to work with both old and new
parameters.
"""

@functools.wraps(module_func)
Expand Down
8 changes: 3 additions & 5 deletions pygmt/helpers/tempfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,8 @@ def loadtxt(self, **kwargs):
@contextmanager
def tempfile_from_geojson(geojson):
"""
Saves any geo-like Python object which implements ``__geo_interface__``
(e.g. a geopandas.GeoDataFrame or shapely.geometry) to a temporary OGR_GMT
text file.
Saves any geo-like Python object which implements ``__geo_interface__`` (e.g. a
geopandas.GeoDataFrame or shapely.geometry) to a temporary OGR_GMT text file.
Parameters
----------
Expand Down Expand Up @@ -165,8 +164,7 @@ def tempfile_from_geojson(geojson):
@contextmanager
def tempfile_from_image(image):
"""
Saves a 3-band :class:`xarray.DataArray` to a temporary GeoTIFF file via
rioxarray.
Saves a 3-band :class:`xarray.DataArray` to a temporary GeoTIFF file via rioxarray.
Parameters
----------
Expand Down
7 changes: 3 additions & 4 deletions pygmt/helpers/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ def wrapper(*args, ext="png", request=None, **kwargs):

def download_test_data():
"""
Convenience function to download remote data files used in PyGMT tests and
docs.
Convenience function to download remote data files used in PyGMT tests and docs.
"""
# List of datasets to download
datasets = [
Expand Down Expand Up @@ -241,8 +240,8 @@ def load_static_earth_relief():

def skip_if_no(package):
"""
Generic function to help skip tests when required packages are not present
on the testing system.
Generic function to help skip tests when required packages are not present on the
testing system.
This function returns a pytest mark with a skip condition that will be
evaluated during test collection. An attempt will be made to import the
Expand Down
7 changes: 3 additions & 4 deletions pygmt/helpers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,7 @@ def non_ascii_to_octal(argstr):

def build_arg_string(kwdict, confdict=None, infile=None, outfile=None):
r"""
Convert keyword dictionaries and input/output files into a GMT argument
string.
Convert keyword dictionaries and input/output files into a GMT argument string.
Make sure all values in ``kwdict`` have been previously converted to a
string representation using the ``kwargs_to_strings`` decorator. The only
Expand Down Expand Up @@ -513,8 +512,8 @@ def launch_external_viewer(fname, waiting=0):

def args_in_kwargs(args, kwargs):
"""
Take a list and a dictionary, and determine if any entries in the list are
keys in the dictionary.
Take a list and a dictionary, and determine if any entries in the list are keys in
the dictionary.
This function is used to determine if at least one of the required
arguments is passed to raise a GMTInvalidInput Error.
Expand Down
4 changes: 2 additions & 2 deletions pygmt/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

def load_dataarray(filename_or_obj, **kwargs):
"""
Open, load into memory, and close a DataArray from a file or file-like
object containing a single data variable.
Open, load into memory, and close a DataArray from a file or file-like object
containing a single data variable.
This is a thin wrapper around :py:func:`xarray.open_dataarray`. It differs
from :py:func:`xarray.open_dataarray` in that it loads the DataArray into
Expand Down
3 changes: 1 addition & 2 deletions pygmt/sphinx_gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ class PyGMTScraper:

def __call__(self, block, block_vars, gallery_conf): # noqa: ARG002
"""
Called by sphinx-gallery to save the figures generated after running
code.
Called by sphinx-gallery to save the figures generated after running code.
"""
image_names = []
image_path_iterator = block_vars["image_path_iterator"]
Expand Down
3 changes: 1 addition & 2 deletions pygmt/src/sphdistance.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
@kwargs_to_strings(I="sequence", R="sequence")
def sphdistance(data=None, x=None, y=None, **kwargs):
r"""
Create Voronoi distance, node, or natural nearest-neighbor grid on a
sphere.
Create Voronoi distance, node, or natural nearest-neighbor grid on a sphere.
Reads a table containing *lon, lat* columns and performs
the construction of Voronoi polygons. These polygons are
Expand Down
6 changes: 2 additions & 4 deletions pygmt/src/triangulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

class triangulate: # noqa: N801
"""
Delaunay triangulation or Voronoi partitioning and gridding of Cartesian
data.
Delaunay triangulation or Voronoi partitioning and gridding of Cartesian data.
Triangulate reads in x,y[,z] data and performs Delaunay triangulation,
i.e., it finds how the points should be connected to give the most
Expand Down Expand Up @@ -69,8 +68,7 @@ def _triangulate(
data=None, x=None, y=None, z=None, *, output_type, outfile=None, **kwargs
):
"""
Delaunay triangulation or Voronoi partitioning and gridding of
Cartesian data.
Delaunay triangulation or Voronoi partitioning and gridding of Cartesian data.
Must provide ``outfile`` or ``outgrid``.
Expand Down
Loading

0 comments on commit da36673

Please sign in to comment.