Sun statistics

Years back I built an isolated photovoltaic power system for a small island on the Finnish archipelago. The system, that has about 0.5 kWp/4.8 kWh capacity, has been running now more than 5 years without problems.

For planning purposes I wanted to be able to estimate insolation at the installation location and play with different aligments of the solar panel array. I ended up writing a astronomically accurate (that is to be taken literally) solar trajectory calculator with statistics computation. I used the PyEphem library by Brandon Rhodes, which provides astronomical calculations for Python. The library is a bit outdated from the design perspective, but it does the job well. In addition to sun, the library can track basically any celestial object on the sky.

For me, this was also one of my first glipses into modern API-type backend/frontend programming style. I created a backend REST API with Python Flask framework and a Javascript frontend, which was running on the now-infamous Angular framework.

Here, I have recreated the basic functionality from the REST API service. The frontend implementation here is written in plain jQuery with the map parts using d3.js.

Select location

You can select a location from a predefined list of cities, but the API can calculate statistics from any given coordinates.

City

The map is rendered as an SVG object using the d3.js library. The map projection is plate carrée, which means that is equirectangular. In this projection, meridians are vertical lines with equal spacing, and latitude circles are horizontal lines with equal spacing. It is not as distorted as the more common mercator projection, but it conserver neither directions nor distances.