Skip to content

Commit a239ac8

Browse files
authored
Merge branch 'main' into test-old-gmt-versions
2 parents efd3b3f + e8c75a4 commit a239ac8

20 files changed

+100
-80
lines changed

.github/workflows/ci_docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979

8080
# Download cached remote files (artifacts) from GitHub
8181
- name: Download remote data from GitHub
82-
uses: dawidd6/action-download-artifact@v2.22.0
82+
uses: dawidd6/action-download-artifact@v2.23.0
8383
with:
8484
workflow: cache_data.yaml
8585
workflow_conclusion: success

.github/workflows/ci_tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101

102102
# Download cached remote files (artifacts) from GitHub
103103
- name: Download remote data from GitHub
104-
uses: dawidd6/action-download-artifact@v2.22.0
104+
uses: dawidd6/action-download-artifact@v2.23.0
105105
with:
106106
workflow: cache_data.yaml
107107
workflow_conclusion: success

.github/workflows/ci_tests_dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ jobs:
131131

132132
# Download cached remote files (artifacts) from GitHub
133133
- name: Download remote data from GitHub
134-
uses: dawidd6/action-download-artifact@v2.22.0
134+
uses: dawidd6/action-download-artifact@v2.23.0
135135
with:
136136
workflow: cache_data.yaml
137137
workflow_conclusion: success

.github/workflows/dvc-diff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
fetch-depth: 0
2020

2121
- name: Setup data version control (DVC)
22-
uses: iterative/[email protected].3
22+
uses: iterative/[email protected].4
2323

2424
- name: Setup continuous machine learning (CML)
2525
uses: iterative/[email protected]

.github/workflows/release-baseline-images.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
uses: actions/[email protected]
2020

2121
- name: Setup data version control (DVC)
22-
uses: iterative/[email protected].3
22+
uses: iterative/[email protected].4
2323

2424
- name: Pull baseline image data from dvc remote
2525
run: |

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ version: 2
66

77
# Set the version of Python and other tools you might need
88
build:
9-
os: ubuntu-20.04
9+
os: ubuntu-22.04
1010
tools:
1111
python: "mambaforge-4.10"
1212
jobs:

Makefile

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ TESTDIR=tmp-test-dir-with-unique-name
44
PYTEST_COV_ARGS=--cov=$(PROJECT) --cov-config=../pyproject.toml \
55
--cov-report=term-missing --cov-report=xml --cov-report=html \
66
--pyargs ${PYTEST_EXTRA}
7-
BLACK_FILES=$(PROJECT) doc/conf.py examples
8-
BLACKDOC_OPTIONS=--line-length 79
9-
DOCFORMATTER_FILES=$(PROJECT) doc/conf.py examples
10-
DOCFORMATTER_OPTIONS=--recursive --pre-summary-newline --make-summary-multi-line --wrap-summaries 79 --wrap-descriptions 79
11-
FLAKEHEAVEN_FILES=$(PROJECT) doc/conf.py examples
7+
FORMAT_FILES=$(PROJECT) doc/conf.py examples
128
LINT_FILES=$(PROJECT) doc/conf.py
139

1410
help:
@@ -70,16 +66,16 @@ test_no_images:
7066

7167
format:
7268
isort .
73-
docformatter --in-place $(DOCFORMATTER_OPTIONS) $(DOCFORMATTER_FILES)
74-
black $(BLACK_FILES)
75-
blackdoc $(BLACKDOC_OPTIONS) $(BLACK_FILES)
69+
docformatter --in-place $(FORMAT_FILES)
70+
black $(FORMAT_FILES)
71+
blackdoc $(FORMAT_FILES)
7672

7773
check:
7874
isort . --check
79-
docformatter --check $(DOCFORMATTER_OPTIONS) $(DOCFORMATTER_FILES)
80-
black --check $(BLACK_FILES)
81-
blackdoc --check $(BLACKDOC_OPTIONS) $(BLACK_FILES)
82-
FLAKEHEAVEN_CACHE_TIMEOUT=0 flakeheaven lint $(FLAKEHEAVEN_FILES)
75+
docformatter --check $(FORMAT_FILES)
76+
black --check $(FORMAT_FILES)
77+
blackdoc --check $(FORMAT_FILES)
78+
FLAKEHEAVEN_CACHE_TIMEOUT=0 flakeheaven lint $(FORMAT_FILES)
8379

8480
lint:
8581
pylint $(LINT_FILES)

doc/contributing.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,14 @@ Guidelines for a good tutorial:
392392
concise examples while the tutorials are detailed and full of text.
393393
* SI units should be used in the example code for tutorial plots.
394394

395-
Note that the `Figure.show()` method needs to be called for a plot to be inserted into
396-
the documentation.
395+
Note that the <code>pygmt.Figure.show</code> method needs to be called for a plot
396+
to be inserted into the documentation.
397+
397398

398399
### Editing the API Documentation
399400

400401
The API documentation is built from the docstrings in the Python `*.py` files under
401-
the `pygmt/src/` and `/pygmt/datasets/` folders. **All docstrings** should follow the
402+
the `pygmt/src/` and `pygmt/datasets/` folders. **All docstrings** should follow the
402403
[NumPy style guide](https://numpydoc.readthedocs.io/en/latest/format.html#docstring-standard).
403404
All functions/classes/methods should have docstrings with a full description of all
404405
arguments and return values.
@@ -524,9 +525,9 @@ Tests also help us be confident that we won't break your code in the future.
524525

525526
When writing tests, don't test everything that the GMT function already tests, such as
526527
the every unique combination arguments. An exception to this would be the most popular
527-
methods, such as `plot` and `basemap`. The highest priority for tests should be the
528-
Python-specific code, such as numpy, pandas, and xarray objects and the virtualfile
529-
mechanism.
528+
methods, such as <code>pygmt.Figure.plot</code> and <code>pygmt.Figure.basemap</code>.
529+
The highest priority for tests should be the Python-specific code, such as numpy,
530+
pandas, and xarray objects and the virtualfile mechanism.
530531

531532
If you're **new to testing**, see existing test files for examples of things to do.
532533
**Don't let the tests keep you from submitting your contribution!**

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dependencies:
2222
# Dev dependencies (style checks)
2323
- black
2424
- blackdoc
25-
- docformatter
25+
- docformatter>=1.5.0
2626
- flakeheaven>=3
2727
- isort>=5
2828
- pylint

examples/gallery/maps/land_and_water.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
The ``land`` and ``water`` parameters of :meth:`pygmt.Figure.coast` specify
66
a color to fill in the land and water masses, respectively. There are many
77
:gmt-docs:`color codes in GMT <gmtcolors.html>`, including standard GMT color
8-
names (like ``skyblue``), R/G/B levels (like ``0/0/255``), a hex value (like
9-
``#333333``), and a graylevel (like ``50``).
8+
names (like ``"skyblue"``), R/G/B levels (like ``"0/0/255"``), a hex value
9+
(like ``"#333333"``), and a gray level (like ``"gray50"``).
1010
"""
1111
import pygmt
1212

pygmt/figure.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def psconvert(self, icc_gray=False, **kwargs):
147147
148148
If no input files are given, will convert the current active figure
149149
(see :class:`pygmt.Figure`). In this case, an output name must be given
150-
using parameter *prefix*.
150+
using parameter ``prefix``.
151151
152152
Full option list at :gmt-docs:`psconvert.html`
153153
@@ -289,6 +289,10 @@ def savefig(
289289
dpi : int
290290
Set raster resolution in dpi. Default is 720 for PDF, 300 for
291291
others.
292+
**kwargs : dict
293+
Additional keyword arguments passed to
294+
:meth:`pygmt.Figure.psconvert`. Valid parameters are ``gs_path``,
295+
``gs_option``, ``resize``, ``bb_style``, and ``verbose``.
292296
"""
293297
# All supported formats
294298
fmts = dict(png="g", pdf="f", jpg="j", bmp="b", eps="e", tif="t", kml="g")
@@ -319,7 +323,7 @@ def savefig(
319323
if show:
320324
launch_external_viewer(fname)
321325

322-
def show(self, dpi=300, width=500, method=None, waiting=0.5):
326+
def show(self, dpi=300, width=500, method=None, waiting=0.5, **kwargs):
323327
"""
324328
Display a preview of the figure.
325329
@@ -361,6 +365,10 @@ def show(self, dpi=300, width=500, method=None, waiting=0.5):
361365
Suspend the execution of the current process for a given number of
362366
seconds after launching an external viewer.
363367
Only works if ``method="external"``.
368+
**kwargs : dict
369+
Additional keyword arguments passed to
370+
:meth:`pygmt.Figure.psconvert`. Valid parameters are ``gs_path``,
371+
``gs_option``, ``resize``, ``bb_style``, and ``verbose``.
364372
"""
365373
# Module level variable to know which figures had their show method
366374
# called. Needed for the sphinx-gallery scraper.
@@ -387,11 +395,15 @@ def show(self, dpi=300, width=500, method=None, waiting=0.5):
387395
"or run the script in a Jupyter notebook."
388396
)
389397
)
390-
png = self._preview(fmt="png", dpi=dpi, anti_alias=True, as_bytes=True)
398+
png = self._preview(
399+
fmt="png", dpi=dpi, anti_alias=True, as_bytes=True, **kwargs
400+
)
391401
IPython.display.display(IPython.display.Image(data=png, width=width))
392402

393403
if method == "external":
394-
pdf = self._preview(fmt="pdf", dpi=dpi, anti_alias=False, as_bytes=False)
404+
pdf = self._preview(
405+
fmt="pdf", dpi=dpi, anti_alias=False, as_bytes=False, **kwargs
406+
)
395407
launch_external_viewer(pdf, waiting=waiting)
396408

397409
def shift_origin(self, xshift=None, yshift=None):

pygmt/src/dimfilter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ def dimfilter(grid, **kwargs):
4040
subregion of the input and/or with a new increment using ``spacing``,
4141
which may add an "extra space" in the input data to prevent edge
4242
effects for the output grid. If the filter is low-pass, then the output
43-
may be less frequently sampled than the input. **dimfilter** will not
44-
produce a smooth output as other spatial filters
43+
may be less frequently sampled than the input. :func:`pygmt.dimfilter`
44+
will not produce a smooth output as other spatial filters
4545
do because it returns a minimum median out of *N* medians of *N*
4646
sectors. The output can be rough unless the input data is noise-free.
4747
Thus, an additional filtering (e.g., Gaussian via :func:`pygmt.grdfilter`)

pygmt/src/grd2cpt.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@ def grd2cpt(grid, **kwargs):
5656
If the master CPT includes B, F, and N entries, these will be copied into
5757
the new master file. If not, the parameters :gmt-term:`COLOR_BACKGROUND`,
5858
:gmt-term:`COLOR_FOREGROUND`, and :gmt-term:`COLOR_NAN` from the
59-
:gmt-docs:`gmt.conf <gmt.conf>` file or the command line will be used. This
60-
default behavior can be overruled using the options ``background``,
61-
``overrule_bg`` or ``no_bg``.
59+
:gmt-docs:`gmt.conf <gmt.conf>` file will be used. This default behavior
60+
can be overruled using the parameters ``background``, ``overrule_bg``
61+
or ``no_bg``.
6262
6363
The color model (RGB, HSV or CMYK) of the palette created by
6464
:func:`pygmt.grd2cpt` will be the same as specified in the header of the
6565
master CPT. When there is no :gmt-term:`COLOR_MODEL` entry in the master
6666
CPT, the :gmt-term:`COLOR_MODEL` specified in the
67-
:gmt-docs:`gmt.conf <gmt.conf>` file or the ``color_model`` option will be
68-
used.
67+
:gmt-docs:`gmt.conf <gmt.conf>` file or the ``color_model`` parameter
68+
will be used.
6969
7070
Full option list at :gmt-docs:`grd2cpt.html`
7171
@@ -77,8 +77,8 @@ def grd2cpt(grid, **kwargs):
7777
The file name of the input grid or the grid loaded as a DataArray.
7878
transparency : int or float or str
7979
Sets a constant level of transparency (0-100) for all color slices.
80-
Append **+a** to also affect the fore-, back-, and nan-colors
81-
[Default is no transparency, i.e., 0 (opaque)].
80+
Append **+a** to also affect the foreground, background, and NaN
81+
colors [Default is no transparency, i.e., 0 (opaque)].
8282
cmap : str
8383
Selects the master color palette table (CPT) to use in the
8484
interpolation. Full list of built-in color palette tables can be found
@@ -124,7 +124,7 @@ def grd2cpt(grid, **kwargs):
124124
also :gmt-docs:`cookbook/features.html#manipulating-cpts`.
125125
output : str
126126
Optional parameter to set the file name with extension .cpt to store
127-
the generated CPT file. If not given or False (default), saves the CPT
127+
the generated CPT file. If not given or False (Default), saves the CPT
128128
as the session current CPT.
129129
reverse : str
130130
Set this to True or c [Default] to reverse the sense of color
@@ -137,8 +137,8 @@ def grd2cpt(grid, **kwargs):
137137
Overrule background, foreground, and NaN colors specified in the master
138138
CPT with the values of the parameters :gmt-term:`COLOR_BACKGROUND`,
139139
:gmt-term:`COLOR_FOREGROUND`, and :gmt-term:`COLOR_NAN` specified in
140-
the :gmt-docs:`gmt.conf <gmt.conf>` file or on the command line. When
141-
combined with ``background``, only :gmt-term:`COLOR_NAN` is considered.
140+
the :gmt-docs:`gmt.conf <gmt.conf>` file. When combined with
141+
``background``, only :gmt-term:`COLOR_NAN` is considered.
142142
no_bg : bool
143143
Do not write out the background, foreground, and NaN-color fields
144144
[Default will write them, i.e. ``no_bg=False``].

pygmt/src/grdgradient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def grdgradient(grid, **kwargs):
8484
[**m**\|\ **s**\|\ **p**]\ *azim/elev*\ [**+a**\ *ambient*][**+d**\
8585
*diffuse*][**+p**\ *specular*][**+s**\ *shine*].
8686
Compute Lambertian radiance appropriate to use with
87-
:doc:`pygmt.Figure.grdimage` and :doc:`pygmt.Figure.grdview`. The
87+
:meth:`pygmt.Figure.grdimage` and :meth:`pygmt.Figure.grdview`. The
8888
Lambertian Reflection assumes an ideal surface that reflects all the
8989
light that strikes it and the surface appears
9090
equally bright from all viewing directions. Here, *azim* and *elev* are

pygmt/src/grdimage.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ def grdimage(self, grid, **kwargs):
5050
instructions to derive intensities from the input data grid. Values outside
5151
this range will be clipped. Such intensity files can be created from the
5252
grid using :func:`pygmt.grdgradient` and, optionally, modified by
53-
``grdmath`` or ``grdhisteq``. If GMT is built with GDAL support, ``grid``
54-
can be an image file (geo-referenced or not). In this case the image can
55-
optionally be illuminated with the file provided via the ``shading``
56-
parameter. Here, if image has no coordinates then those of the intensity
57-
file will be used.
53+
:gmt-docs:`grdmath.html` or :class:`pygmt.grdhisteq`. If GMT is built
54+
with GDAL support, ``grid`` can be an image file (geo-referenced or not).
55+
In this case the image can optionally be illuminated with the file
56+
provided via the ``shading`` parameter. Here, if image has no coordinates
57+
then those of the intensity file will be used.
5858
5959
When using map projections, the grid is first resampled on a new
6060
rectangular grid with the same dimensions. Higher resolution images can

pygmt/src/makecpt.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ def makecpt(**kwargs):
4848
If the master CPT includes B, F, and N entries, these will be copied into
4949
the new master file. If not, the parameters :gmt-term:`COLOR_BACKGROUND`,
5050
:gmt-term:`COLOR_FOREGROUND`, and :gmt-term:`COLOR_NAN` from the
51-
:gmt-docs:`gmt.conf <gmt.conf>` file or the command line will be used. This
51+
:gmt-docs:`gmt.conf <gmt.conf>` file will be used. This
5252
default behavior can be overruled using the parameters ``background``,
5353
``overrule_bg`` or ``no_bg``.
5454
55-
The color model (RGB, HSV or CMYK) of the palette created by **makecpt**
56-
will be the same as specified in the header of the master CPT. When there
57-
is no :gmt-term:`COLOR_MODEL` entry in the master CPT, the
58-
:gmt-term:`COLOR_MODEL` specified in the :gmt-docs:`gmt.conf <gmt.conf>`
59-
file or on the command line will be used.
55+
The color model (RGB, HSV or CMYK) of the palette created by
56+
:func:`pygmt.makecpt` will be the same as specified in the header of the
57+
master CPT. When there is no :gmt-term:`COLOR_MODEL` entry in the
58+
master CPT, the :gmt-term:`COLOR_MODEL` specified in the
59+
:gmt-docs:`gmt.conf <gmt.conf>` file will be used.
6060
6161
Full option list at :gmt-docs:`makecpt.html`
6262
@@ -123,14 +123,14 @@ def makecpt(**kwargs):
123123
Overrule background, foreground, and NaN colors specified in the master
124124
CPT with the values of the parameters :gmt-term:`COLOR_BACKGROUND`,
125125
:gmt-term:`COLOR_FOREGROUND`, and :gmt-term:`COLOR_NAN` specified in
126-
the :gmt-docs:`gmt.conf <gmt.conf>` file or on the command line. When
127-
combined with **background**, only :gmt-term:`COLOR_NAN` is considered.
126+
the :gmt-docs:`gmt.conf <gmt.conf>` file. When combined with
127+
``background``, only :gmt-term:`COLOR_NAN` is considered.
128128
no_bg : bool
129129
Do not write out the background, foreground, and NaN-color fields
130130
[Default will write them, i.e. ``no_bg=False``].
131131
log : bool
132132
For logarithmic interpolation scheme with input given as logarithms.
133-
Expects input z-values provided via **series** to be log10(*z*),
133+
Expects input z-values provided via ``series`` to be log10(*z*),
134134
assigns colors, and writes out *z*.
135135
continuous : bool
136136
Force a continuous CPT when building from a list of colors and a list

pygmt/src/meca.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def meca(
204204
``event_name`` values in ``spec`` if ``spec`` is a dict or
205205
pd.DataFrame.
206206
offset: bool or str
207-
[**+p**\ *pen*][**+s**\ *size].
207+
[**+p**\ *pen*][**+s**\ *size*].
208208
Offsets beachballs to the longitude, latitude specified in the last two
209209
columns of the input file or array, or by ``plot_longitude`` and
210210
``plot_latitude`` if provided. A small circle is plotted at the initial

0 commit comments

Comments
 (0)