Skip to content

Distribute - Albedo - set vis and ir albedo to None when sun is down - #83

Open
jmichellehu wants to merge 1 commit into
mainfrom
fix_albedo_night_reset
Open

jmichellehu wants to merge 1 commit into
mainfrom
fix_albedo_night_reset

Conversation

@jmichellehu

@jmichellehu jmichellehu commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor
  • Zero-fill of vis and ir albedo from PR #27 (lines 193-194) overrides broadband albedo branch in SolarHRRR.calculate_net_solar
  • Results in zero albedo and net_solar radiation being made equivalent to incoming solar values
  • Explicit None definition ensures broadband albedo branch kicks in correctly
  • Expand tests to check for albedo values after sun is down period and assert net_solar < hrrr_solar everywhere

 - Zero-fill of vis and ir from PR #27 overrides broadband albedo branch in SolarHRRR.calculate_net_solar
 - Results in net_solar radiation being made equivalent to incoming solar
 - Explicit None definition ensures broadband albedo branch kicks in correctly
Copilot AI balanced review requested due to automatic review settings October 1, 2026 23:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The focused fix addresses the branch-selection bug and includes appropriate regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes HRRR net-solar calculation after nighttime steps by preserving broadband albedo selection.

Changes:

  • Resets visible and infrared albedo to None at night.
  • Adds regression tests for broadband albedo after nighttime.
File Description
smrf/​distribute/​albedo.py Clears spectral albedo values when sunlight is absent.
smrf/​tests/​distribute/​test_albedo.py Tests nighttime-to-daytime broadband albedo behavior.
smrf/​tests/​distribute/​test_solar_hrrr.py Verifies broadband albedo reduces HRRR net solar correctly.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@jmichellehu jmichellehu added the Data Anything related to input data (i.e. HRRR) label Oct 2, 2026
@jmichellehu
jmichellehu requested a review from a team October 2, 2026 00:08
@jomey

jomey commented Oct 2, 2026

Copy link
Copy Markdown
Member

Can we please make an effort and explain changes in PRs in a human way?

These auto-generated LLM descriptions make it hard to understand things. This is also a copy of the commit message and more context should be given in a PR

@jomey jomey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is also a need to further explain why this is needed with net solar only being calculated when the sun is up

@jmichellehu

Copy link
Copy Markdown
Contributor Author

There is also a need to further explain why this is needed with net solar only being calculated when the sun is up

Net solar is only calculated when the sun is up, but the albedo distribution is called at every timestep, day or night. So when illumination angles are None at night, the else branch kicks in when the sun is down and the albedo vis and ir grids are set to zero. Nothing resets them to None when the sun comes back up on that run day, so the grids are not None, and the broadband albedo branch gets skipped.

When using a broadband albedo source like SPIReS, this leads to net_solar == hrrr_solar for every sun-up timestep after the nighttime grids are set to zero. Even awsm resetting grids to None the following run day doesn't help the rest of the sun-up timesteps after the nighttime zero-setting timestep.

Theoretically (I didn't test this), this issue doesn't affect runs using the vis/ir pathway as new daytime values overwrite the nighttime zero grids. But setting the grids back to None goes back to the previous net solar behavior.

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

Labels

Data Anything related to input data (i.e. HRRR)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants