Skip to content

Improve clarity of code in pvsyst_celltemp (names and doc) #651

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

Merged
merged 5 commits into from
Jan 28, 2019
Merged

Improve clarity of code in pvsyst_celltemp (names and doc) #651

merged 5 commits into from
Jan 28, 2019

Conversation

adriesse
Copy link
Member

@adriesse adriesse commented Jan 22, 2019

  • Improves on the implementation of issue ENH: Implement PVSyst Cell Temperature Model #552
  • I am familiar with the contributing guidelines.
  • Fully tested. Added and/or modified tests to ensure correct behavior for all reasonable inputs. Tests (usually) must pass on the TravisCI and Appveyor testing services.
  • Updates entries to docs/sphinx/source/api.rst for API changes.
  • Adds description and name entries in the appropriate docs/sphinx/source/whatsnew file for all changes.
  • Code quality and style is sufficient. Passes LGTM and SticklerCI checks.
  • New code is fully documented. Includes sphinx/numpydoc compliant docstrings and comments in the code where necessary.
  • Pull request is nearly complete and ready for detailed review.

Brief description of the problem and proposed solution (if not already fully described in the issue linked to above):

I have tried to improve clarity of code in pvsyst_celltemp through changes to variables names and docstring, and also changed the name of one function parameter.

@adriesse adriesse changed the title Improve clarity of code through changes to variables names and docstring Improve clarity of code in pvsyst_celltemp (names and doc) Jan 22, 2019
Copy link
Member

@cwhanse cwhanse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments on code lines.

@adriesse
Copy link
Member Author

Here are some additional thoughts about things I did not include in the PR:

  • In the function argument list, I believe windspeed would be better placed after temperature, and given a default value--probably zero.
  • If alpha is to be exposed, then it could/should be dealt with in the same way as the loss factors rather than as an independent function argument. If this were done, then the name loss_factors would definitely no longer be appropriate, and I would suggest something like model_parms instead.
  • For my own work I still like dictionaries for presets, so my functions don't need to know about them. So I would use:
    • pvsyst_celltemp (poa, wind, temp, **freestanding) or
    • pvsyst_celltemp (poa, wind, temp, **model_parms['freestanding'])

I do have some new work on temperature models which will raise some additional interesting code integration questions, but that's still a few months away at best.

@wholmgren
Copy link
Member

In the function argument list, I believe windspeed would be better placed after temperature, and given a default value--probably zero.

For my own work I still like dictionaries for presets, so my functions don't need to know about them. So I would use: pvsyst_celltemp (poa, wind, temp, **freestanding) or pvsyst_celltemp (poa, wind, temp, **model_parms['freestanding'])

I agree with these proposals. They make the low level functions more flexible and more explicit. The doc strings can point users to the presets in the module-level dictionary. The PVSystem and ModelChain abstractions can still make the function a bit easier to use for common use cases.

We'd need a deprecation cycle to make the same changes to sapm_celltemp. I don't have a preference about if that happens for 0.6.1 or not.

@adriesse
Copy link
Member Author

Further changes anyone?

@wholmgren
Copy link
Member

Ok to merge if CI passes.

Copy link
Member

@cwhanse cwhanse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should have checked the argument order for the method earlier, sorry I did not catch that. I can't tell why the test is failing, @wholmgren any ideas?

@wholmgren
Copy link
Member

@cwhanse I think the failure was due to the mismatched arguments, but it looks ok now.

I just noticed that wind_speed is required in the PVSystem method but optional in the function. Is that the intended behavior?

The codecov test is failing for reasons unrelated to this PR and can be ignored.

Copy link
Member

@cwhanse cwhanse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more minor fix

@wholmgren wholmgren added this to the 0.6.1 milestone Jan 28, 2019
@cwhanse cwhanse merged commit f98e9ce into pvlib:master Jan 28, 2019
@cwhanse
Copy link
Member

cwhanse commented Jan 28, 2019

@adriesse thanks Anton!

@adriesse
Copy link
Member Author

You're welcome!

@adriesse adriesse deleted the celltemp branch February 1, 2019 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants