Skip to content

Commit 2cd277e

Browse files
committed
Merge branch 'main' into docformatter-1.7.0
2 parents fb065b6 + a4f7b53 commit 2cd277e

20 files changed

+169
-202
lines changed

.github/workflows/check-links.yml

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

3434
- name: Link Checker
3535
id: lychee
36-
uses: lycheeverse/lychee-action@v1.7.0
36+
uses: lycheeverse/lychee-action@v1.8.0
3737
with:
3838
# 429: Too many requests
3939
args: >

.github/workflows/ci_docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
netCDF4
8686
packaging
8787
contextily
88-
geopandas
88+
geopandas!=0.13.0
8989
ipython
9090
rioxarray
9191
build

.github/workflows/ci_tests.yaml

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

165165
# Upload coverage to Codecov
166166
- name: Upload coverage to Codecov
167-
uses: codecov/[email protected].3
167+
uses: codecov/[email protected].4
168168
with:
169169
file: ./coverage.xml # optional
170170
env_vars: OS,PYTHON,NUMPY

.github/workflows/dvc-diff.yml

Lines changed: 31 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,16 @@ jobs:
2727
fetch-depth: 0
2828

2929
- name: Setup data version control (DVC)
30-
uses: iterative/[email protected].1
30+
uses: iterative/[email protected].2
3131

3232
- name: Setup continuous machine learning (CML)
3333
uses: iterative/[email protected]
3434

35-
- name: Pull image data from cloud storage
36-
run: dvc pull --remote upstream
35+
# workaround from https://github.com/iterative/cml/issues/1377
36+
- name: Setup NodeJS
37+
uses: actions/[email protected]
38+
with:
39+
node-version: '16'
3740

3841
# Produce the markdown diff report, which should look like:
3942
# ## Summary of changed images
@@ -45,80 +48,59 @@ jobs:
4548
# | added | pygmt/tests/baseline/test_image.png |
4649
# | deleted | pygmt/tests/baseline/test_image2.png |
4750
# | modified | pygmt/tests/baseline/test_image3.png |
51+
#
52+
# ## Image diff(s)
53+
#
54+
# <details>
55+
# ...
56+
# </details>
57+
#
58+
# Report last updated at commit abcdef
4859
- name: Generate the image diff report
4960
env:
5061
repo_token: ${{ secrets.GITHUB_TOKEN }}
51-
id: image-diff
5262
run: |
5363
echo -e "## Summary of changed images\n" > report.md
5464
echo -e "This is an auto-generated report of images that have changed on the DVC remote\n" >> report.md
65+
66+
# Pull image data from cloud storage
67+
dvc pull --remote upstream
5568
dvc diff --show-md main HEAD >> report.md
5669
5770
# Get just the filename of the added and modified image from the report
5871
awk 'NF==5 && NR>=7 && $2=="added" {print $4}' report.md > added_files.txt
5972
awk 'NF==5 && NR>=7 && $2=="modified" {print $4}' report.md > modified_files.txt
6073
74+
# Backup new images in the baseline-new directory
75+
mkdir pygmt/tests/baseline-new
76+
cp pygmt/tests/baseline/*.png pygmt/tests/baseline-new/
77+
# Pull images in the main branch from cloud storage
78+
git checkout main
79+
dvc pull --remote upstream
80+
6181
# Append each image to the markdown report
6282
echo -e "## Image diff(s)\n" >> report.md
6383
echo -e "<details>\n" >> report.md
6484
6585
# Added images
6686
echo -e "### Added images\n" >> report.md
6787
while IFS= read -r line; do
68-
echo -e "- $line \n" >> report.md
69-
cml-publish --title $line --md "$line" >> report.md < /dev/null
88+
echo -e "- $(basename $line) \n" >> report.md
89+
echo -e "![](${line/baseline/baseline-new})" >> report.md
7090
done < added_files.txt
7191
7292
# Modified images
7393
echo -e "### Modified images\n" >> report.md
74-
# Upload new images
75-
while IFS= read -r line; do
76-
cml-publish --title $line --md "$line" >> modified_images_new.md < /dev/null
77-
done < modified_files.txt
78-
79-
# Pull images in the main branch from cloud storage
80-
git checkout main
81-
dvc pull --remote upstream
82-
# Upload old images
83-
while IFS= read -r line; do
84-
cml-publish --title $line --md "$line" >> modified_images_old.md < /dev/null
85-
done < modified_files.txt
86-
87-
# Append image report for modified images
8894
echo -e "| Path | Old | New |" >> report.md
8995
echo -e "|---|---|---|" >> report.md
90-
paste modified_files.txt modified_images_old.md modified_images_new.md -d"|" |
91-
awk -F"|" 'function basename(file) {sub(".*/", "", file); return file} {printf("| %s | %s | %s |\n", basename($1), $2, $3)}' >> report.md
96+
while IFS= read -r line; do
97+
echo -e "| $(basename $line) | ![]($line) | ![](${line/baseline/baseline-new}) |" >> report.md
98+
done < modified_files.txt
9299
93100
echo -e "</details>\n" >> report.md
94101
95102
# Mention git commit SHA in the report
96103
echo -e "Report last updated at commit ${{ github.event.pull_request.head.sha }}" >> report.md
97104
98-
# Save the report content to the output parameter 'report'
99-
echo 'report<<EOF' >> $GITHUB_OUTPUT
100-
cat report.md >> $GITHUB_OUTPUT
101-
echo 'EOF' >> $GITHUB_OUTPUT
102-
103-
- name: Find comment with image diff report
104-
uses: peter-evans/[email protected]
105-
id: fc
106-
with:
107-
issue-number: ${{ github.event.pull_request.number }}
108-
comment-author: 'github-actions[bot]'
109-
body-includes: 'This is an auto-generated report of images that have changed on the DVC remote'
110-
111-
- name: Create comment with image diff report
112-
if: steps.fc.outputs.comment-id == ''
113-
uses: peter-evans/[email protected]
114-
with:
115-
issue-number: ${{ github.event.pull_request.number }}
116-
body: ${{ steps.image-diff.outputs.report }}
117-
118-
- name: Update comment with new image diff report
119-
if: steps.fc.outputs.comment-id != ''
120-
uses: peter-evans/[email protected]
121-
with:
122-
comment-id: ${{ steps.fc.outputs.comment-id }}
123-
body: ${{ steps.image-diff.outputs.report }}
124-
edit-mode: replace
105+
# create/update PR comment
106+
cml comment update report.md

.github/workflows/format-command.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
ref: ${{ github.event.client_payload.pull_request.head.ref }}
2626

2727
# Setup Python environment
28-
- uses: actions/[email protected].0
28+
- uses: actions/[email protected].1
2929
with:
3030
python-version: '3.11'
3131

.github/workflows/publish-to-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
fetch-depth: 0
4545

4646
- name: Set up Python
47-
uses: actions/[email protected].0
47+
uses: actions/[email protected].1
4848
with:
4949
python-version: '3.11'
5050

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

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

2424
- name: Setup data version control (DVC)
25-
uses: iterative/[email protected].1
25+
uses: iterative/[email protected].2
2626

2727
- name: Pull baseline image data from dvc remote
2828
run: |

.github/workflows/style_checks.yaml

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

2929
# Setup Python
3030
- name: Set up Python
31-
uses: actions/[email protected].0
31+
uses: actions/[email protected].1
3232
with:
3333
python-version: '3.11'
3434

ci/requirements/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies:
1212
- packaging
1313
# Optional dependencies
1414
- contextily
15-
- geopandas
15+
- geopandas!=0.13.0
1616
- ipython
1717
- rioxarray
1818
# Development dependencies (general)

doc/contributing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ the problem:
6262
filter the messages to include only the GMT-equivalent commands using a command
6363
such as:
6464

65-
python <test>.py 2>&1 | awk -F': ' '$2=="GMT_Call_Command string" {print "gmt", $3}'
65+
python <test>.py 2>&1 | awk -F': ' '$2=="GMT_Call_Command string" {print $3}'
6666

67-
where `<test>` is the name of your test script.
67+
where `<test>` is the name of your test script. Note that this script works only with GMT>=6.4
6868
* If the bug is produced when passing an in-memory data object (e.g., a
6969
pandas.DataFrame or xarray.DataArray) to a PyGMT function, try writing the
7070
data to a file (e.g., a NetCDF or ASCII txt file) and passing the data file

examples/gallery/lines/vector_heads_tails.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@
1212
one at the end). Optionally, append **t** for a terminal line, **c** for a
1313
circle, **a** for arrow (default), **i** for tail, **A** for plain open
1414
arrow, and **I** for plain open tail. Further append **l** or **r** (e.g.
15-
``+bar``) to only draw the left or right half-sides of the selected head/tail
15+
``"+bar"``) to only draw the left or right half-sides of the selected head/tail
1616
(default is both sides) or use **+l** or **+r** to apply simultaneously to both
17-
sides. In this context left and right refer to the side of the vector line
18-
when viewed from the beginning point to the end point of a line segment.
19-
The angle of the vector head apex can be set using **+a**\ *angle*
17+
beginning and end. In this context left and right refer to the side of the
18+
vector line when viewed from the beginning point to the end point of a line
19+
segment. The angle of the vector head apex can be set using **+a**\ *angle*
2020
(default is 30). The shape of the vector head can be adjusted using
21-
**+h**\ *shape* (e.g. ``+h0.5``).
21+
**+h**\ *shape* (e.g. ``"+h0.5"``).
2222
2323
For further modifiers see :gmt-docs:`plot.html#vector-attributes`.
2424
2525
In the following we use the :meth:`pygmt.Figure.plot` method to plot vectors
2626
with individual heads and tails. We must specify the modifiers (together with
27-
the vector type, here ``v``, see also
28-
:doc:`Vector types documentation </gallery/lines/vector_styles>`)
27+
the vector type, here ``"v"`` for Cartesian vector, see also
28+
:doc:`Vector types example </gallery/lines/vector_styles>`)
2929
by passing the corresponding shortcuts to the ``style`` parameter.
3030
3131
"""

examples/gallery/lines/vector_styles.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
The :meth:`pygmt.Figure.plot` method can plot Cartesian, circular, and
66
geographic vectors. The ``style`` parameter controls vector attributes.
77
See also
8-
:doc:`Vector attributes documentation </gallery/lines/vector_heads_tails>`.
8+
:doc:`Vector attributes example </gallery/lines/vector_heads_tails>`.
99
1010
"""
1111
import numpy as np
@@ -28,7 +28,7 @@
2828
y = np.linspace(33.5, 42.5, 12) # y vector coordinates
2929
direction = np.zeros(x.shape) # direction of vectors
3030
length = np.linspace(0.5, 2.4, 12) # length of vectors
31-
# Cartesian vectors (v) with red pen and fill (+g, +p), vector head at
31+
# Cartesian vectors (v) with red fill and pen (+g, +p), vector head at
3232
# end (+e), and 40 degree angle (+a) with no indentation for vector head (+h)
3333
style = "v0.2c+e+a40+gred+h0+p1p,red"
3434
fig.plot(x=x, y=y, style=style, pen="1p,red", direction=[direction, length])

examples/projections/misc/misc_robinson.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,23 @@
66
Arthur H. Robinson in 1963, is a modified cylindrical projection that is
77
neither conformal nor equal-area. Central meridian and all parallels are
88
straight lines; other meridians are curved. It uses lookup tables rather than
9-
analytic expressions to make the world map "look" right 22. The scale is true
10-
along latitudes 38. The projection was originally developed for use by Rand
11-
McNally and is currently used by the National Geographic Society.
9+
analytic expressions to make the world map "look" right [#f1]_.
10+
The scale is true along latitudes 38° north and south. The projection was
11+
originally developed for use by Rand McNally and is currently used by the
12+
National Geographic Society.
1213
1314
**n**\ [*lon0/*]\ *scale* or **N**\ [*lon0/*]\ *width*
1415
1516
The projection is set with **n** or **N**. The central meridian is set with the
1617
optional *lon0*, and the figure size is set with *scale* or *width*.
18+
19+
.. rubric:: Footnotes
20+
21+
.. [#f1] Robinson provided a table of y-coordinates for latitudes every 5°.
22+
To project values for intermediate latitudes one must interpolate
23+
the table. Different interpolants may result in slightly different
24+
maps. GMT uses the interpolant selected by the parameter
25+
:gmt-term:`GMT_INTERPOLANT` in the gmt.conf file.
1726
"""
1827
import pygmt
1928

pygmt/src/meca.py

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,13 @@ def data_format_code(convention, component="full"):
7979
B="frame",
8080
C="cmap",
8181
E="extensionfill",
82+
Fr="labelbox",
8283
G="compressionfill",
8384
J="projection",
85+
L="outline",
8486
N="no_clip",
8587
R="region",
88+
T="nodal",
8689
V="verbose",
8790
W="pen",
8891
c="panel",
@@ -124,7 +127,7 @@ def meca(
124127
- Columns 1 and 2: event longitude and latitude
125128
- Column 3: event depth (in km)
126129
- Columns 4 to 3+n: focal mechanism parameters. The number of columns
127-
*n* depends on the choice of ``convection``, which will be
130+
*n* depends on the choice of ``convention``, which will be
128131
described below.
129132
- Columns 4+n and 5+n: longitude, latitude at which to place
130133
beachball. Using ``0 0`` will plot the beachball at the longitude,
@@ -204,32 +207,61 @@ def meca(
204207
event_name : str or list of str, or 1-D numpy array
205208
Text string(s), e.g., event name(s) to appear near the beachball(s).
206209
List must be the same length as the number of events. Will override
207-
the ``event_name`` values in ``spec`` if ``spec`` is a dictionary
210+
the ``event_name`` labels in ``spec`` if ``spec`` is a dictionary
208211
or pd.DataFrame.
212+
labelbox : bool or str
213+
[*fill*].
214+
Draw a box behind the label if given. Use *fill* to give a fill color
215+
[Default is ``"white"``].
209216
offset : bool or str
210217
[**+p**\ *pen*][**+s**\ *size*].
211218
Offset beachball(s) to longitude(s) and latitude(s) specified in the
212219
the last two columns of the input file or array, or by
213220
``plot_longitude`` and ``plot_latitude`` if provided. A small circle
214221
is plotted at the initial location and a line connects the beachball
215222
to the circle. Use **+s**\ *size* to set the diameter of the circle
216-
[Default is no circle]. Use **+p**\ *pen* to set the line pen
217-
attributes [Default is ``"0.25p"``].
223+
[Default is no circle]. Use **+p**\ *pen* to set the pen attributes
224+
for this feature [Default is set via ``pen``]. The fill of the
225+
circle is set via ``compressionfill`` or ``cmap``, i.e.,
226+
corresponds to the fill of the compressive quadrants.
218227
compressionfill : str
219228
Set color or pattern for filling compressive quadrants
220-
[Default is ``"black"``].
229+
[Default is ``"black"``]. This setting also applies to the fill of
230+
the circle defined via ``offset``.
221231
extensionfill : str
222232
Set color or pattern for filling extensive quadrants
223233
[Default is ``"white"``].
224234
pen : str
225-
Set pen attributes for outline of beachball
226-
[Default is ``"0.25p,black,solid"``].
235+
Set pen attributes for all lines related to beachball [Default is
236+
``"0.25p,black,solid"``]. This setting applies to ``outline``,
237+
``nodal``, and ``offset``, unless overruled by arguments passed to
238+
those parameters. Draws circumference of beachball.
239+
outline : bool or str
240+
[*pen*].
241+
Draw circumference and nodal planes of beachball. Use *pen* to set
242+
the pen attributes for this feature [Default is set via ``pen``].
243+
nodal : bool, int, or str
244+
[*nplane*][/*pen*].
245+
Plot the nodal planes and outline the bubble which is transparent.
246+
If *nplane* is
247+
248+
- ``0`` or ``True``: both nodal planes are plotted [Default].
249+
- ``1``: only the first nodal plane is plotted.
250+
- ``2``: only the second nodal plane is plotted.
251+
252+
Use /*pen* to set the pen attributes for this feature [Default is
253+
set via ``pen``].
254+
For double couple mechanisms, ``nodal`` renders the beachball
255+
transparent by drawing only the nodal planes and the circumference.
256+
For non-double couple mechanisms, ``nodal=0`` overlays best
257+
double couple transparently.
227258
cmap : str
228259
File name of a CPT file or a series of comma-separated colors (e.g.,
229260
*color1,color2,color3*) to build a linear continuous CPT from those
230261
colors automatically. The color of the compressive quadrants is
231262
determined by the z-value (i.e., event depth or the third column for
232-
an input file).
263+
an input file). This setting also applies to the fill of the circle
264+
defined via ``offset``.
233265
no_clip : bool
234266
Do **not** skip symbols that fall outside the frame boundaries
235267
[Default is ``False``, i.e., plot symbols inside the frame

pygmt/tests/baseline/test_meca_gcmt_convention.png.dvc

Lines changed: 0 additions & 4 deletions
This file was deleted.

pygmt/tests/baseline/test_meca_spec_1d_array.png.dvc

Lines changed: 0 additions & 4 deletions
This file was deleted.

pygmt/tests/baseline/test_meca_spec_dictionary.png.dvc

Lines changed: 0 additions & 4 deletions
This file was deleted.

pygmt/tests/baseline/test_meca_spec_file.png.dvc

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
outs:
2+
- md5: fc7c271049fc8583914b508c4bee08fe
3+
size: 9830
4+
path: test_meca_spec_single_focalmecha.png

0 commit comments

Comments
 (0)