Skip to content

Use public SolarPosition API for UWISC solar-angle derivation#90

Merged
bnb32 merged 3 commits into
bnb/gk2afrom
copilot/fix-review-comment-3325684192
Jun 8, 2026
Merged

Use public SolarPosition API for UWISC solar-angle derivation#90
bnb32 merged 3 commits into
bnb/gk2afrom
copilot/fix-review-comment-3325684192

Conversation

Copilot AI commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

This PR addresses the review concern that preprocessing relied on private rex internals (SolarPosition._zenith / _azimuth), which are unstable across upstream upgrades. The implementation now uses the public SolarPosition interface while preserving existing 2D output behavior.

  • Solar angle derivation now uses public API

    • Replaced private helper calls in BaseUwiscDataModel with:
      • SolarPosition(time_index, lat_lon_pairs).zenith
      • SolarPosition(time_index, lat_lon_pairs).azimuth
    • Lat/lon grids are flattened into (N, 2) pairs for SolarPosition, then reshaped back to the original spatial grid.
  • Focused regression coverage

    • Added a preprocessing unit test that monkeypatches SolarPosition and verifies:
      • the expected (lat, lon) pair ordering passed into the constructor,
      • zenith and azimuth outputs are reshaped back to (south_north, west_east).
solar_pos = SolarPosition(
    self.time_index,
    np.column_stack((lats.ravel(), lons.ravel())),
)
zenith = np.asarray(solar_pos.zenith).reshape(lats.shape)
azimuth = np.asarray(solar_pos.azimuth).reshape(lats.shape)

Copilot AI changed the title [WIP] Fix code based on review comment 3325684192 Use public SolarPosition API for UWISC solar-angle derivation Jun 4, 2026
Copilot finished work on behalf of bnb32 June 4, 2026 01:28
Copilot AI requested a review from bnb32 June 4, 2026 01:28
@bnb32 bnb32 marked this pull request as ready for review June 8, 2026 17:08
@bnb32 bnb32 merged commit f3c4f96 into bnb/gk2a Jun 8, 2026
3 checks passed
@bnb32 bnb32 deleted the copilot/fix-review-comment-3325684192 branch June 8, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants