Skip to content

restructure pvlib/spectrum #2136

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 12 commits into from
Aug 5, 2024
Merged

Conversation

RDaxini
Copy link
Contributor

@RDaxini RDaxini commented Jul 18, 2024

  • Closes Proposal: split up mismatch.py #2125
  • I am familiar with the contributing guidelines
  • Adds description and name entries in the appropriate "what's new" file in docs/sphinx/source/whatsnew for all changes. Includes link to the GitHub Issue with :issue:`num` or this Pull Request with :pull:`num`. Includes contributor name and/or GitHub username (link with :ghuser:`user`).
  • New code is fully documented. Includes numpydoc compliant docstrings, examples, and comments where necessary.
  • Pull request is nearly complete and ready for detailed review.
  • Maintainer: Appropriate GitHub Labels (including remote-data) and Milestone are assigned to the Pull Request and linked Issue.

Context and discussion in #2125

RDaxini added 5 commits July 18, 2024 11:41
update __init__.py
rename mismatch.py to spectral_mismatch.py
create spectral_irradiance.py, spectral_response.py
resolve circular imports (attempt)
@echedey-ls
Copy link
Contributor

With #2100 a typo was introduced into the list of allowed materials. It is the following:

/home/docs/checkouts/readthedocs.org/user_builds/pvlib-python/checkouts/2136/pvlib/spectrum/spectral_mismatch.py:docstring of pvlib.spectrum.spectral_mismatch.spectral_factor_firstsolar:40: WARNING: Bullet list ends without a blank line; unexpected unindent.
/home/docs/checkouts/readthedocs.org/user_builds/pvlib-python/checkouts/2136/pvlib/spectrum/spectral_mismatch.py:docstring of pvlib.spectrum.spectral_mismatch.spectral_factor_firstsolar:37: WARNING: Bullet list ends without a blank line; unexpected unindent.

Can you address it here? It will only require adding some indent (two spaces) to the module. line, no. 159. I can't comment on the moved file since it's not an introduced change.

Sorry for not doing a deep review at that moment.

@RDaxini
Copy link
Contributor Author

RDaxini commented Jul 18, 2024

Thanks @echedey-ls @cwhanse for highlighting these points

/home/docs/checkouts/readthedocs.org/user_builds/pvlib-python/checkouts/2136/pvlib/spectrum/spectral_mismatch.py:docstring of pvlib.spectrum.spectral_mismatch.spectral_factor_firstsolar:40: WARNING: Bullet list ends without a blank line; unexpected unindent.
/home/docs/checkouts/readthedocs.org/user_builds/pvlib-python/checkouts/2136/pvlib/spectrum/spectral_mismatch.py:docstring of pvlib.spectrum.spectral_mismatch.spectral_factor_firstsolar:37: WARNING: Bullet list ends without a blank line; unexpected unindent.

Done. Where do you check to find these error messages? I remember at the time, when adding the extra ``, I had to create a new line, and wondering how/whether to indent it. Since the main tests passed I figured there was not an issue (I was wrong)

Can we add a definition of "spectral mismatch"?

Done. Used your definition. What was there originally was just the original text from the mismatch.py file; it was not particularly insightful 😅 I followed a similar style when writing a sentence for the two new files. Let me know if you think any of the other files would benefit from any additional definitions/explanations. Happy to get it done in this same PR.

@RDaxini
Copy link
Contributor Author

RDaxini commented Jul 18, 2024

Since this is a non-user-facing change, do I still need a whatsnew entry? I think it is a significant change, but not one that affects how users interact with pvlib-python (right?), just how we maintain it

@cwhanse
Copy link
Member

cwhanse commented Jul 18, 2024

Yes to whatsnew, they also serves as notes for maintainers.

@cwhanse cwhanse added this to the v0.11.1 milestone Jul 18, 2024
@cwhanse cwhanse added the GSoC Contributions related to Google Summer of Code. label Jul 18, 2024
@RDaxini
Copy link
Contributor Author

RDaxini commented Jul 18, 2024

also serves as notes for maintainers.

That's good, makes sense. I have added a whatsnew entry to enhancements. Just let me know if there's anything else

breaking -> breaking up
@echedey-ls
Copy link
Contributor

Where do you check to find these error messages?

I wrote a comment recently in which I elaborated on that #2124 (review)

You should get to https://readthedocs.org/projects/pvlib-python/builds/ , head to the latest build of your PR, click on the last box with the command python -m sphinx -T -b html -d _build/doctrees -D language=en . $READTHEDOCS_OUTPUT/html and find all warning, error, critical. Some of them are persistent across PRs.

Since the main tests passed I figured there was not an issue

I hate too that the workflow fails only on critical failures IIRC.

@RDaxini
Copy link
Contributor Author

RDaxini commented Jul 18, 2024

@echedey-ls thanks for the explanation! And sorry I missed your previous comment:( Seen it now. That's all very helpful 👍🏽

Copy link
Member

@kandersolar kandersolar left a comment

Choose a reason for hiding this comment

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

LGTM after a few easy edits. Thanks @RDaxini! I am surprised at how quickly the old mismatch.py grew to 1000+ lines of code...

@RDaxini
Copy link
Contributor Author

RDaxini commented Jul 30, 2024

I am surprised at how quickly the old mismatch.py grew to 1000+ lines of code...

@kandersolar I guess we have been quite busy lately 😅

I think I have updated everything according to your latest comments now. Let me know if there's anything else.

@kandersolar
Copy link
Member

Oh, I guess we should also split up pvlib/tests/test_spectrum.py to reflect the new structure. @RDaxini want to add that to this PR, or do a follow-up?

@RDaxini
Copy link
Contributor Author

RDaxini commented Aug 5, 2024

Oh, I guess we should also split up pvlib/tests/test_spectrum.py to reflect the new structure.

@kandersolar split up in what way? Do you mean to reorganise the functions within the test_spectrum.py file in ordered groups, or create new files such as test_spectrum_response.py, test_spectrum_irradiance.py?
I think the latter sounds like a decent idea, not sure if I understood correctly though. In this case, would a folder "spectrum" with individual test files be a good idea?

@RDaxini want to add that to this PR, or do a follow-up?

I can do a follow up PR. There is a lot going on in this one already to reorganise the functions, so a separate one for the tests might help keep the changes in neater/compact chunks.

@kandersolar
Copy link
Member

In this case, would a folder "spectrum" with individual test files be a good idea?

Yep, like how the structure of pvlib/tests/iotools matches that of pvlib/iotools. a 1:1 correspondence of files, with the test ones having test_ at the front of the filenames.

RDaxini added a commit to RDaxini/pvlib-python that referenced this pull request Aug 5, 2024
Restructure tests in line with mismatch.py restructure (pvlib#2136)
@RDaxini RDaxini mentioned this pull request Aug 5, 2024
5 tasks
@kandersolar kandersolar merged commit 72185cb into pvlib:main Aug 5, 2024
30 checks passed
@kandersolar
Copy link
Member

Thanks @RDaxini!

@RDaxini RDaxini deleted the restructure_pvlib/spectrum branch August 5, 2024 18:14
kandersolar pushed a commit that referenced this pull request Aug 7, 2024
* Split test_spectrum.py files

Restructure tests in line with mismatch.py restructure (#2136)

* fix conftest import

* Update test_mismatch.py

add spectrl2_data function to mismatch.py

* Update v0.11.1.rst

* create pvlib\tests\spectrum\conftest.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement GSoC Contributions related to Google Summer of Code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: split up mismatch.py
4 participants