Many of our precision forecasting applications require accurate solar position modelling. We extended that towards shadow projection with digital elevation models. For instance, yesterday Mount Kilimanjaro looked like this:

The sun is the engine of our weather. Without it, there would be no weather, nor anything else for that matter. Astronomy has given us the tooling to accurately determine the position of the sun relatively to a given time and location. Meteorology tells us what that does to weather.

Nowadays, weather models capture large scale and synoptical weather quite well. MeteoGroup enters the mixture for precision requests; to include information that weather models cannot or choose not to include on a very fine level. Part of that service requires accurate modeling of solar positions and the resulting solar rays around orographicly challenging areas. Simply put: is there shade, or not.

Why shadows
Shaded areas provide shelter for the heat. That can be a good thing, but for forecasts it's usually not. A shaded valley could mean the forecast is off by a few degrees. Not to mention what shade does to solar power farm yields.

How to cast shadows
Luckily others have solved the problem of shadow casting before. We use a recipe from here [1].
The logic is simple. Given that we know where the sun is, we virtually place ourselves on every desired location and check whether the sun is not hidden behind a static object.

Like so:

sun surface projection

Projecting the sun on the surface [1]

Calculating solar positions
On the other hand we also need to know where the sun is at a given time and location. We use the same math as in [1]. For those interested, have a look here [2].

Height map
The last missing piece in the puzzle is an accurate elevation map of the earth.
The more accurate the map, the better the solution.
Luckily, there's an abundance of such - Digital Elevation Models they're called - made available freely.
We depend on NASA's shuttle radar topology mission data [3].

The latest version of this dataset accurately models the earth's surface up to roughly 30 by 30 square meter precision.
That's nearly good enough to discern buildings and large structures from one another!

Putting it together
Yesterday - the 5th of December 2016 - looked like this in the shadow landscape.

The alps on 5 December 2016

The area above spans about 100x100 kilometers. The orography is very challenging, immediately showing the value of this application.
Now let's have a look at a more colourful example. Below in the bottom right is Mount Fuji, Japan, also on the 5th.

Mount Fuji

And finally there's Mount Kilimanjaro in Tanzania.

Mount Kilimanjaro
![Mount Kilimanjaro](/content/images/2016/12/raycast_shade_kilimanjaro-2.gif)

The source code for producing these effects is available in Python [4] and in R [5].

Following steps
We have several ideas. The most obvious is to include the shadow maps as an additional feature in spatial interpolation models. Results will hopefully follow soon.

A second purpose would be to calculate the sky view factor in our road surface model. Shade greatly determines how far a road can heat during the day or cool in twilight and dusk.