Chasing Summers#
After living through Melbourne’s winter, I now have a greater appreciation of the sun. This lead me thinking. I love living in the sun, which means that ideally I would live in two cities: one in the northern hemisphere and one in the south. I could then live an endless summer by switching cities whenever winter loomed. But here is the question, what two cities would I select?
To narrow down my search, I limited my selection to the top 10 most livable cities as chosen by the EIU.[1] These consist of the following:
---------------------------------------------------------------------------
HTTPError Traceback (most recent call last)
Cell In[3], line 1
----> 1 df = get_wiki_livable_cities_df()
2 cities_of_interest = [unidecode(x) for x in df["City"]]
3 markdown = ""
Cell In[2], line 62, in get_wiki_livable_cities_df()
61 def get_wiki_livable_cities_df():
---> 62 html = scrape_static_site("https://en.wikipedia.org/wiki/Global_Liveability_Ranking")
64 soup = BeautifulSoup(html, "html.parser")
65 table = soup.find("table", {"class": "wikitable"})
Cell In[2], line 2, in scrape_static_site(url)
1 def scrape_static_site(url):
----> 2 page = urlopen(url)
3 html_bytes = page.read()
4 html = html_bytes.decode("utf-8")
File /usr/lib/python3.12/urllib/request.py:215, in urlopen(url, data, timeout, cafile, capath, cadefault, context)
213 else:
214 opener = _opener
--> 215 return opener.open(url, data, timeout)
File /usr/lib/python3.12/urllib/request.py:521, in OpenerDirector.open(self, fullurl, data, timeout)
519 for processor in self.process_response.get(protocol, []):
520 meth = getattr(processor, meth_name)
--> 521 response = meth(req, response)
523 return response
File /usr/lib/python3.12/urllib/request.py:630, in HTTPErrorProcessor.http_response(self, request, response)
627 # According to RFC 2616, "2xx" code indicates that the client's
628 # request was successfully received, understood, and accepted.
629 if not (200 <= code < 300):
--> 630 response = self.parent.error(
631 'http', request, response, code, msg, hdrs)
633 return response
File /usr/lib/python3.12/urllib/request.py:559, in OpenerDirector.error(self, proto, *args)
557 if http_err:
558 args = (dict, 'default', 'http_error_default') + orig_args
--> 559 return self._call_chain(*args)
File /usr/lib/python3.12/urllib/request.py:492, in OpenerDirector._call_chain(self, chain, kind, meth_name, *args)
490 for handler in handlers:
491 func = getattr(handler, meth_name)
--> 492 result = func(*args)
493 if result is not None:
494 return result
File /usr/lib/python3.12/urllib/request.py:639, in HTTPDefaultErrorHandler.http_error_default(self, req, fp, code, msg, hdrs)
638 def http_error_default(self, req, fp, code, msg, hdrs):
--> 639 raise HTTPError(req.full_url, code, msg, hdrs, fp)
HTTPError: HTTP Error 403: Forbidden
After being traumatised by Melbourne’s perpetual winters, the next questions became obvious: how warm and sunny are these cities?
Monthly temperature of different cities#
Let’s first start with temperature. I found online that the ideal temperature for humans to live in is between 20°C and 25°C, otherwise known by its fancy term: the ‘thermalneutral’ zone.[2] Because of my summer bias, I opted to extend this ‘optimal’ range all the way to 30°C.
Below I then graphed out the monthly temperatures of our candidate cities, with our warm 20°C to 30°C goldilocks zone highlighted in green.
When looking at Sydney and Vienna, you can see that their temperatures exactly align when winter approaches for either city. It seems we have our best candidates.
Daily sunshine of different cities#
Next, we move onto sunshine. This metric is measured in ‘sunshine hours’, which as the name suggests, simply means how many hours are spent in sunshine per day. Here we simply prefer higher results over lower ones.
As we can see, our previous candidates of Vienna and Sydney still hold up. Although Sydney is already quite consistent with sunshine, the objective improvement of Vienna’s summer sunshine over Sydney’s fairer winter is still appreciated.
Anyway, so in conclusion, Vienna and Sydney seem good. Again, to reiterate, this research is nothing formal and was just something I found fun, so hope it was interesting!