open_mfdataset: Raise if combine='by_coords' and concat_dim=None #5231
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.
Fixes bug which allowed incorrect arguments to be passed to
open_mfdataset
without complaint.The combination
open_mfdataset(files, combine='by_coords', concat_dim='t')
should never have been permitted, and in fact it wasn't permitted until the last part of the deprecation process from the oldauto_combine
. It makes no sense to pass this combination because thecombine_by_coords
function does not have aconcat_dim
argument at all!The effect was pretty benign - the
concat_dim
arg wasn't really used for anything in that case, and the result of passing dodgy datasets would just be a less informative error. However there were multiple tests which assumed this behaviour was okay - I had to remove that particular parametrization for a bunch of your join tests @dcherian because they now fail with a different (clearer) error.I also noticed a related issue which I fixed - internally
open_mfdataset
was performing a rearrangement of the input datasets that it needs for the casecombine='nested'
, even in the casecombine='by_coords'
. I hadn't previously realised that we can just skip this rearrangement without issue, soopen_mfdataset(combine='by_coords')
should be a little bit faster now.pre-commit run --all-files
whats-new.rst