# How the sunrise and sunset scores work

> What goes into the colour score and the clear sun score for each sunrise and sunset, and why a cloudless evening rates Poor for colour.

Developers · Concept · https://wxalerts.org/docs/developers/concepts/sky-scores/

The route and fields are on the [sunrise and sunset reference](/docs/api/sky/).
Every event gets two scores from 0 to 100. Both share the categories `poor`
(below 25), `fair` (25 to below 50), `good` (50 to below 75) and `great` (75
and up).

## Colour

The colour score asks whether the low sun will light up cloud from below. It
is the product of five factors, times 100, clamped to 0 to 100:

- **Canvas.** Mid and high cloud overhead for the sun to light. A broken deck
  (about 30% to 70% cover) is best and scores the full factor. A clear sky
  still glows a little (0.15 of full); a solid overcast is dull (0.45).
- **Local low cloud.** A low deck overhead (base below 2 km) hides the show
  from the observer.
- **Light path.** The light has to reach the canvas. Low cloud, a near solid
  mid deck or rain between you and the horizon, sampled 25 to 300 km toward
  the sun, blocks it. In the lower 48, so can terrain: the ground toward the
  sun is checked against a ray to the canvas through the colour window, from
  sunset until the sun is two degrees down.
- **Haze.** A little aerosol warms the colours and can lift the score slightly;
  thick smoke, fog or murk mutes them.
- **Rain** at the observer, from the chance of precipitation.

## Clear sun

The clear sun score asks the opposite question: will the disc itself be
visible right down to the horizon? A cloudless sky is its best case, which the
colour score rates Poor by design. It multiplies four factors:

- **Low cloud overhead.** Fog or a low deck hides the sun outright.
- **The sun line.** Cloud at every level along the path toward the sun, with
  the nearest points weighted most. Thin high cloud counts for part, since it
  often lets a dimmed disc through.
- **Haze.** Light haze only reddens the disc; thick smoke or murk hides it.
- **Rain** at the observer.

Terrain does not count against it: a sun setting behind a ridge is still a
clear sun, only earlier.

## Categories

Both scores share the same categories.

| score | category |
| --- | --- |
| below 25 | `poor` |
| 25 to below 50 | `fair` |
| 50 to below 75 | `good` |
| 75 and up | `great` |
