Allows reading TMY data from a Path or file-like object#2544
Allows reading TMY data from a Path or file-like object#2544kandersolar merged 5 commits intopvlib:mainfrom
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. |
|
|
||
| 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.
| 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.
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.