Repository navigation
Conversation
Hey @LYUml! 🎉Thanks for opening your first pull request! We appreciate your If AI is used for any portion of this PR, you must vet the content Finally, be sure the PR description includes the PR |
Member
|
Maintainers are busy people. We're not going to read seven paragraphs of AI text explaining the AI's PR. If you'd like to be successful here, please edit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the pvlib timestamp conversion reported in #2956. Thanks to @rajsingh1301 for isolating the input-format discrepancy and the leap-year case.
EPW input arrives with the fixed offset declared in its header. The previous conversion treated its local clock as UTC. This patch combines the selected TMY months on a non-leap calendar, converts the index to the requested time zone, and folds the converted rows into the requested year. Sorting the indexed frame keeps each observation with its timestamp and preserves column dtypes.
Effect on EPW users
The proposed behavior trusts the EPW header. This fixes Tokyo and exposes a discrepancy for files where the declared offset disagrees with the hourly values. At 45°N, 8°E, the bundled EPW and JSON files previously agreed for all 8,760 hours. The EPW header declares UTC+1. Its January 1 reading of 149 W/m² moves from 09:00 UTC to 08:00 UTC, one hour earlier than JSON. The release notes and API documentation direct users who need the PVGIS UTC series to
outputformat='json'.Verification
I replayed the same inputs through
get_pvgis_tmyon main (b8a02a4) and on this branch with default time arguments. The table counts hours out of 8,760 when EPW and JSON GHI agree at the same UTC timestamp (numpy.isclose). It includes nighttime zeros. The 45°N, 8°E files come from the repository. The other pairs are PVGIS v5.3 responses fetched on November 29, 2026.Differences in the raw PVGIS exports. I compared the original files directly, with identical coordinates and the 2005–2023 period. For New Delhi the same five-hour offset aligns all 8,760 temperature, humidity and pressure records. At 2018-05-25 00:00 UTC, however, the original EPW gives 0.00 and the JSON gives 31.85 W/m² for GHI. At 2015-06-29 00:00 UTC they give 28.85 and 0.00 respectively. The annual difference is 3.00 Wh/m², which reordering the rows cannot change. Tokyo also has 346 DNI mismatches after alignment. The cause inside PVGIS is unverified. This patch preserves the values supplied by the requested format. New Delhi EPW, New Delhi JSON.
The public API tests cover default arguments, positive and negative source offsets, a fractional source offset, an explicit output offset, year wrap, and a leap target year. Selecting February and March from a leap source year exposes the conversion-order bug described in the issue. Four of the five regression cases fail with the main-branch conversion. Three fail if the time zone is converted before the source months are placed on a non-leap calendar.
The offline PVGIS and EPW modules passed with pandas 1.5.0, 1.5.3, and 2.2.3. The full offline suite passed with pandas 3.0.5 and 3.1.1 (1,445 passed, 110 skipped, 94 remote tests deselected, 2 expected failures on each). The changed lines pass the repository's Flake8 check.
I also ran all ten live tests in
tests/iotools/test_pvgis.pyon this branch and clean main with a 180-second per-test timeout. On each revision six passed, including the year-coercion test, and the same four failed when comparing live weather with historical snapshots (test_get_pvgis_tmy,test_get_pvgis_tmy_kwargs,test_get_pvgis_tmy_csv, andtest_get_pvgis_tmy_epw). Even with the 2005–2023 period fixed, the service now selects January 2021 for 45°N, 8°E. The checked-in files use January 2018.PR checklist
Codex assisted with the implementation, tests and verification.