← Back to SunWhen

How SunWhen Works

The Simple Version

SunWhen answers one question: "When will I see the sun?" We combine weather forecasts with sunrise/sunset data to predict clear sky periods at your exact location.

Just open the app, allow location access, and instantly see when the next sunny period will be.

Step-by-Step Process

1

Location Detection

When you open SunWhen, we request your location using your browser's geolocation API. This gives us your precise coordinates (latitude and longitude) needed for accurate forecasts.

2

Weather Data Retrieval

Using your coordinates, we fetch hourly weather forecasts from Open-Meteo, a reliable open-source weather API. We retrieve 7 days of hourly data including cloud cover percentages and daylight information.

3

Sun Visibility Analysis

Our algorithm analyzes each hour to determine if the sun will be visible. We consider two factors: Is it daytime? Is cloud cover below your threshold? Hours that meet both criteria are marked as "clear."

4

Clear Period Detection

We group consecutive clear hours into "clear periods" and calculate their duration. This tells you not just when the sun will appear, but how long you can expect it to last.

5

Results Display

Finally, we present the information in an easy-to-read format: the next clear period, upcoming sunny times, current conditions, and a 48-hour visual forecast.

Understanding Cloud Cover

Cloud cover is measured as a percentage from 0% (completely clear) to 100% (completely overcast). Here's what different levels typically mean:

You can adjust your personal threshold in the settings. A lower threshold means you want clearer skies; a higher threshold means you're okay with some clouds.

The 48-Hour Chart

The visual chart shows cloud cover for the next 48 hours:

The height of each bar represents the cloud cover percentage. The dashed line shows your current threshold setting.

Data Sources

Weather Data: Open-Meteo

We use the Open-Meteo API, which aggregates data from national weather services worldwide. It provides:

Astronomical Data

Sunrise and sunset times are calculated based on your coordinates and the current date. This ensures we only show sun visibility during actual daylight hours.

Accuracy and Limitations

Weather forecasting is inherently uncertain. Here's what to expect:

We recommend checking back regularly for updated predictions, especially for activities planned more than a day ahead.

Tips for Best Results

  1. Allow precise location: More accurate coordinates mean better forecasts
  2. Adjust your threshold: Find the cloud cover level that works for your needs
  3. Check the chart: Look for patterns in the 48-hour forecast
  4. Refresh before activities: Get the latest data before heading out
  5. Consider the duration: Longer clear periods are more reliable