Skip to content

Standarizing pvlib typesetting of units - standarization for common variables? #2205

Closed
@echedey-ls

Description

@echedey-ls

Is your feature request related to a problem? Please describe.
As of now, units in the whole documentation are written with the own developer style, and there is no place that suggests which units should be used in any case.

Current typesetting includes:

  1. LaTeX like markup, e.g., W/m^2 (in https://pvlib-python.readthedocs.io/en/latest/reference/generated/pvlib.irradiance.dirint.html)
  2. Mathjax rendering using the Sphinx math role, e.g., :math:`W/m^2` (in https://pvlib-python.readthedocs.io/en/latest/reference/generated/pvlib.irradiance.get_ground_diffuse.html)
  3. Unicode plaintext using superscript numbers, optionally superscript dash to avoid the slash; e.g., W/m² or Wm⁻², Wm⁻²nm⁻¹ (in https://pvlib-python.readthedocs.io/en/latest/reference/generated/pvlib.spectrum.spectrl2.html)

(I can't find some comment in a review of my PRs or so talking about alternatives and views with @kandersolar and @AdamRJensen )

On one side new/current contributors don't have a clear guideline on what to do when writing units. Both in API docs and examples. On the other side, switching between docs and seeing different ways of writing it may confuse inexperienced users.
And it looks a bit crappy that each dev sticks to it's own style.

Now the topic moves to Variables and Symbols. I think that units that make a convention have a spot there, and can be used to template units out of there too. E.g.:

  • eta_inv | inverter efficiency <> in % or in [0,1]? (and the same goes for many of them)

Normalizing what units shall be used for each variable guarantees pvlib is a toolbox of tools that fit together.

Describe the solution you'd like
I personally think an homogeneous typesetting is beneficial for the project. And if I had to choose, I don't like cluttering the view with extra characters like ^2 when ² exists, so I'm +1 for homogenizing and changing to option 3. I somewhat agree with @RDaxini on using superscript minus sign .

Describe alternatives you've considered

  1. Proposing and pushing and agenda to adopt a complete PVlib Enhancement Proposals (PVEP) system the same way Python has PEPs, Numpy NEPs and Matplotlib MEPs, then convincing everyone that option 3 is the right path, because it is.
  2. Not doing anything 🙄

Additional context
When a decision on this is agreed, this would make for a good set of Easy and How-To-Contribute series of PRs for newcomers, conferences and workshops.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions