Skip to content
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

Add dcw alias (E) to Figure.coast #765

Merged
merged 31 commits into from
Jan 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1a463cf
Add paint_country alias for coast() in base_plotting.py
willschlitzer Dec 25, 2020
169cc10
Add explanation for paint_country
willschlitzer Dec 25, 2020
c6aed0c
Add test_coast_paint_country_single() and test_coast_paint_country_mu…
willschlitzer Dec 25, 2020
91b42f9
Add test_coast_paint_country_list() to test_coast.py
willschlitzer Dec 25, 2020
f098b32
Add test_coast_paint_country_continent() to test_coast.py
willschlitzer Dec 25, 2020
7b25dca
Add test_coast_paint_country_state() to test_coast.py
willschlitzer Dec 25, 2020
c7de431
Merge branch 'master' into paint-country
willschlitzer Dec 29, 2020
57bf7fd
Explain +z and +l|+L; add links for ISO codes and DCW
willschlitzer Dec 29, 2020
3146877
Adding line break between link text and URL for styling
willschlitzer Dec 29, 2020
0c7877c
Fix link formatting typo
willschlitzer Dec 29, 2020
55e6cb3
Merge branch 'master' into paint-country
willschlitzer Dec 29, 2020
4e720ba
Merge branch 'master' into paint-country
willschlitzer Dec 29, 2020
5a23987
Merge branch 'master' into paint-country
willschlitzer Dec 31, 2020
8ffa8eb
Update paint_country to dcw
willschlitzer Dec 31, 2020
66375e3
Merge branch 'master' into paint-country
willschlitzer Jan 2, 2021
43aa7aa
Update for dcw alias in test_coast.py
willschlitzer Jan 2, 2021
9e4fe12
Merge branch 'master' into paint-country
willschlitzer Jan 2, 2021
3d41b2e
Merge branch 'master' into paint-country
willschlitzer Jan 2, 2021
68c03f1
Run make format
willschlitzer Jan 3, 2021
f036a8b
Update pygmt/base_plotting.py
willschlitzer Jan 13, 2021
0713d2d
Update pygmt/base_plotting.py
willschlitzer Jan 13, 2021
1c8a8f7
Update pygmt/base_plotting.py
willschlitzer Jan 16, 2021
b597dab
Update pygmt/base_plotting.py
willschlitzer Jan 16, 2021
4371626
Merge branch 'master' into paint-country
seisman Jan 17, 2021
ea0092c
Update docstring for dcw
willschlitzer Jan 18, 2021
7844ac7
Merge remote-tracking branch 'origin/paint-country' into paint-country
willschlitzer Jan 18, 2021
668e6b6
Update formating
willschlitzer Jan 18, 2021
e92be48
Correct line lengths
willschlitzer Jan 18, 2021
c829ddf
Update pygmt/base_plotting.py
seisman Jan 18, 2021
79da9b5
Update pygmt/base_plotting.py
seisman Jan 18, 2021
9021843
Update pygmt/base_plotting.py
seisman Jan 18, 2021
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
20 changes: 20 additions & 0 deletions pygmt/base_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def _preprocess(self, **kwargs): # pylint: disable=no-self-use
C="lakes",
B="frame",
D="resolution",
E="dcw",
I="rivers",
L="map_scale",
N="borders",
Expand Down Expand Up @@ -141,6 +142,25 @@ def coast(self, **kwargs):
shorelines : str
``'[level/]pen'``
Draw shorelines [Default is no shorelines]. Append pen attributes.
dcw : str or list
*code1,code2,…*\ [**+l**\|\ **L**\ ][**+g**\ *fill*\ ]
[**+p**\ *pen*\ ][**+z**]
Select painting or dumping country polygons from the
`Digital Chart of the World
<https://en.wikipedia.org/wiki/Digital_Chart_of_the_World>`__.
Append one or more comma-separated countries using the 2-character
`ISO 3166-1 alpha-2 convention
<https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2>`__.
To select a state of a country (if available), append
.\ *state*, (e.g, US.TX for Texas). To specify a whole continent,
prepend **=** to any of the continent codes (e.g. =EU for Europe).
Append **+p**\ *pen* to draw polygon outlines
(default is no outline) and **+g**\ *fill* to fill them
(default is no fill). Append **+l**\|\ **+L** to *=continent* to
only list countries in that continent; repeat if more than one
continent is requested. Append **+z** to place the country code in
the segment headers via **-Z**\ *code* settings.To apply different
settings to different countries, pass a list of string arguments.
{XY}
{p}
{t}
Expand Down
90 changes: 90 additions & 0 deletions pygmt/tests/test_coast.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def test_coast_aliases():
Y="a10c",
p="135/25",
t=13,
E="MA+gred",
C="blue",
)
fig_test.coast(
Expand All @@ -75,6 +76,7 @@ def test_coast_aliases():
yshift="a10c", # Y
perspective=[135, 25], # p
transparency=13, # t
dcw="MA+gred", # E
lakes="blue", # C
)
return fig_ref, fig_test
Expand All @@ -93,3 +95,91 @@ def test_coast_world_mercator():
water="white",
)
return fig


@check_figures_equal()
def test_coast_dcw_single():
"Test passing a single country code to dcw"
fig_ref, fig_test = Figure(), Figure()
# Use single-character arguments for the reference image
fig_ref.coast(R="-10/15/25/44", J="M15c", B="a", G="brown", E="ES+gbisque+pblue")
fig_test.coast(
region=[-10, 15, 25, 44],
frame="a",
projection="M15c",
land="brown",
dcw="ES+gbisque+pblue",
)
return fig_ref, fig_test


@check_figures_equal()
def test_coast_dcw_multiple():
"Test passing multiple country code to dcw"
fig_ref, fig_test = Figure(), Figure()
# Use single-character arguments for the reference image
fig_ref.coast(R="-10/15/25/44", J="M15c", B="a", G="brown", E="ES,IT+gbisque+pblue")
fig_test.coast(
region=[-10, 15, 25, 44],
frame="a",
projection="M15c",
land="brown",
dcw="ES,IT+gbisque+pblue",
)
return fig_ref, fig_test


@check_figures_equal()
def test_coast_dcw_list():
"Test passing a list of country codes and fill options to dcw"
fig_ref, fig_test = Figure(), Figure()
# Use single-character arguments for the reference image
fig_ref.coast(
R="-10/15/25/44",
J="M15c",
B="a",
G="brown",
E=["ES+gbisque+pgreen", "IT+gcyan+pblue"],
)
fig_test.coast(
region=[-10, 15, 25, 44],
frame="a",
projection="M15c",
land="brown",
dcw=["ES+gbisque+pgreen", "IT+gcyan+pblue"],
)
return fig_ref, fig_test


@check_figures_equal()
def test_coast_dcw_continent():
"Test passing a continent code to dcw"
fig_ref, fig_test = Figure(), Figure()
# Use single-character arguments for the reference image
fig_ref.coast(R="-10/15/25/44", J="M15c", B="a", G="brown", E="=AF+gbisque+pblue")
fig_test.coast(
region=[-10, 15, 25, 44],
frame="a",
projection="M15c",
land="brown",
dcw="=AF+gbisque+pblue",
)
return fig_ref, fig_test


@check_figures_equal()
def test_coast_dcw_state():
"Test passing a US state code to dcw"
fig_ref, fig_test = Figure(), Figure()
# Use single-character arguments for the reference image
fig_ref.coast(
R="-75/-69/40/44", J="M15c", B="a", G="brown", E="US.MA+gbisque+pblue"
)
fig_test.coast(
region=[-75, -69, 40, 44],
frame="a",
projection="M15c",
land="brown",
dcw="US.MA+gbisque+pblue",
)
return fig_ref, fig_test