-
-
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
Add cross-links to API docstring from tutorial and user-guide #8311
Conversation
Thank you for opening this pull request! It may take us a few days to respond here, so thank you for being patient. |
Thanks @amanbagrecha . I changed the links to more general pages. |
Thanks @dcherian for the edits. I reverted the docs you made for
|
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 wonder if we should be using the intersphinx
entries in https://tutorial.xarray.dev/objects.inv
?
If so, you'd need to add
"xarray-tutorial": ("https://tutorial.xarray.dev/", None),
to intersphinx_mapping
xarray/core/dataarray.py
Outdated
@@ -6788,6 +6801,13 @@ def weighted(self, weights: DataArray) -> DataArrayWeighted: | |||
See Also | |||
-------- | |||
Dataset.weighted | |||
|
|||
`Weighted array reductions <https://docs.xarray.dev/en/stable/user-guide/computation.html#weighted-array-reductions>`_ |
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.
you can use sphobjinv su -u https://docs.xarray.dev/en/latest computation
to find the appropriate link, in this case
:std:label:`/user-guide/computation.rst#weighted-array-reductions`
(though maybe we need to add label directives to user-guide/computation
to make this easier? E.g. add
.. _weighted-array-reductions:
just before that section... not sure if -
is a allowed character in labels, though)
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.
many thanks! I made the necessary changes.
I added xarray-tutorial to intersphinx_mapping. Though I am confused how to use it. I tried
|
not sure, you might have to use a prefix: :doc:`xarray-tutorial:fundamentals/03.4_weighted` where the prefix is the value you put as the |
Thanks this worked. Now I'm struggling to find a way to link just the section as in https://tutorial.xarray.dev/intermediate/01-high-level-computation-patterns.html#label-space-windows-or-bins-groupby. Since tutorials are in markdown, I cannot add a directive I think. |
I think this should be possible (not sure though, especially given jupyter-book/jupyter-book#1767), but might need changes to the tutorial. @dcherian, any ideas? |
No ideas but this is a major improvement. So let's just go ahead with a link to the whole page. |
was there anything else you'd like to change, @amanbagrecha? Otherwise I think we can undo the |
… into apply-ufunc-api-docs
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.
we might have to revisit the links once xarray-tutorial
has section targets, but for now this looks good to me. Thanks a lot, @amanbagrecha
@@ -1431,6 +1431,12 @@ def isel( | |||
Dataset.isel | |||
DataArray.sel | |||
|
|||
:doc:`xarray-tutorial:intermediate/indexing/indexing` |
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.
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 should be valid, though. So we might need to fix napoleon
to allow this.
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.
it appears we had a similar issue more than two years ago when we first introduced :doc:
links to See Also
(see #5176), where we concluded that this is a bug in napoleon
(nobody got around to reporting / fixing that since then, though).
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.
OK well this is an improvement in any case. Merging.
Thanks @amanbagrecha this is a great contribution. Welcome to Xarray! |
Tests addedUser visible changes (including notable bug fixes) are documented inwhats-new.rst
New functions/methods are listed inapi.rst
Cross links for