-
Notifications
You must be signed in to change notification settings - Fork 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
Standarizing pvlib typesetting of units - standarization for common variables? #2205
Comments
+1 to putting units with the variable names. As far as typesetting, my only complaint about option 3 is that I don't know how to type the superscript characters. I could learn but in reality I will end up searching the code for a function with that symbol, and copying it. |
+1
is it possible to define commands like you can in a latex file? For example, in latex, you can set something like \wm2 to be equal to Wm⁻². If that's possible in pvlib we could easily have a central set of definitions like this along with however we want the units to be rendered in the docs. It would be faster and more efficient when it comes to actually writing the docs too. ps. full transparency: copy/pasting is all I was ever doing with my superscripts anyway 😂 |
Given there already are discussions on breaking the contributing page into multiple sections (#2200), my take on this would be adding all the unicode superscripts to a page dedicated to docs and just write it all with them, for simplicity and also reading them through the
Cross-referencing #1421 |
+1 on standardization I can support subscripts as long as we have them written down somewhere that is easy to copy from. I think what needs to be done is to have a template function, which shows the preferred way of writing units, variable naming, etc. |
+1 to using subscripts as along as we have a place where they can easily be copied from. -1 on using special commands to do some kind of formatting (increases maintenance burden and doesn't seem any simpler for new users) Overall, I think we should create a template function that demonstrates the preferred way to do citations, units, parameter definitions, etc. |
#2209 --- we can define some easy-to-type abbreviations e.g. |wm2| for Wm⁻² so no need to locate and copy/paste special text Does that count as a special command...? I think | should be on most if not all keyboards with the \ key, right? Users could still copy and paste the units directly if they wanted though, even if typing something like |wm2| was available at the same time.
Agreed. I was thinking that in the split contributing page (#2210) we could have a style guide section where all information on existing (e.g. PEP 8) and new (references, units, etc.) styles could be explained. A template could easily be included here for illustration. |
@RDaxini , I'm afraid they are somewhat commands. I agree with @AdamRJensen that these substitution patterns are a burden for newcomers; also that they clutter the view and understanding of the functions via To address @cwhanse concern, I would say the best choice is to update the contributing section on docs, with superscripts, rather than come up with some special way of interpreting and handling them in sphinx. |
After a little while I understood what was meant by command, I misunderstood at first 😅
Seems like no-one disagrees on this here so I'll close #2209 and we can move forward with adding a simple small table/list into the new style guide section from which users can easily copy/paste, and be informed of the style rule. |
I don't really mind, but yeah, I can manage that. I think I will also try to do the docstring template in the same PR. I can't tell when I'll open it - expect some delay. |
Cool. If you want to split anything, just let me know. Happy to help |
BTW, in ipython you can enter things like |
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:
W/m^2
(in https://pvlib-python.readthedocs.io/en/latest/reference/generated/pvlib.irradiance.dirint.html):math:`W/m^2`
(in https://pvlib-python.readthedocs.io/en/latest/reference/generated/pvlib.irradiance.get_ground_diffuse.html)W/m²
orWm⁻²
,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.:
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
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.
The text was updated successfully, but these errors were encountered: