-
-
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
DOC: Added examples to docstrings of DataArray methods (#7123) #7123
Conversation
Great, thank you @DanielGoman ! You might also be interested to look at this other recent PR which also added some examples to DataArra methods. #7088 |
Excellent @DanielGoman ! (not to use xarray to tout my personal projects — but re the doctest failures — running https://github.com/max-sixty/pytest-accept over them will auto-fix them, if that's helpful) |
Thanks for the advice @max-sixty! I performed doctests on my machine inside a conda venv following the Contributing Guide using Python 3.9, and passed the them. Yet, it doesn't pass the github tests. Any ideas as to why that might be? |
I assume you are on windows? Same always happens to me. |
Indeed I am. Thank you very much, I just tried running the script in the same manner on WSL and that seems to give the expected output. |
I have not figured that out. Usually the difference is small enough to fix it by hand. Maybe we could add a CI run that generates it and commits a correction if necessary, the same way we do it for black right now. |
I noticed that DataArray.interp_like takes an argument called If this is the intended behavior then I think |
See #7130 |
I'm trying to figure out how to add examples to DataArray.cumsum and DataArray.cumprod, but it's not so clear to me. It seems like they have partially dynamic docstrings. I have found the following script in xarray/core/common.py:
However, it is not clear to me where the rest of the docstring is located, nor where the docstrings of each function (cumsum, cumprod) are located. I'd appreciate if anybody could direct me to the explanation of this design :) |
I'm running into an issue when trying to directly use the DataArray.reduce method. At first I used DataArray.cumsum to see the expected behavior:
When I'm trying to achieve the same result through
Am I using Thanks in advance :) |
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 @DanielGoman This is a great contribution!
I merged in the main branch, which should give you all green checks
cumsum will be a lot more work, see ongoing work in #7152 . Thanks for looking in to it. |
I see, thanks for the heads up :) |
RTD failure is real:
|
Well I just fixed the issue to that. Correct me if I'm wrong, but before pushing my corrected version I pulled the latest version from the remote branch, which seems to contain changes that fail the CI. |
The |
e1253b0
to
657dc26
Compare
Since the merge apparently failed, I took the freedom to rebase this from the current master. |
Thanks, @DanielGoman ! |
Added examples to the docstring of the following methods:
DataArray.drop_vars()
DataArray.reindex_like()
DataArray.interp_like()
I will gradually edit this PR and add more examples to other methods.
I'll gladly accept feedback to improve upon my work :)