-
-
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
Open mfdataset enchancement #9955
base: main
Are you sure you want to change the base?
Conversation
Thank you for opening this pull request! It may take us a few days to respond here, so thank you for being patient. |
I'm not the expert, but this looks reasonable! Any other thoughts? Assuming no one thinks it's a bad idea, we would need tests. |
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 think it is a good idea.
But the way it is implemented here seems overly complicated and repetitive.
I would suggest to revert the logic: first build up the list wrapped in a single try
and then handle the three cases in the except
block.
xarray/backends/api.py
Outdated
) | ||
continue | ||
else: | ||
raise ValueError( |
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.
This is never being raised because it is catched by the outer try-except.
Also, to keep the complexity lower, check this before entering the if else block: if errors not in ("raise", "warn", "ignore"): raise ValueError(...)
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.
Thanks @headtr1ck for pointing this out. I have made changes to the logic based on your suggestions.
Co-authored-by: Michael Niklas <[email protected]>
whats-new.rst
Added new argument in
open_mfdataset
to better handle the invalid files.