Skip to content

Conversation

@seisman
Copy link
Member

@seisman seisman commented Oct 30, 2024

Some factors you should know:

  1. The _check_dtype_and_dim function is used in put_vectors and put_matrix only
  2. GMT_Put_Matrix (i.e., put_matrix) can only accept 2-D arrays with numeric dtypes (e.g., GMT_INT)
  3. GMT_Put_Vectors (i.e., put_vectors) can accept 1-D arrays in both numeric dtypes (e.g., GMT_INT) and text dtypes (e.g., GMT_TEXT/GMT_DATETIME)

Previously, we check if the array dtype exists in the DTYPES dict for both 1-D and 2-D arrays. This PR splits DTYPES into DTYPES_NUMERIC and DTYPES_TEXT, and explicitly check if 2-D array dtype in DTYPES_NUMERIC.

@seisman seisman added maintenance Boring but important stuff for the core devs needs review This PR has higher priority and needs review. labels Oct 30, 2024
@seisman seisman added this to the 0.14.0 milestone Oct 30, 2024
@seisman seisman changed the title Improve the data type checking for 2-D arrays Improve the data type checking for 2-D arrays passed to the GMT C API Oct 30, 2024
@seisman seisman merged commit e5ecee9 into main Oct 31, 2024
23 checks passed
@seisman seisman deleted the refactor/check_dtype_and_ndim branch October 31, 2024 00:16
@seisman seisman removed the needs review This PR has higher priority and needs review. label Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Boring but important stuff for the core devs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants