# The importsimport pandas as pdimport numpy as npfrom matplotlib import pyplot as pltimport requestsimport geopandas as gpdimport hvplot.pandasimport rasterio as rioimport rioxarrayimport xarray as xrimport hvplot.xarrayimport panel as pnimport osmnx as oxfrom shapely.geometry import Point# Make sure plots show up in JupyterLab!%matplotlib inline
Code
pd.options.display.max_columns =999
Data Exploratory
1. Hong Kong Population
Initially, we examined the population density across all 18 districts of Hong Kong. This analysis was based on the 2021 Census data obtained from the ESRI China data portal. The population density was calculated by dividing the total population of each district by its respective area.
Code
# url for population datapop_url = ("https://services3.arcgis.com/6j1KwZfY2fZrfNMR/arcgis/rest/services/Hong_Kong_Population_Density_2021/FeatureServer/0/query?outFields=*&where=1%3D1&f=geojson")pop_raw = gpd.read_file(pop_url)
It can be seen that the middle five districts: Kwun Tong, Wong Tai Sin, Kowloon City, Yau Tsim Mong, Sham Shui Po are having the highest population density, where there are various amenities such as museums, parks, extensive infrastructure, restaurants and shopping mall, as well as schools and hospitals. These regions are also called old city in Hong Kong, the opposite to the Hong Kong Island (Central, Wan Chai, and Eastern) where is well known for the city’s financial hub.
2. Hong Kong Rainfall
We aim to next examine the total annual rainfall in the Hong Kong area over the past thirty years. Situated in a region prone to tropical cyclones and substantial rainfall, Hong Kong experiences a predominantly rainy climate. This consistent exposure to heavy precipitation significantly elevates the risks of flooding and inundation.
The bar and line chart illustrates that precipitation levels in Hong Kong have remained relatively consistent over time, with occasional spikes attributed to regional extreme weather events. On average, there has not been a significant increase in total annual rainfall in the area.
3. Temperature
We next delve into an overview of the annual temperature trends, offering a concise preliminary examination that will be elaborated upon in the ‘Urban Heat Island’ section. In this analysis, we focus on three key metrics: the annual maximum temperature, minimum temperature, and mean temperature.
# Create a Select widget with options for 'temp_max', 'temp_min', 'temp_mean'select_widget = pn.widgets.Select(name='Temperature Metric', options=['temp_max', 'temp_min', 'temp_mean'])# Define a function that creates an hvplot based on the selected metricdef create_temperature_plot(metric):return temp_data.hvplot.line(x='Year', y=metric, height=400, width=700, title=f'Yearly Temperature ({metric})', rot=90)# Bind the plot function to the widgetdynamic_plot = pn.bind(create_temperature_plot, metric=select_widget)# Create a Panel layout with the widget and the bound plotlayout = pn.Column(select_widget, dynamic_plot)# If running in a Jupyter notebook, display the Panel layout using:layout
Analyzing the graph spanning from 1990 to 2023, we observe a clear upward trend in temperatures, indicating a general increase over time. This pattern suggests that Hong Kong is not immune to the effects of global climate change, which appears to be contributing to progressively warmer conditions in the region. Furthermore, the rapid urbanization of Hong Kong is likely exacerbating this warming trend. To understand this phenomenon in greater depth, we will conduct a thorough analysis and evaluation of the Urban Heat Island effect across various regions in Hong Kong.