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

Test timedelta64 dtype arrays with various date/time units #3567

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Changes from all commits
Commits
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
8 changes: 5 additions & 3 deletions pygmt/tests/test_clib_put_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,12 @@ def test_put_vector_string_dtype():

def test_put_vector_timedelta64_dtype():
"""
Passing timedelta64 type vectors with various time units (year, month,
week, day, hour, minute, second, millisecond, microsecond) to a dataset.
Passing timedelta64 type vectors with various date/time units to a dataset.

Valid date/time units can be found at
https://numpy.org/devdocs/reference/arrays.datetime.html#datetime-units.
"""
for unit in ["Y", "M", "W", "D", "h", "m", "s", "ms", "μs"]:
for unit in ["Y", "M", "W", "D", "h", "m", "s", "ms", "us", "ns", "ps", "fs", "as"]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this test was limited to just "μs" because GMT supports up to microsecond for datetime as you mentioned at #464 (comment). But for timedelta, I guess it doesn't matter if we are using nanosecond or lower since it is just a linear scale.

with clib.Session() as lib, GMTTempFile() as tmp_file:
dataset = lib.create_data(
family="GMT_IS_DATASET|GMT_VIA_VECTOR",
Expand Down