Skip to content

feature - Feels like#4

Merged
KristofferRisa merged 2 commits intomainfrom
feat-feels-like
Jan 1, 2026
Merged

feature - Feels like#4
KristofferRisa merged 2 commits intomainfrom
feat-feels-like

Conversation

@KristofferRisa
Copy link
Owner

Pull Request

Description

Adds industry-standard "feels like" temperature calculations to Sky CLI using Wind Chill and Heat Index formulas. This enhancement provides users with more accurate weather information by showing how temperature actually feels on the skin, accounting for wind and humidity effects.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Performance improvement
  • Code refactoring
  • CI/CD changes

Changes Made

Core Functionality

  • Wind Chill Calculation: Applied when temperature ≤ 10°C AND wind speed > 4.8 km/h using the North American/UK standard formula (2001)
  • Heat Index Calculation: Applied when temperature ≥ 27°C AND humidity > 40% using the US National Weather Service Rothfusz regression
  • Moderate Conditions: Returns actual temperature when neither formula applies

Implementation Details

  • Added FeelsLike() method to Weather struct (internal/models/weather.go:72)
  • Added FeelsLike() method to HourlyForecast struct (internal/models/weather.go:95)
  • Implemented three core calculation functions:
  • calculateApparentTemperature() - dispatcher that selects appropriate formula
  • calculateWindChill() - Wind Chill formula using temperature (°C) and wind speed (km/h)
  • calculateHeatIndex() - Heat Index formula using Rothfusz regression

Formatter Updates

All four formatters now display feels like temperature:

  • Full Format: Temperature: 1.1°C (feels like -2.8°C)
  • JSON Format: Added feels_like field to all weather/forecast objects
  • Summary Format: Inline display with temperature
  • Markdown Format: Listed alongside temperature in all tables

Documentation

  • Added comprehensive "Feels Like Temperature" section to README.md
  • Explained when each formula is applied with practical examples
  • Documented the importance for cold climates like Norway
  • Added examples for all output formats

Testing

  • Unit tests added/updated
  • All tests pass locally (go test ./...)
  • Tested on multiple platforms (if applicable)
  • Manual testing completed

Test commands:

# Run all tests with coverage
go test ./... -cover

# Run model tests specifically
go test ./internal/models -v

# Manual testing examples
go run ./cmd/sky current --format full
go run ./cmd/sky current --format json
go run ./cmd/sky forecast --hours 24
go run ./cmd/sky daily --days 7

Test Coverage:

  • Added 17 new test cases (292 lines) in internal/models/weather_test.go
  • Tests cover:
    • Wind Chill zone (5 test cases)
    • Heat Index zone (3 test cases)
    • Moderate zone (5 test cases)
    • Weather.FeelsLike() method (3 test cases)
    • HourlyForecast.FeelsLike() method (3 test cases)
    • Consistency between Weather and HourlyForecast (1 test case)
  • Overall model coverage increased from 96.3% to 97.5%
  • Total test count: 51 test cases, all passing

Checklist

  • Code follows the project's style guidelines
  • Self-review of code completed
  • Comments added for complex logic
  • Documentation updated (if needed)
  • No new warnings or errors introduced
  • Related issues linked

Related Issues

Before (Temperature only):
Temperature: 1.1°C

After (With feels like):
Temperature: 1.1°C (feels like -2.8°C)

JSON Output:

  {
    "temperature": 1.1,
    "feels_like": -2.8,
    "humidity": 70,
    "wind_speed": 2.6
  }

Additional Notes

Why This Feature Matters
For Norway and other cold climates, Wind Chill is critical information that helps users:

  • Understand how cold it actually feels on exposed skin
  • Make informed decisions about appropriate clothing

@KristofferRisa KristofferRisa self-assigned this Jan 1, 2026
@KristofferRisa KristofferRisa merged commit 57bccb6 into main Jan 1, 2026
16 checks passed
@KristofferRisa KristofferRisa deleted the feat-feels-like branch January 1, 2026 11:16
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