Skip to content

Commit 4aa75f5

Browse files
committed
Merge remote-tracking branch 'origin/test-grdimage-dvc' into test-grdimage-dvc
2 parents 49ffd0e + 8b6b317 commit 4aa75f5

19 files changed

+77
-65
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,12 @@ When editing documentation, use the following standards to demonstrate the examp
181181

182182
1. Python arguments, such as import statements, Boolean expressions, and function
183183
arguments should be wrapped as ``code`` by using \`\` on both sides of the code.
184-
Example: \`\`import pygmt\`\` results in ``import pygmt``.
184+
Examples: \`\`import pygmt\`\` results in ``import pygmt``, \`\`True\`\` results in `True`,
185+
\`\`style="v"\`\` results in `style="v"`.
185186
2. Literal GMT arguments should be **bold** by wrapping the arguments with \*\*
186187
(two asterisks) on both sides. The argument description should be in *italicized*
187188
with \* (single asterisk) on both sides.
188-
Example: `**+l**\ *label*` results in **+l***label*.
189+
Examples: `**+l**\ *label*` results in **+l***label*, `**05m**` results in **05m**.
189190
3. Optional arguments are placed wrapped with [ ] (square brackets).
190191
4. Arguments that are mutually exclusive are separated with a | (bar) to denote "or".
191192

pygmt/tests/baseline/test_config.png

-50.9 KB
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
outs:
2+
- md5: e473079025646ea07e44493f6ab396da
3+
size: 33464
4+
path: test_config.png
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
outs:
2+
- md5: e1a3887151ea389de97f177c19488c5e
3+
size: 80854
4+
path: test_config_font_annot.png
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
outs:
2+
- md5: b011328f9e88799e3af073da4f2b3835
3+
size: 97085
4+
path: test_config_font_one.png
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
outs:
2+
- md5: 3d1d843c5150f2f775fdb9382284fa31
3+
size: 10906
4+
path: test_config_format_time_map.png
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
outs:
2+
- md5: 40a89f9014ac054f5f196ace06a00361
3+
size: 9389
4+
path: test_config_map_annot_offset.png
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
outs:
2+
- md5: cedcf979e9d25129babae0fbeeeecfbc
3+
size: 17539
4+
path: test_config_map_grid_cross_size.png
-16.8 KB
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
outs:
2+
- md5: 04de12d91ce2f48ad0b09061077f9780
3+
size: 17179
4+
path: test_config_map_grid_pen.png
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
outs:
2+
- md5: d97081684520b6a91221d25f71942cc9
3+
size: 16855
4+
path: test_config_map_tick_length.png
-16.9 KB
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
outs:
2+
- md5: 95a1755035175e331efc7508d9e8e3eb
3+
size: 17321
4+
path: test_config_map_tick_pen.png

pygmt/tests/test_config.py

Lines changed: 35 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
"""
2-
Tests for gmt config.
2+
Tests for pygmt.config.
33
"""
44
import pytest
55
from pygmt import Figure, config
6-
from pygmt.helpers.testing import check_figures_equal
76

87

98
@pytest.mark.mpl_image_compare
@@ -15,83 +14,61 @@ def test_config():
1514
# Change global settings of current figure
1615
config(FONT_ANNOT_PRIMARY="blue")
1716
fig.basemap(
18-
region="0/10/0/10", projection="X10c/10c", frame=["af", '+t"Blue Annotation"']
17+
region=[0, 10, 0, 10], projection="X5c/5c", frame=["af", '+t"Blue Annotation"']
1918
)
2019

2120
with config(FONT_LABEL="red", FONT_ANNOT_PRIMARY="red"):
2221
fig.basemap(
23-
region="0/10/0/10",
24-
projection="X10c/10c",
22+
region=[0, 10, 0, 10],
23+
projection="X5c/5c",
2524
frame=['xaf+l"red label"', "yaf", '+t"red annotation"'],
26-
X="15c",
25+
xshift="7c",
2726
)
2827

2928
fig.basemap(
30-
region="0/10/0/10",
31-
projection="X10c/10c",
29+
region=[0, 10, 0, 10],
30+
projection="X5c/5c",
3231
frame=["af", '+t"Blue Annotation"'],
33-
X="15c",
32+
xshift="7c",
3433
)
3534
# Revert to default settings in current figure
3635
config(FONT_ANNOT_PRIMARY="black")
3736
return fig
3837

3938

40-
@check_figures_equal()
39+
@pytest.mark.mpl_image_compare
4140
def test_config_font_one():
4241
"""
43-
Test that setting `FONT` config changes all `FONT_*` settings except
44-
`FONT_LOGO`.
42+
Test that setting FONT config changes all FONT_* settings except FONT_LOGO.
4543
46-
Specifically, this test only checks that `FONT_ANNOT_PRIMARY`,
47-
`FONT_ANNOT_SECONDARY`, `FONT_LABEL`, and `FONT_TITLE` are modified.
44+
Specifically, this test only checks that FONT_ANNOT_PRIMARY,
45+
FONT_ANNOT_SECONDARY, FONT_LABEL, and FONT_TITLE are modified.
4846
"""
49-
fig_ref = Figure()
50-
with config(
51-
FONT_ANNOT_PRIMARY="8p,red",
52-
FONT_ANNOT_SECONDARY="8p,red",
53-
FONT_LABEL="8p,red",
54-
FONT_TITLE="8p,red",
55-
):
56-
fig_ref.basemap(R="0/9/0/9", J="C3/3/9c", Tm="jTL+w4c+d4.5+l")
57-
fig_ref.basemap(Tm="jBR+w5c+d-4.5+l")
58-
59-
fig_test = Figure()
47+
fig = Figure()
6048
with config(FONT="8p,red"):
61-
fig_test.basemap(
62-
region=[0, 9, 0, 9], projection="C3/3/9c", compass="jTL+w4c+d4.5+l"
63-
)
64-
fig_test.basemap(compass="jBR+w5c+d-4.5+l")
65-
66-
return fig_ref, fig_test
49+
fig.basemap(region=[0, 9, 0, 9], projection="C3/3/9c", compass="jTL+w4c+d4.5+l")
50+
fig.basemap(compass="jBR+w5c+d-4.5+l")
51+
return fig
6752

6853

69-
@check_figures_equal()
54+
@pytest.mark.mpl_image_compare
7055
def test_config_font_annot():
7156
"""
72-
Test that setting `FONT_ANNOT` config changes both `FONT_ANNOT_PRIMARY` and
73-
`FONT_ANNOT_SECONDARY`.
57+
Test that setting FONT_ANNOT config changes both FONT_ANNOT_PRIMARY and
58+
FONT_ANNOT_SECONDARY.
7459
"""
75-
fig_ref = Figure()
76-
with config(FONT_ANNOT_PRIMARY="6p,red", FONT_ANNOT_SECONDARY="6p,red"):
77-
fig_ref.basemap(R="0/9/0/9", J="C3/3/9c", Tm="jTL+w4c+d4.5")
78-
fig_ref.basemap(compass="jBR+w5c+d-4.5")
79-
80-
fig_test = Figure()
60+
fig = Figure()
8161
with config(FONT_ANNOT="6p,red"):
82-
fig_test.basemap(
83-
region=[0, 9, 0, 9], projection="C3/3/9c", compass="jTL+w4c+d4.5"
84-
)
85-
fig_test.basemap(compass="jBR+w5c+d-4.5")
86-
87-
return fig_ref, fig_test
62+
fig.basemap(region=[0, 9, 0, 9], projection="C3/3/9c", compass="jTL+w4c+d4.5")
63+
fig.basemap(compass="jBR+w5c+d-4.5")
64+
return fig
8865

8966

9067
@pytest.mark.mpl_image_compare
9168
def test_config_format_time_map():
9269
"""
93-
Test that setting `FORMAT_TIME_MAP` config changes both
94-
`FORMAT_TIME_PRIMARY_MAP` and `FORMAT_TIME_SECONDARY_MAP`.
70+
Test that setting FORMAT_TIME_MAP config changes both
71+
FORMAT_TIME_PRIMARY_MAP and FORMAT_TIME_SECONDARY_MAP.
9572
"""
9673
fig = Figure()
9774
with config(FORMAT_TIME_MAP="abbreviation"):
@@ -107,8 +84,8 @@ def test_config_format_time_map():
10784
@pytest.mark.mpl_image_compare
10885
def test_config_map_annot_offset():
10986
"""
110-
Test that setting `MAP_ANNOT_OFFSET` config changes both
111-
`MAP_ANNOT_OFFSET_PRIMARY` and `MAP_ANNOT_OFFSET_SECONDARY`.
87+
Test that setting MAP_ANNOT_OFFSET config changes both
88+
MAP_ANNOT_OFFSET_PRIMARY and MAP_ANNOT_OFFSET_SECONDARY.
11289
"""
11390
fig = Figure()
11491
with config(MAP_ANNOT_OFFSET="15p"):
@@ -124,8 +101,8 @@ def test_config_map_annot_offset():
124101
@pytest.mark.mpl_image_compare
125102
def test_config_map_grid_cross_size():
126103
"""
127-
Test that setting `MAP_GRID_CROSS_SIZE` config changes both
128-
`MAP_GRID_CROSS_SIZE_PRIMARY` and `MAP_GRID_CROSS_SIZE_SECONDARY`.
104+
Test that setting MAP_GRID_CROSS_SIZE config changes both
105+
MAP_GRID_CROSS_SIZE_PRIMARY and MAP_GRID_CROSS_SIZE_SECONDARY.
129106
"""
130107
fig = Figure()
131108
with config(MAP_GRID_CROSS_SIZE="3p"):
@@ -142,8 +119,8 @@ def test_config_map_grid_cross_size():
142119
@pytest.mark.mpl_image_compare
143120
def test_config_map_grid_pen():
144121
"""
145-
Test that setting `MAP_GRID_PEN` config changes both `MAP_GRID_PEN_PRIMARY`
146-
and `MAP_GRID_PEN_SECONDARY`.
122+
Test that setting MAP_GRID_PEN config changes both MAP_GRID_PEN_PRIMARY and
123+
MAP_GRID_PEN_SECONDARY.
147124
"""
148125
fig = Figure()
149126
with config(MAP_GRID_PEN="thick,red"):
@@ -160,8 +137,8 @@ def test_config_map_grid_pen():
160137
@pytest.mark.mpl_image_compare
161138
def test_config_map_tick_length():
162139
"""
163-
Test that setting `MAP_TICK_LENGTH` config changes both
164-
`MAP_TICK_LENGTH_PRIMARY` and `MAP_TICK_LENGTH_SECONDARY`.
140+
Test that setting MAP_TICK_LENGTH config changes both
141+
MAP_TICK_LENGTH_PRIMARY and MAP_TICK_LENGTH_SECONDARY.
165142
"""
166143
fig = Figure()
167144
with config(MAP_TICK_LENGTH="5p"):
@@ -178,8 +155,8 @@ def test_config_map_tick_length():
178155
@pytest.mark.mpl_image_compare
179156
def test_config_map_tick_pen():
180157
"""
181-
Test that setting `MAP_TICK_PEN` config changes both `MAP_TICK_PEN_PRIMARY`
182-
and `MAP_TICK_PEN_SECONDARY`.
158+
Test that setting MAP_TICK_PEN config changes both MAP_TICK_PEN_PRIMARY and
159+
MAP_TICK_PEN_SECONDARY.
183160
"""
184161
fig = Figure()
185162
with config(MAP_TICK_PEN="thick,red"):

pygmt/tests/test_grdimage.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,16 @@ def test_grdimage_over_dateline(xrgrid):
146146

147147

148148
@check_figures_equal()
149-
@pytest.mark.parametrize("lon0", [0, 123, 180])
150-
@pytest.mark.parametrize("proj_type", ["H", "W"])
151-
def test_grdimage_central_meridians(grid, proj_type, lon0):
149+
def test_grdimage_central_meridians(grid):
152150
"""
153151
Test that plotting a grid with different central meridians (lon0) using
154152
Hammer (H) and Mollweide (W) projection systems work.
155153
"""
156154
fig_ref, fig_test = Figure(), Figure()
157155
fig_ref.grdimage(
158-
"@earth_relief_01d_g", projection=f"{proj_type}{lon0}/15c", cmap="geo"
156+
"@earth_relief_01d_g", projection="W123/15c", cmap="geo"
159157
)
160-
fig_test.grdimage(grid, projection=f"{proj_type}{lon0}/15c", cmap="geo")
158+
fig_test.grdimage(grid, projection="W123/15c", cmap="geo")
161159
return fig_ref, fig_test
162160

163161

0 commit comments

Comments
 (0)