-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
API for N-dimensional combine #2616
API for N-dimensional combine #2616
Conversation
…tentation algorithm
…ed list traverser as an iterator
Thanks for the detailed review @shoyer !
Great - the only test I think you should definitely look at is |
xarray/core/combine.py
Outdated
return False | ||
else: | ||
# There is a different problem | ||
raise err |
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.
I could raise a default deprecation warning, then if no errors are raised while trying to get through
_dimension_coords_exist()
raise another warning with more info? Then the user will always get a deprecation warning regardless of what error is thrown?
This sounds like a good solution to me.
Okay, but what other way is there of doing this? We have to distinguish between these errors if we want to be able to check what type of input the user gave and still carry on going.
The alternative is either (1) making dedicated error classes or (2) refactoring into lower level functions with more specific functionality. That said, it's probably not worth bothering with either of these here.
issue some sort of "default" deprecation warning if something unexpected happens
I could raise a default deprecation warning, then if no errors are raised while trying to get through
_dimension_coords_exist()
raise another warning with more info? Then the user will always get a deprecation warning regardless of what error is thrown?matching strings in error messages, which can be fragile
Okay, but what other way is there of doing this? We have to distinguish between these errors if we want to be able to check what type of input the user gave and still carry on going.
If ValueError is raised for another reason, the user could get a surprising traceback.
If
ValueError
is raised for another reason then the user will see that because it will be caught and raised, no?Do you mean that I should raise the particular error caught by
_infer_concat_order_from_coords
as a second warning?
I think it's better just to silence the error.
I left a couple of minor comments, but I think this is pretty much ready to go! We should merge this and let users give it a try :). |
Okay I've changed those things. @shoyer if you want to just double check that the new error catching behaviour in |
OK, in it goes! Thanks @TomNicholas for your perseverance here |
Thanks @TomNicholas ! |
🎉 Thanks for your help! |
I started thinking about names for these functions again.... I don't love the non-descriptive nature of What about calling these |
@shoyer I like that suggestion a lot - not sure why we didn't think of something similar before. How does it work if I push to a merged PR? |
Pushing to a merged PR definitely doesn't work :). You should start a new branch after syncing master. |
Continues the discussion from #2553 about how the API for loading and combining data from multiple datasets should work. (Ultimately part of the solution to #2159)
@shoyer this is for you to see how I envisaged the API would look, based on our discussion in #2553. For now you can ignore all the changes except the ones to the docstrings of
auto_combine
here,manual_combine
here andopen_mfdataset
here.Feedback from anyone else is also encouraged, as really the point of this is to make the API as clear as possible to someone who hasn't delved into the code behind
auto_combine
andopen_mfdataset
.It makes sense to first work out the API, then change the internal implementation to match, using the internal functions developed in #2553. Therefore the tasks include:
manual_combine
auto-combine
open_mfdataset
to matchauto_combine
andmanual_combine
appear on the API page of the docsauto_combine