Improve error message for missing coordinate index#9370
Merged
TomNicholas merged 3 commits intopydata:mainfrom Aug 16, 2024
Merged
Improve error message for missing coordinate index#9370TomNicholas merged 3 commits intopydata:mainfrom
TomNicholas merged 3 commits intopydata:mainfrom
Conversation
Provide a more informative error message, specifically which coordinate is without index.
Collaborator
|
Looks good! Can we fix the test which matches on the previous error message? |
nicrie
commented
Aug 15, 2024
Contributor
Author
nicrie
left a comment
There was a problem hiding this comment.
Sure, thanks for the tip! I didn't realize this error message had already been tested. I removed the new test and reused the old one.
max-sixty
reviewed
Aug 15, 2024
xarray/tests/test_combine.py
Outdated
| combine_by_coords([da_1, da_2]) | ||
|
|
||
|
|
||
| def test_combine_by_coords_raises_for_no_index(): |
Collaborator
There was a problem hiding this comment.
FWIW this was a nice test because it included the coord name! But no great stress
max-sixty
approved these changes
Aug 15, 2024
dcherian
added a commit
to dcherian/xarray
that referenced
this pull request
Aug 17, 2024
* main: Improve error message for missing coordinate index (pydata#9370) Add flaky to TestNetCDF4ViaDaskData (pydata#9373) Make chunk manager an option in `set_options` (pydata#9362) Revise (pydata#9371) Remove duplicate word from docs (pydata#9367) Adding open_groups to BackendEntryPointEngine, NetCDF4BackendEntrypoint, and H5netcdfBackendEntrypoint (pydata#9243)
dcherian
added a commit
to TomNicholas/xarray
that referenced
this pull request
Aug 22, 2024
* main: (214 commits) Adds copy parameter to __array__ for numpy 2.0 (pydata#9393) `numpy 2` compatibility in the `pydap` backend (pydata#9391) pyarrow dependency added to doc environment (pydata#9394) Extend padding functionalities (pydata#9353) refactor GroupBy internals (pydata#9389) Combine `UnsignedIntegerCoder` and `CFMaskCoder` (pydata#9274) passing missing parameters to ZarrStore.open_store when opening a datatree (pydata#9377) Fix tests on big-endian systems (pydata#9380) Improve error message on `ds['x', 'y']` (pydata#9375) Improve error message for missing coordinate index (pydata#9370) Add flaky to TestNetCDF4ViaDaskData (pydata#9373) Make chunk manager an option in `set_options` (pydata#9362) Revise (pydata#9371) Remove duplicate word from docs (pydata#9367) Adding open_groups to BackendEntryPointEngine, NetCDF4BackendEntrypoint, and H5netcdfBackendEntrypoint (pydata#9243) Revise (pydata#9366) Fix rechunking to a frequency with empty bins. (pydata#9364) whats-new entry for dropping python 3.9 (pydata#9359) drop support for `python=3.9` (pydata#8937) Revise (pydata#9357) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This simple PR improves the error message for cases where a coordinate is missing its corresponding index. Previously, a generic ValueError was raised, but now the error message specifically mentions which coordinate is without an index.