Skip to content
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

Map subclass page in docs can have two "Notes" sections #7286

Open
ayshih opened this issue Nov 7, 2023 · 4 comments
Open

Map subclass page in docs can have two "Notes" sections #7286

ayshih opened this issue Nov 7, 2023 · 4 comments
Labels
Documentation Affects the documentation Effort Low Requires a small time investment Feature Request New feature wanted! Good First Issue The best issues for new people to tackle! map Affects the map submodule Package Novice Requires little knowledge of the internal structure of SunPy Priority Low Slow action required

Comments

@ayshih
Copy link
Member

ayshih commented Nov 7, 2023

We have this code:

cls.__doc__ += textwrap.indent(_notes_doc, " ")

that automatically appends a fresh "Notes" section with a couple of notes and a warning:

sunpy/sunpy/map/mapbase.py

Lines 83 to 105 in ef9b401

Notes
-----
A number of the properties of this class are returned as two-value named
tuples that can either be indexed by position ([0] or [1]) or be accessed
by the names (.x and .y) or (.axis1 and .axis2). Things that refer to pixel
axes use the ``.x``, ``.y`` convention, where x and y refer to the FITS
axes (x for columns y for rows). Spatial axes use ``.axis1`` and ``.axis2``
which correspond to the first and second axes in the header. ``axis1``
corresponds to the coordinate axis for ``x`` and ``axis2`` corresponds to
``y``.
This class assumes that the metadata adheres to the FITS 4 standard.
Where the CROTA2 metadata is provided (without PC_ij) it assumes a conversion
to the standard PC_ij described in section 6.1 of .
`Calabretta & Greisen (2002) <https://doi.org/10.1051/0004-6361:20021327>`_
.. warning::
If a header has CD_ij values but no PC_ij values, CDELT values are required
for this class to construct the WCS.
If a file with more than two dimensions is feed into the class,
only the first two dimensions (NAXIS1, NAXIS2) will be loaded and the
rest will be discarded.

However, if the subclass docstring already has a "Notes" section, that means that the page in the docs will have two "Notes" sections (e.g., https://docs.sunpy.org/en/v5.1.1/generated/api/sunpy.map.sources.AIAMap.html). (Also, the "Notes" section is supposed to come before the "References" and Examples" sections, so blanket appending a "Notes" section can result in out-of-order sections, even if the subclass docstring does not already have a "Notes" section.)

We should try to do something more sophisticated, such as searching for the best point of insertion in to the docstring.

@ayshih ayshih added Feature Request New feature wanted! Documentation Affects the documentation Package Novice Requires little knowledge of the internal structure of SunPy map Affects the map submodule Priority Low Slow action required Effort Low Requires a small time investment Good First Issue The best issues for new people to tackle! labels Nov 7, 2023
@cmdCrusaderr

This comment was marked as outdated.

@nabobalis

This comment was marked as outdated.

@ryuusama09
Copy link
Contributor

We have this code:

cls.__doc__ += textwrap.indent(_notes_doc, " ")

that automatically appends a fresh "Notes" section with a couple of notes and a warning:

sunpy/sunpy/map/mapbase.py

Lines 83 to 105 in ef9b401

Notes
-----
A number of the properties of this class are returned as two-value named
tuples that can either be indexed by position ([0] or [1]) or be accessed
by the names (.x and .y) or (.axis1 and .axis2). Things that refer to pixel
axes use the ``.x``, ``.y`` convention, where x and y refer to the FITS
axes (x for columns y for rows). Spatial axes use ``.axis1`` and ``.axis2``
which correspond to the first and second axes in the header. ``axis1``
corresponds to the coordinate axis for ``x`` and ``axis2`` corresponds to
``y``.
This class assumes that the metadata adheres to the FITS 4 standard.
Where the CROTA2 metadata is provided (without PC_ij) it assumes a conversion
to the standard PC_ij described in section 6.1 of .
`Calabretta & Greisen (2002) <https://doi.org/10.1051/0004-6361:20021327>`_
.. warning::
If a header has CD_ij values but no PC_ij values, CDELT values are required
for this class to construct the WCS.
If a file with more than two dimensions is feed into the class,
only the first two dimensions (NAXIS1, NAXIS2) will be loaded and the
rest will be discarded.

However, if the subclass docstring already has a "Notes" section, that means that the page in the docs will have two "Notes" sections (e.g., https://docs.sunpy.org/en/v5.1.1/generated/api/sunpy.map.sources.AIAMap.html). (Also, the "Notes" section is supposed to come before the "References" and Examples" sections, so blanket appending a "Notes" section can result in out-of-order sections, even if the subclass docstring does not already have a "Notes" section.)

We should try to do something more sophisticated, such as searching for the best point of insertion in to the docstring.

if notes >> references ... what is the other best point of insertion ? if the docstring doesnt have any other sections except for notes , references and warning .. then it should be straightforward prepending right ?

@nabobalis
Copy link
Contributor

if notes >> references ... what is the other best point of insertion ? if the docstring doesnt have any other sections except for notes , references and warning .. then it should be straightforward prepending right ?

There is already an open PR for this. I would suggest another issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Affects the documentation Effort Low Requires a small time investment Feature Request New feature wanted! Good First Issue The best issues for new people to tackle! map Affects the map submodule Package Novice Requires little knowledge of the internal structure of SunPy Priority Low Slow action required
Projects
None yet
Development

No branches or pull requests

4 participants