Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman committed May 26, 2024
1 parent 1396ee8 commit 6f2671a
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions pygmt/src/x2sys_cross.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,13 @@ def x2sys_cross(
"'s' (second) but '{time_unit}' is given."
)
raise GMTInvalidInput(msg)

Check warning on line 241 in pygmt/src/x2sys_cross.py

View check run for this annotation

Codecov / codecov/patch

pygmt/src/x2sys_cross.py#L241

Added line #L241 was not covered by tests
time_unit = {"d": "D", "s": "s"}[time_unit]
to_args = {"unit": time_unit}
match result.columns[2][0]: # "t" or "i".
case "t":
to_func = pd.to_datetime
to_args["origin"] = lib.get_default("TIME_EPOCH")
case "i":
to_func = pd.to_timedelta

t_or_i = result.columns[2][0] # "t" or "i".
to_func = {"t": pd.to_datetime, "i": pd.to_timedelta}
to_args = {"unit": {"d": "D", "s": "s"}[time_unit]}
if t_or_i == "t":
to_args["origin"] = lib.get_default("TIME_EPOCH")

result[result.columns[2:4]] = result[result.columns[2:4]].apply(
to_func, **to_args
)
Expand Down

0 comments on commit 6f2671a

Please sign in to comment.