You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Input parameter naming convention - time vs times #2231
A good guiding principle may be to use plural words only when multiple values are necessary. For example, I think times is an appropriate name for the _get_sample_intervals(times, win_length) function, since it actually requires multiple timestamps. For other functions (e.g. hour_angle) that work fine with single timestamps, would we say that the function returns hour_angles, and do the rise/set functions return sunrises and sunsets? Here I think singular makes sense.
An argument against time in general is that it has the same name as a python standard library.
Reacted by Rajiv Daxini, Adam R. Jensen and Mark Mikofski
An argument against time in general is that it has the same name as a python standard library.
Good point. I overlooked this when agreeing with "time" with the singular/plural grammar in mind. I retract my vote; pvlib should not shadow any standard python names.
An argument against time in general is that it has the same name as a python standard library.
Good point. I overlooked this when agreeing with "time" with the singular/plural grammar in mind. I retract my vote; pvlib should not shadow any standard python names.
As the shadowing only occurs within the function, this doesn't seem so serious. It will not cause any problems for the user of the function.
As the shadowing only occurs within the function, this doesn't seem so serious. It will not cause any problems for the user of the function.
Yes, but we can't anticipate how a user structures their code.
I don't see an issue and fully agree with @adriesse on that it is not a problem. Can you provide an example of what you have in mind? AFAIK, this parameter will only override time identifier inside its namespace, the pvlib func.
in #2237 to add another example and test that all works flawlessly, but reading through its documentation I think the appropriate rename is date instead of times. From the docs (and code) of the internal function it uses:
No opinion here for pvlib, but in my own work I standardized on time for many dates ago. I see date simply as low-resolution time, with the time-of-day unspecified.
Activity
RDaxini commentedon Sep 28, 2024
Related: #1253
In particular this comment (btw I have updated the table with time/times now thanks to this issue)
adriesse commentedon Oct 1, 2024
I vote for
time.AdamRJensen commentedon Oct 1, 2024
I personally prefer times 😋
kandersolar commentedon Oct 1, 2024
A good guiding principle may be to use plural words only when multiple values are necessary. For example, I think
timesis an appropriate name for the_get_sample_intervals(times, win_length)function, since it actually requires multiple timestamps. For other functions (e.g.hour_angle) that work fine with single timestamps, would we say that the function returnshour_angles, and do the rise/set functions returnsunrisesandsunsets? Here I think singular makes sense.An argument against
timein general is that it has the same name as a python standard library.cwhanse commentedon Oct 1, 2024
Good point. I overlooked this when agreeing with "time" with the singular/plural grammar in mind. I retract my vote; pvlib should not shadow any standard python names.
adriesse commentedon Oct 2, 2024
As the shadowing only occurs within the function, this doesn't seem so serious. It will not cause any problems for the user of the function.
cwhanse commentedon Oct 2, 2024
Yes, but we can't anticipate how a user structures their code.
echedey-ls commentedon Oct 2, 2024
I don't see an issue and fully agree with @adriesse on that it is not a problem. Can you provide an example of what you have in mind? AFAIK, this parameter will only override
timeidentifier inside its namespace, the pvlib func.cwhanse commentedon Oct 2, 2024
I can't provide an example where code fails to run. And we've had
timeas a function parameter for years, so I yield my objection.echedey-ls commentedon Oct 2, 2024
No problem.
echedey-ls commentedon Oct 2, 2024
I was about to edit this function:
pvlib-python/pvlib/solarposition.py
Line 392 in 4cfda4a
in #2237 to add another example and test that all works flawlessly, but reading through its documentation I think the appropriate rename is
dateinstead oftimes. From the docs (and code) of the internal function it uses:pvlib-python/pvlib/spa.py
Line 1106 in 29b1f86
These "
times" must be at 00:00. Funny, isn't it?Feel free to weight in if there are other words to be considered that I've missed.
adriesse commentedon Oct 3, 2024
No opinion here for pvlib, but in my own work I standardized on
timefor many dates ago. I seedatesimply as low-resolutiontime, with the time-of-day unspecified.echedey-ls commentedon Oct 3, 2024
That did convince me.
echedey-ls commentedon Oct 11, 2024
Shall
transit_sunrise_sunset:pvlib-python/pvlib/spa.py
Line 1106 in cbe4cc5
be changed to
timetoo? It requires the time part to be exactly at00:00.