Skip to content

Commit

Permalink
Change invalid input conditions in grdtrack (GenericMappingTools#1376)
Browse files Browse the repository at this point in the history
Change if statement to raise GMTInvalidInput if a DataFrame
is passed in with no arguments to the newcolname parameter.

Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
  • Loading branch information
2 people authored and Josh Sixsmith committed Dec 21, 2022
1 parent 54101e8 commit 16e21b3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pygmt/src/grdtrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from pygmt.helpers import (
GMTTempFile,
build_arg_string,
data_kind,
fmt_docstring,
kwargs_to_strings,
use_alias,
Expand Down Expand Up @@ -248,7 +247,7 @@ def grdtrack(points, grid, newcolname=None, outfile=None, **kwargs):
- None if ``outfile`` is set (track output will be stored in file set
by ``outfile``)
"""
if data_kind(points) == "matrix" and newcolname is None:
if hasattr(points, "columns") and newcolname is None:
raise GMTInvalidInput("Please pass in a str to 'newcolname'")

with GMTTempFile(suffix=".csv") as tmpfile:
Expand Down

0 comments on commit 16e21b3

Please sign in to comment.