Skip to content

Conversation

@Orinks
Copy link
Owner

@Orinks Orinks commented Feb 12, 2026

Summary

Pairs NWS daytime/nighttime forecast periods to show high/low temperatures, matching how Visual Crossing already works.

How it works

NWS returns alternating day/night periods (e.g., "Today" 34°F, "Tonight" 16°F). After parsing, daytime periods now get temperature_low populated from the following nighttime period. The display layer already formats this as "34°F / 16°F" when temperature_low is set.

Changes

  • weather_client_nws.py: After parsing all periods in parse_nws_forecast, iterates through and pairs daytime periods with the next nighttime period using the isDaytime flag
  • tests/test_nws_high_low.py: 6 tests covering day/night pairing, night-first forecasts, single periods, empty data, and consecutive daytime periods

Edge cases handled

  • Forecast starts at night (evening request): first period has no low
  • Single daytime period with no following night: no crash, no low
  • Consecutive daytime periods: no incorrect pairing

NWS returns alternating daytime/nighttime forecast periods, each with
a single temperature. This pairs consecutive day/night periods to
populate temperature_low on daytime periods, matching what Visual
Crossing already provides. The display layer already handles showing
'High / Low' when temperature_low is set.
@Orinks Orinks force-pushed the feature/nws-high-low-temps branch from c611ac5 to dec9010 Compare February 12, 2026 16:52
@Orinks Orinks merged commit 16b3740 into dev Feb 12, 2026
6 checks passed
@Orinks Orinks deleted the feature/nws-high-low-temps branch February 12, 2026 16:56
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.

1 participant