{"id":1299,"date":"2013-06-21T16:26:08","date_gmt":"2013-06-21T16:26:08","guid":{"rendered":"http:\/\/www.ralphstraumann.ch\/blog\/?p=1299"},"modified":"2013-12-10T10:31:40","modified_gmt":"2013-12-10T10:31:40","slug":"zurich-sky","status":"publish","type":"post","link":"https:\/\/www.ralphstraumann.ch\/blog\/2013\/06\/zurich-sky\/","title":{"rendered":"Zurich Sky"},"content":{"rendered":"<p>&#8230; is the title of my most recent project. It&#8217;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).<\/p>\n<p>In <a href=\"http:\/\/www.ralphstraumann.ch\/projects\/zurich-sky\/\"><em>Zurich Sky<\/em><\/a>, 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 <a href=\"http:\/\/www.switch.ch\/\">SWITCH<\/a>. They have <a href=\"http:\/\/webcam.switch.ch\/\">two webcams<\/a>, one <a href=\"http:\/\/cam.switch.ch\/index.en.html\">in Zurich<\/a> one <a href=\"http:\/\/webcam.switch.ch\/jungfraujoch\/\">in the Alps<\/a>, whose images are publicly accessible in <a href=\"http:\/\/cam.switch.ch\/cgi-bin\/pano2.pl?l=1\">their archive<\/a>\u00a0(thanks!).<\/p>\n<figure style=\"width: 600px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.ralphstraumann.ch\/projects\/zurich-sky\/\"><img loading=\"lazy\" decoding=\"async\" title=\"Zurich Sky: Web-scraped sky colour over Zurich, Switzerland\" alt=\"Zurich Sky: Web-scraped sky colour over Zurich, Switzerland\" src=\"http:\/\/www.ralphstraumann.ch\/blog\/wp-content\/uploads\/2013\/06\/zurich_sky.png\" width=\"600\" height=\"404\" \/><\/a><figcaption class=\"wp-caption-text\">Zurich Sky: Web-scraped sky colour over Zurich, Switzerland<\/figcaption><\/figure>\n<p><span style=\"line-height: 1.714285714; font-size: 1rem;\">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:<\/span><\/p>\n<p><code><a href=\"http:\/\/cam.switch.ch\/pano\/2013\/0621\/zueri_n201306211300.jpg\">http:\/\/cam.switch.ch\/pano\/2013\/0621\/zueri_n201306211300.jpg<\/a><\/code><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" style=\"line-height: 1.714285714; font-size: 1rem;\" alt=\"\" src=\"http:\/\/cam.switch.ch\/pano\/2013\/0621\/zueri_n201306211300.jpg\" width=\"1000\" height=\"209\" \/>(as can be seen from\u00a0<a href=\"http:\/\/cam.switch.ch\/cgi-bin\/pano2.pl?l=1&amp;p=2&amp;date=201306211300\">this webpage<\/a>)<!--more--><\/p>\n<p>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\u00a08,760 of them.<\/p>\n<p>I also wrote a second Python script that checks for data gaps. There have been some few hours for which my script didn&#8217;t get an image. I didn&#8217;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).<\/p>\n<p>I then drew a binary (black-white) mask of the sky in the webcam picture.\u00a0For 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\u00efve 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 <em>Zurich Sky<\/em>.<\/p>\n<p>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\u20132012 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.<\/p>\n<p><strong>Now, enjoy\u00a0<em><a href=\"http:\/\/www.ralphstraumann.ch\/projects\/zurich-sky\/\">Zurich Sky<\/a><\/em><\/strong>, and let me know what you think.<\/p>\n<p>I will follow up on this by a second post that looks at some of the interesting features that can be seen in <em>Zurich Sky<\/em>. Please share your discoveries in the comments below!<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8230; is the title of my most recent project. It&#8217;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 &hellip; <a href=\"https:\/\/www.ralphstraumann.ch\/blog\/2013\/06\/zurich-sky\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Zurich Sky<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":1301,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[8],"tags":[17,51,52,64,125,140],"class_list":["post-1299","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-piece","tag-art","tag-fun","tag-geo","tag-imagery","tag-visualization","tag-web-scraping"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ralphstraumann.ch\/blog\/wp-content\/uploads\/2013\/06\/zurich_sky.png","jetpack_shortlink":"https:\/\/wp.me\/p3pPwF-kX","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ralphstraumann.ch\/blog\/wp-json\/wp\/v2\/posts\/1299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ralphstraumann.ch\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ralphstraumann.ch\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ralphstraumann.ch\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ralphstraumann.ch\/blog\/wp-json\/wp\/v2\/comments?post=1299"}],"version-history":[{"count":14,"href":"https:\/\/www.ralphstraumann.ch\/blog\/wp-json\/wp\/v2\/posts\/1299\/revisions"}],"predecessor-version":[{"id":1424,"href":"https:\/\/www.ralphstraumann.ch\/blog\/wp-json\/wp\/v2\/posts\/1299\/revisions\/1424"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ralphstraumann.ch\/blog\/wp-json\/wp\/v2\/media\/1301"}],"wp:attachment":[{"href":"https:\/\/www.ralphstraumann.ch\/blog\/wp-json\/wp\/v2\/media?parent=1299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ralphstraumann.ch\/blog\/wp-json\/wp\/v2\/categories?post=1299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ralphstraumann.ch\/blog\/wp-json\/wp\/v2\/tags?post=1299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}