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
repr() on a ModelChain instance fails if orientation_strategy = 'None' #352
If orientation_strategy is set to 'None' when creating a ModelChain, the attribute self._orientation_strategy is set to None in the orientation_strategy setter (from line 353).
In the __repr__ method, just above, each attribute is printed thanks to the inner function getmcattr(self, attr). And if the argument attr is None, then the function returns None.
Then, when building the returned chain, None is passed to the concatenation operator, which fails.
changed the title [-] `repr()` on a `ModelChain` instance fails if `orientation_strategy = 'None'`[/-][+] repr() on a ModelChain instance fails if orientation_strategy = 'None'[/+]on Jul 25, 2017
I'm unfamiliar with the pull request system in third-party project (even with mine, I'm still learning GitHub).
I naïvely tried:
git push origin fix_repr_model_chain
but of course I'm not able to access the pvlib repository.
Concerning the fix, I think that using format is slightly more clean and pythonic than concatenation with '+', and is less error prone. I would use format for the 3 classes.
I am happy to help new contributors get oriented here. Start with this section of our documentation and then let me know if you have further questions:
Activity
[-] `repr()` on a `ModelChain` instance fails if `orientation_strategy = 'None'`[/-][+] repr() on a ModelChain instance fails if orientation_strategy = 'None'[/+]jgaffiot commentedon Jul 25, 2017
Can be fixed by changing line 344 of
modelchain.pyto:wholmgren commentedon Jul 25, 2017
Thanks, it would be great if you could submit a pull request with the fix.
wholmgren commentedon Jul 25, 2017
PVSystemandSingleAxisTracker__repr__methods enclosegetattr(self, attr)in thestrfunction rather than usingformat:https://github.com/pvlib/pvlib-python/blob/master/pvlib/pvsystem.py#L159
https://github.com/pvlib/pvlib-python/blob/master/pvlib/tracking.py#L62
Perhaps we should use the same approach in all three
__repr__methods. It's not clear to me if one is better than the other.jgaffiot commentedon Jul 25, 2017
Hi wholmgren,
I'm unfamiliar with the pull request system in third-party project (even with mine, I'm still learning GitHub).
I naïvely tried:
but of course I'm not able to access the
pvlibrepository.Concerning the fix, I think that using
formatis slightly more clean and pythonic than concatenation with '+', and is less error prone. I would useformatfor the 3 classes.wholmgren commentedon Jul 25, 2017
I am happy to help new contributors get oriented here. Start with this section of our documentation and then let me know if you have further questions:
http://pvlib-python.readthedocs.io/en/latest/contributing.html#how-to-contribute-new-code
jgaffiot commentedon Jul 25, 2017
I have submitted a pull request (#353) to fix the bug.
Fix issue #352 and homogenize string concatenation across the code (#353