-
Notifications
You must be signed in to change notification settings - Fork 228
Fix the error message in the _check_dtype_and_dim function #2297
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
Conversation
Is it incorrect to refer to the "dimensions" plural for an array (assuming it is more than 1d)? |
I'm not sure. Perhaps "dimensions" is more general and better. |
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change regarding the consistent usage of x-D looks good!
The change regarding the error message should be OK.
Regarding whether it is the dimension (singular) or the dimensions (plural) of an array, I am not sure 🙁. Currently it is not consistent. For me for all four occurrences in _check_dtype_and_dim
singular sounds better, as ndim
is one single integer value indicating the overall number of dimensions:
- lines 680-681:
Check that a numpy array has the given dimensions and is a valid data
type. # -> change to dimension (singular)
- lines 687-688:
ndim : int
The desired dimension of the array.
- lines 697-699:
GMTCLibError
If the array has the wrong dimensions or is an unsupported data
type. # -> change to dimension (singular)
- lines 718-720:
# check the array has the given dimension
if array.ndim != ndim:
raise GMTInvalidInput(f"Expected a numpy 1-D array, got {array.ndim}-D.")
Plural is used in:
create_data
- lines 529-533:
dim : list of 4 integers
The dimensions of the dataset. See the documentation for the GMT C
API function ``GMT_Create_Data`` (``src/gmt_api.c``) for the full
range of options regarding 'dim'. If ``None``, will pass in the
NULL pointer.
extract_region
- lines 1489-1491:
* wesn : 1-D array # <- is the * needed or a typo?
A numpy 1-D array with the west, east, south, and north dimensions
of the current figure. # <- maybe limits is a better word here?
The numpy documentation for
So I think we can follow their style. |
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
Description of proposed changes
Fixes #
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.Slash Commands
You can write slash commands (
/command
) in the first line of a comment to performspecific operations. Supported slash commands are:
/format
: automatically format and lint the code/test-gmt-dev
: run full tests on the latest GMT development version