Zurich Sky

… is the title of my most recent project. It’s a bit artsy, but I think some of the concepts behind it may also have practical applications in this world of ever more abundant webcam footage (maybe need to think a bit more on this point later).

In Zurich Sky, I destilled yearly aggregates of the sky over Zurich Switzerland. I did this by first scraping tons of images from the website of the Swiss domain registrar SWITCH. They have two webcams, one in Zurich one in the Alps, whose images are publicly accessible in their archive (thanks!).

Zurich Sky: Web-scraped sky colour over Zurich, Switzerland

Zurich Sky: Web-scraped sky colour over Zurich, Switzerland

The SWITCH archive features one image every hour. Luckily for my project, the URLs of the individual pictures adhere to a nice structured format which makes automatic downloading of several thousand images rather easy. An example is here:

(as can be seen from this webpage)

So, the URL encodes year, month and day (each twice) and the hour. I have written a Python script that iterates through all hours of every year between 2008 and 2012 and downloads the respective image. A standard year (non-leap year) has 8,760 of them.

I also wrote a second Python script that checks for data gaps. There have been some few hours for which my script didn’t get an image. I didn’t investigate this further (whether it was my internet connection, a hickup of Python/urllib2 or the Switch server or archive), but filled the gaps with the respective hour of an adjacent day. I did the same with the gap that is created by the change from normal time to daylight-saving time in spring (advancing the clock by one hour).

I then drew a binary (black-white) mask of the sky in the webcam picture. For the next processing step I shrunk all pictures to a smaller format, since otherwise processing time would have been very long. Iterating over all pictures of a year, I used the Python Image Library (PIL) to extract the average colour of the sky (employing a naïve approach of averaging the R,G,B values in the masked area) and record it in a file. The files of the years 2008 to 2012 have then been used to draw the Zurich Sky.

I first employed a fully browser- and vector-based approach which loaded the colour values from afore-mentioned files. It worked well in Chrome but was painfully slow in Internet Explorer. Thus I changed the representation to raster images. As a gimmick I also included a picture that aggregates (overlays) all years 2008–2012 into one. Using some HTML/JS/Jquery magic I can also access the mouse coordinates when you hover over the image and compute the date and time and display it above the image.

Now, enjoy Zurich Sky, and let me know what you think.

I will follow up on this by a second post that looks at some of the interesting features that can be seen in Zurich Sky. Please share your discoveries in the comments below!


Ralph Straumann

Ralph is a world-citizen, a geoinformation specialist by profession, and interested in many topics. Here, he'll confine himself mostly to things geo-visual.

You may also like...

2 Responses

  1. ann3k4 says:

    Just found this little piece of art in your Blog.
    reminded me on the weather scarf: http://www.20min.ch/schweiz/bern/story/20800145

Please let us know your opinion: Reply here

%d bloggers like this: