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

[WIP] irradiance.py updates: glossary term links and units #2311

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

RDaxini
Copy link
Contributor

@RDaxini RDaxini commented Nov 27, 2024

Updating the units to superscript and linking key terms to their glossary page definitions.
Follow up PR(s): add some of these key terms into the glossary, enhance existing glossary term definitions (units and explanation)
Note: we can now view definition tooltips by hovering the cursor over the linked glossary term (context: #2290)

@RDaxini RDaxini added this to the v0.11.2 milestone Nov 27, 2024
Comment on lines 665 to 670
The sky diffuse component of the solar radiation. [Wm⁻²]
The sky diffuse component of the solar radiation [Wm⁻²].
Copy link
Contributor Author

@RDaxini RDaxini Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are these periods supposed to go? Before or after the units? I see a mix in the docs. I've gone for after.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I vote for after.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The recently added documentation example featured the period before the units.

I think this probably deserves a vote, mostly just a final decision.

Copy link
Contributor Author

@RDaxini RDaxini Dec 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The recently added documentation example featured the period before the units.

I think this probably deserves a vote, mostly just a final decision.

Ah I missed that.
Could react here?
👍 for after solar radiation [Wm⁻²]. ...
👎 for before solar radiation. [Wm⁻²] ...
When the units are at the end of the sentence, ie no subsequent text, either way looks fine. When there's text after the units, I think period after is better, so for consistency I just thought [Wm⁻²]. made sense. I don't feel too strongly either way though, but if someone else does then I'm happy just to follow that 😅 Edit: after encountering more examples while making modifications, I am now more strongly in favour of [Wm⁻²].

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can live with either.

Copy link
Member

@kandersolar kandersolar Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Units before the period suggests that it's a member of the preceding sentence and should obey its grammatical structure. Consider this example from pvlib.temperature.sapm_cell:

wind_speed : numeric
Wind speed at a height of 10 meters [m/s].

The unit could be confused as a parenthetical describing the thing before it (a height of 10 meters in this case), which of course is not the intended meaning.

Fundamentally I think the unit describes the parameter, not something in the parameter description text, and we are only including the unit immediately adjacent to the description because sphinx doesn't offer a more structured alternative. For example, in a different documentation system that represents parameters in tabular form, we might have chosen to have description and unit in separate columns. Since we don't actually have tables, all we can do is to put them next to each other. But I don't see why it makes sense to go a step further and include the units inside (instead of after) the description text.

Not sure that's convincing to others, but anyway I'm +1 to period before units.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RDaxini
Copy link
Contributor Author

RDaxini commented Dec 9, 2024

I could modify the scope of this PR if we want to see some of the changes implemented in 11.2. I don't think these changes are urgent though so I'm also happy to keep working on it and merge the completed version in 11.3. Not sure what reviewers would prefer though--- on second thoughts many small revisions covering the entire irradiance.py might be a pain to review. Thoughts @kandersolar @AdamRJensen @cwhanse ?

pvlib/irradiance.py Outdated Show resolved Hide resolved
pvlib/irradiance.py Outdated Show resolved Hide resolved
Comment on lines 665 to 670
The sky diffuse component of the solar radiation. [Wm⁻²]
The sky diffuse component of the solar radiation [Wm⁻²].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The recently added documentation example featured the period before the units.

I think this probably deserves a vote, mostly just a final decision.

@RDaxini RDaxini modified the milestones: v0.11.2, v0.11.3 Dec 13, 2024
Comment on lines -752 to +763
Diffuse horizontal irradiance. [Wm⁻²]
Diffuse horizontal irradiance. [Wm⁻²] See :term:`dhi`.

dni : numeric
Direct normal irradiance, see :term:`dni`. [Wm⁻²]

dni_extra : numeric
Extraterrestrial normal irradiance. [Wm⁻²]
Extraterrestrial normal irradiance, see :term:`dni_extra`. [Wm⁻²]
Copy link
Contributor Author

@RDaxini RDaxini Jan 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to choose one syntax over the other here?
Extraterrestrial normal irradiance, see :term:`dni_extra`. [Wm⁻²]
vs
Extraterrestrial normal irradiance. [Wm⁻²] See :term:`dni_extra`.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've come around to thinking the style is better if the unit is closely associated with the quantity name. In this case,

Extraterrestrial normal irradiance [Wm⁻²]. See :term:`dni_extra`

I deliberately put the period after the unit. I know we recently discussed that "point", but if I can, I'd like to change my vote to dotting after the unit.

I have long thought that using square brackets and putting the unit at the end of the description was some kind of readthedocs or markdown thing. It's clear now that it's just a style choice, and one that I think we can improve.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've come around to thinking the style is better if the unit is closely associated with the quantity name. In this case,

Extraterrestrial normal irradiance [Wm⁻²]. See :term:`dni_extra`

I deliberately put the period after the unit. I know we recently discussed that "point", but if I can, I'd like to change my vote to dotting after the unit.

I have long thought that using square brackets and putting the unit at the end of the description was some kind of readthedocs or markdown thing. It's clear now that it's just a style choice, and one that I think we can improve.

I agree, I am still in favour of this style. However, I think it's been outvoted if @AdamRJensen's review counts as a thumbs down on this comment :/

@kandersolar I can't fault your logic here, but what would you do in this case? As for the example you gave, since height already has a units I don't think there could possibly be any confusion(?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants