Skip to content

Commit 2fca0be

Browse files
seismanCopilot
andauthored
Following copilot suggestion
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent b60d7cf commit 2fca0be

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

pygmt/helpers/utils.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -885,12 +885,15 @@ def sequence_join(
885885
_values = []
886886
for item in value:
887887
if isinstance(item, np.timedelta64):
888-
# Convert timedelta64 to numeric value in its original unit.
888+
# Convert timedelta64 to numeric value. For generic units, preserve the
889+
# raw integer value; for specific units, convert in that unit.
889890
unit = np.datetime_data(item.dtype)[0]
890-
# If unit is generic, convert to seconds as a default
891891
if unit == "generic":
892-
unit = "s"
893-
_values.append(str(item.astype(f"timedelta64[{unit}]").astype(int)))
892+
_values.append(str(int(item)))
893+
else:
894+
_values.append(
895+
str(item.astype(f"timedelta64[{unit}]").astype(int))
896+
)
894897
elif " " in str(item):
895898
_values.append(
896899
np.datetime_as_string(np.asarray(item, dtype="datetime64"))

0 commit comments

Comments
 (0)