Skip to content

Conversation

@jerluc
Copy link
Contributor

@jerluc jerluc commented Sep 10, 2025

  • Related to Deprecations Tracker #2396
  • I am familiar with the contributing guidelines
  • Tests added
  • Updates entries in docs/sphinx/source/reference for API changes.
  • 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.

Per some related discussion in #2396, this adds support for pvlib.iotools.read_tmy3 to accept either a str, PathLike, or file-like object (text-only) as input. This patch reuses the _file_context_manager helper to remain consistent with how pvlib handles normalizing str/PathLike/file-like objects, while also introducing a minor backward-compatible improvement to the helper.

@jerluc
Copy link
Contributor Author

jerluc commented Sep 10, 2025

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!

@AdamRJensen
Copy link
Member

Author

@jerluc We always have a tentative version, so you can add the Whatsnew entry here.

@jerluc
Copy link
Contributor Author

jerluc commented Sep 11, 2025

@jerluc We always have a tentative version, so you can add the Whatsnew entry here.

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)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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.

Copy link
Contributor Author

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.

@AdamRJensen AdamRJensen added enhancement io remote-data triggers --remote-data pytests labels Sep 15, 2025
@kandersolar kandersolar added this to the v0.13.1 milestone Sep 16, 2025
@kandersolar kandersolar merged commit 2aa17b4 into pvlib:main Sep 18, 2025
1 check passed
@kandersolar
Copy link
Member

Thanks @jerluc!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement io remote-data triggers --remote-data pytests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants