-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Allows reading TMY data from a Path or file-like object #2544
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
Conversation
|
For the maintainers: I think the checklist item to add a description to the "What's new" file is a step for once a version number is determined, but let me know if that's not the case and I can follow up! |
5c36e9e to
be82a62
Compare
Thanks for the pointer @AdamRJensen! Just added a note about this change in 8181548 and Sphinx output looks sane to me locally. |
tests/iotools/test_tmy.py
Outdated
|
|
||
| def test_read_tmy3_buffer(): | ||
| with open(TMY3_TESTFILE) as f: | ||
| tmy.read_tmy3(f, map_variables=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| tmy.read_tmy3(f, map_variables=False) | |
| tmy.read_tmy3(f, map_variables=False) | |
| assert 'GHI source' in data.columns |
I suggest adding a simple assertion to make sure that the dataframe actually contains something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion @AdamRJensen (maybe I should've read the test just below 😆). I've added it in 970688e, in addition to a check for the parsed data being 8760 rows, which I believe is correct for TMY3.
|
Thanks @jerluc! |
docs/sphinx/source/referencefor API changes.docs/sphinx/source/whatsnewfor 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`).remote-data) and Milestone are assigned to the Pull Request and linked Issue.Per some related discussion in #2396, this adds support for
pvlib.iotools.read_tmy3to accept either astr,PathLike, or file-like object (text-only) as input. This patch reuses the_file_context_managerhelper to remain consistent with how pvlib handles normalizingstr/PathLike/file-like objects, while also introducing a minor backward-compatible improvement to the helper.