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

Change text when GMTInvalidInput error is raised for basemap #729

Merged
merged 19 commits into from
Dec 15, 2020
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
7be1d62
Change error text for basemap GMTInvalidInput
willschlitzer Dec 14, 2020
32edc8e
Remove rose from basemap GMTInvalidInput error; adding "rose" or "com…
willschlitzer Dec 14, 2020
815876b
Add basemap GMTInvalidInput exception if region is not specified.
willschlitzer Dec 14, 2020
c9831b0
Rewrite if statement for R in kwargs under basemap
willschlitzer Dec 14, 2020
5efce1c
Removing "At least" from GMTInvalidInput error text since numbers are…
willschlitzer Dec 14, 2020
ed798ad
Remove "T in kwargs" from if not statement, as "T" is not an availabl…
willschlitzer Dec 14, 2020
41e8d48
Remove reqion error raising for basemap()
willschlitzer Dec 14, 2020
6de6750
Update if statement and error text for compass or rose
willschlitzer Dec 15, 2020
bf054c2
Merge branch 'master' into baseplotting-error
willschlitzer Dec 15, 2020
d0dc60b
Run make format
willschlitzer Dec 15, 2020
5a705bc
Add test_basemap_compass() and test_basemap_rose()
willschlitzer Dec 15, 2020
8abd940
Run make format
willschlitzer Dec 15, 2020
fb5abf4
Change GMTInvalidInput error text for basemap in base_plotting.py
willschlitzer Dec 15, 2020
7de49a5
Fix tests in test_basemap.py
willschlitzer Dec 15, 2020
10b59fe
Adding comparison images that I forgot to add
willschlitzer Dec 15, 2020
375aa73
Rewrite compass and rose tests to use @check_figures_equal() and dele…
willschlitzer Dec 15, 2020
ca740d5
Update pygmt/tests/test_basemap.py
willschlitzer Dec 15, 2020
acac815
Update pygmt/tests/test_basemap.py
willschlitzer Dec 15, 2020
412e390
Merge branch 'master' into baseplotting-error
willschlitzer Dec 15, 2020
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
6 changes: 4 additions & 2 deletions pygmt/base_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -1167,8 +1167,10 @@ def basemap(self, **kwargs):

"""
kwargs = self._preprocess(**kwargs)
if not ("B" in kwargs or "L" in kwargs or "T" in kwargs):
raise GMTInvalidInput("At least one of B, L, or T must be specified.")
if not ("B" in kwargs or "L" in kwargs or "Td" in kwargs or "Tm" in kwargs):
raise GMTInvalidInput(
"At least one of frame, map_scale, compass, or rose must be specified."
)
with Session() as lib:
lib.call_module("basemap", build_arg_string(kwargs))

Expand Down
22 changes: 22 additions & 0 deletions pygmt/tests/test_basemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,25 @@ def test_basemap_aliases():
fig = Figure()
fig.basemap(region=[0, 360, -90, 90], projection="W7i", frame=True)
return fig


@check_figures_equal()
def test_basemap_rose():
"Create a map with coast and use basemap to add a rose"
fig_ref, fig_test = Figure(), Figure()
fig_ref.coast(R=[127.5, 128.5, 26, 27], W="1/0.5p")
willschlitzer marked this conversation as resolved.
Show resolved Hide resolved
fig_ref.basemap(Td="jBR+w5c")
fig_test.coast(region=[127.5, 128.5, 26, 27], shorelines="1/0.5p")
fig_test.basemap(rose="jBR+w5c")
return fig_ref, fig_test


@check_figures_equal()
def test_basemap_compass():
"Create a map with coast and use basemap to add a compass"
fig_ref, fig_test = Figure(), Figure()
fig_ref.coast(R=[127.5, 128.5, 26, 27], W="1/0.5p")
willschlitzer marked this conversation as resolved.
Show resolved Hide resolved
fig_ref.basemap(Tm="jBR+w5c+d11.5")
fig_test.coast(region=[127.5, 128.5, 26, 27], shorelines="1/0.5p")
fig_test.basemap(compass="jBR+w5c+d11.5")
return fig_ref, fig_test