-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Breaking out parts of pvsystem.py? #436
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
Comments
@mikofski brought up something similar in #235. I agree that the I've also considered moving In any case, a subpackage might be preferable for API consistency and for keeping some kind of grouping for this related functionality. On the other hand, the Zen of Python says "flat is better than nested", so this too is up for debate. |
I think it makes a little more sense to break them out by model heritage,
because I would tend to add more complicated modeling aspects in an sapm
model, whereas if I just wanted to apply a few quick and dirty losses I
might use pvwatts.
…On Sun, Mar 4, 2018 at 8:45 AM, Will Holmgren ***@***.***> wrote:
@mikofski <https://github.com/mikofski> brought up something similar in
#235 <#235>.
I agree that the pvsystem.py module has grown to a difficult to mange
length. Would you rather see the module broken up by model heritage (e.g.
sapm.py, pvwatts.py, diode.py) or would you rather see it broken up by
model type (e.g. dcpower.py, acpower.py, iam.py).
I've also considered moving PVSystem (and maybe SingleAxisTracker) into a
separate module.
In any case, a subpackage might be preferable for API consistency and for
keeping some kind of grouping for this related functionality. On the other
hand, the Zen of Python says "flat is better than nested", so this too is
up for debate.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#436 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AH66AeDIewBlWKRj2-b8ZbtPDVA3K-aYks5tbBosgaJpZM4SbWhP>
.
|
I'm not in favor of breaking pvsystem into subpackages by model name (SAPM, Desoto, etc.). I am in favor of restructuring pvsystem by modeling step, and writing wrapper functions where we don't currently use them (the iam functions, for example), then moving the wrapped functions into a subpackage. As an example why I don't favor a 'sapm' subpackage, I believe that sapm_celltemp is the only cell temperature model in pvlib, currently. We would be better off to have a celltemp function that wraps celltemp_sapm (and celltemp_faiman and others) and use kwargs, like we do with irradiance functions. Some of the length in pvsystem can be reduced if I would ever get to writing pvlib.io. |
Good points @jforbess and @cwhanse. Looking only at the "easier" ideas... I think the only io related functions are
All together, that's about 30% of the module (2500 lines). |
I was playing around with a project structure like this:
It "stutters" a bit, but I think using different names in the stuttering parts would be more distracting than helpful. This would be a typical import into an user-facing API module like import pvlib-python.models.dc_device_iv.sdm.sdm as sdm
import pvlib-python.models.dc_device_iv.sdm.desoto.desoto as desoto A user-facing API import into a user's code would look like: import pvlib.pvsystem as pvsystem # To reiterate this could be renamed and possibly broken up |
@thunderfish24 thanks for the detailed proposal. Do you know of any python packages that use a similar structure, in particular separating out the core code at the root level? The closest that I can think of is matplotlib. |
This could be difficult packaging, see my recommend project layout and Python Package Authority. All items to be bundled in the pvlib package should be in |
Sorry if this is a duplicate, but has anyone considered breaking out the different module performance models in pvsystem.py into their own modules for better manageability?
For example, put the desoto model and sapm into their own modules.
The text was updated successfully, but these errors were encountered: