Repository navigation
Migrate _parse_bsrn and _parse_epw logic into read_bsrn and read_epw - #2934
DresdenGman wants to merge 2 commits into
Conversation
|
Closing this since the contributing guidelines have not been followed. Will consider re-opening if compliance is achieved. Core guidelines were also highlighted to you in #2932 (see #2932 (comment)). |
|
Hi @RDaxini — thanks for pointing this out, and apologies for missing the required template. I've updated the PR description with the full pvlib checklist and completed the applicable items. I've also reviewed the contributing guidelines and the iotools code paths and tests involved in this change. I also saw the earlier discussion on #2469 about the familiarity this task requires. I completely understand if you'd prefer to leave it closed on that basis; but if the PR as updated now meets the project's requirements, I'd be grateful if you'd consider reopening it for review. Either way, thank you for your time. |
Closes #2469
Summary
As proposed in #2469, the parsing logic from the deprecated public
parse_bsrnandparse_epwfunctions still sat in the private helpers_parse_bsrnand_parse_epw, leavingbsrn.pyandepw.pystructured differently from the otheriotoolsmodules and duplicating documentation. This PR moves that logic intoread_bsrnandread_epwand deletes the private helpers. (The deprecated public functions were already removed in v0.16.0, so the helpers had no callers outside these two modules — 4 call sites in total.)Changes
pvlib/iotools/bsrn.py: moved the body of_parse_bsrnverbatim intoread_bsrn; updatedget_bsrnto callread_bsrnwith the in-memory buffer (a pathread_bsrnalready supports); removed_parse_bsrnand its duplicated docstring.pvlib/iotools/epw.py: inlined the body of_parse_epwintoread_epw; updated the HTTP branch to build aStringIOand go through_file_context_managerlike the other input paths; removed_parse_epwand its duplicated docstring.fbuf→f); the dispatch around them (get_bsrn, andread_epw's HTTP branch) is what changed. The parser implementations are moved without intended semantic changes; the before/after comparisons below demonstrate identical outputs for the tested cases.docs/sphinx/source/whatsnew/v0.16.2.rst: added a maintenance entry.Tests
Existing:
test_bsrn.py+test_epw.pygave 10 passed / 3 skipped before this change (the skips are the credential-gated remote BSRN tests) and give the same results after it.Behavior comparison: 7 cases (BSRN from .gz with defaults and with all longwave-radiation columns, BSRN from .dat, BSRN via a gzip buffer; EPW with defaults, with
coerce_year=2015, and viaStringIO) were compared before vs. after — DataFrame value hashes, shapes, and metadata fingerprints are identical in every case. Downstream checks: theLocation.from_epwtest passes andtest_pvgis.py(which callsread_epwinternally) is 29 passed.New mocked tests for the two rerouted entry points (4 tests, bringing the two files to 14 passed / 3 skipped):
get_bsrnis exercised end-to-end against a mocked FTP connection returning the sample gzip bytes — the result is value-identical to the localread_bsrnpath, and a spy check confirmsread_bsrnis called exactly once with the buffer and with a non-defaultlogical_recordsforwarded verbatim;read_epwis exercised through a mockedurlopen, value-identical to the local path, including forwarding ofcoerce_year.Closes Migrate functionality from private _parse_bsrn and _parse_epw to their read functions #2469
I am familiar with the contributing guidelines
I attest that all AI-generated material has been vetted for accuracy and is in compliance with the pvlib license
Tests added
Adds description and name entries in the appropriate "what's new" file in
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`).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.